ResumeAction.java~20~
上传用户:zghglow
上传日期:2022-08-09
资源大小:27227k
文件大小:8k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

JavaScript

  1. package com.chinacannel.xlchemical.struts.Action;
  2. import org.apache.struts.actions.DispatchAction;
  3. import org.apache.struts.action.ActionForward;
  4. import javax.servlet.http.HttpServletRequest;
  5. import org.apache.struts.action.ActionMapping;
  6. import javax.servlet.http.HttpServletResponse;
  7. import org.apache.struts.action.ActionForm;
  8. import com.chinacannel.xlchemical.struts.ActionForm.ResumeActionForm;
  9. import com.chinacannel.xlchemical.service.ResumeService;
  10. import com.chinacannel.entity.Resume;
  11. import com.chinacannel.entity.Jobs;
  12. import com.chinacannel.xlchemical.service.JobsService;
  13. import java.util.Date;
  14. import com.chinacannel.common.PageInfo;
  15. import com.chinacannel.entity.Menu;
  16. import java.util.List;
  17. import com.chinacannel.xlchemical.service.MenuService;
  18. public class ResumeAction extends DispatchAction {
  19.     private ResumeService rs = new ResumeService();
  20.     private MenuService ms = new MenuService();
  21.     //添加应聘信息
  22.     public ActionForward AddResume(ActionMapping actionMapping,
  23.                                    ActionForm actionForm,
  24.                                    HttpServletRequest servletRequest,
  25.                                    HttpServletResponse servletResponse) {
  26.         ResumeActionForm raf = (ResumeActionForm)actionForm;
  27.         JobsService js = new JobsService();
  28.         Resume resume = new Resume();
  29.         Jobs jobs = new Jobs();
  30.         Long jobID = new Long(0);
  31.         String Language = "CN";
  32.         try {
  33.             if (servletRequest.getSession().getAttribute("Language") != null) {
  34.                 Language = servletRequest.getSession().getAttribute("Language").
  35.                            toString();
  36.             }
  37.             jobID = new Long(servletRequest.getParameter("jobID"));
  38.             rs.beginTran();
  39.             jobs = js.GetJobsById(jobID);
  40.             resume.setJobs(jobs);
  41.             resume.setRes_Address(raf.getAddress());
  42.             resume.setRes_Brithday(raf.getYear() + "-" + raf.getMonth() + "-" +
  43.                                    raf.getDay());
  44.             resume.setRes_Education(raf.getEducation());
  45.             resume.setRes_Email(raf.getEmail());
  46.             resume.setRes_Experience(raf.getExperience());
  47.             resume.setRes_Graduate(raf.getGraduate());
  48.             resume.setRes_Introduce(raf.getIntroduce());
  49.             resume.setRes_Marriage(raf.getMarriage());
  50.             resume.setRes_Name(raf.getName());
  51.             resume.setRes_Nativeplace(raf.getNativeplace());
  52.             resume.setRes_Polity(raf.getPolity());
  53.             resume.setRes_PostCode(raf.getPostCode());
  54.             resume.setRes_Power(raf.getPower());
  55.             resume.setRes_Sex(raf.getSex());
  56.             resume.setRes_Specialty(raf.getSpecialty());
  57.             resume.setRes_Tel(raf.getTel());
  58.             resume.setRes_Time(new Date());
  59.             rs.AddResume(resume);
  60.             rs.commit();
  61.         } catch (Exception ex) {
  62.             log.error(ex.getMessage(), ex);
  63.             try {
  64.                 rs.rollback();
  65.             } catch (Exception ex2) {
  66.                 log.error(ex2.getMessage(), ex2);
  67.             }
  68.         }
  69.         String Message = "";
  70.         if (Language.equals("CN")) {
  71.             Message = "";
  72.         }else{
  73.         }
  74.         servletRequest.setAttribute("Message","提交成功,请等待回复");
  75.         servletRequest.setAttribute
  76.                 ("Url", "/Index.do?todo=OpenJobs&fMenuID=" +
  77.                  servletRequest.getParameter("fMenuID"));
  78.         servletRequest.setAttribute("resume", resume);
  79.         return actionMapping.findForward("AddResume");
  80.     }
  81.     //打开招聘页
  82.     public ActionForward OpenResume(ActionMapping actionMapping,
  83.                                     ActionForm actionForm,
  84.                                     HttpServletRequest servletRequest,
  85.                                     HttpServletResponse servletResponse) {
  86.         JobsService js = new JobsService();
  87.         Long jobID = new Long(0);
  88.         Jobs job = null;
  89.         String Language = "CN";
  90.         try {
  91.             if (servletRequest.getSession().getAttribute("Language") != null) {
  92.                 Language = servletRequest.getSession().getAttribute("Language").
  93.                            toString();
  94.             }
  95.             js.beginTran();
  96.             jobID = new Long(servletRequest.getParameter("jobID"));
  97.             job = js.GetJobsById(jobID);
  98.             LeftMenu(Language,servletRequest);
  99.             js.commit();
  100.         } catch (Exception ex) {
  101.             log.error(ex.getMessage(), ex);
  102.             try {
  103.                 js.rollback();
  104.             } catch (Exception ex2) {
  105.                 log.error(ex2.getMessage(), ex2);
  106.             }
  107.         }
  108.         servletRequest.setAttribute("jobs", job);
  109.         return actionMapping.findForward("OpenResume");
  110.     }
  111.     private void LeftMenu(String Language, HttpServletRequest servletRequest) {
  112.         List menuList = null;
  113.         Menu fMenu = null;
  114.         Long fMenuID = new Long(0);
  115.         if (servletRequest.getParameter("fMenuID") != null) {
  116.             fMenuID = new Long(servletRequest.getParameter("fMenuID"));
  117.         }
  118.         fMenu = ms.GetMenuById(fMenuID);
  119.         menuList = ms.GetMenuBySuperior(fMenuID, Language);
  120.         servletRequest.setAttribute("menu", fMenu);
  121.         servletRequest.setAttribute("menuList", menuList);
  122.     }
  123.     //打开后台应聘列表页
  124.     public ActionForward OpenResumeList(ActionMapping actionMapping,
  125.                                         ActionForm actionForm,
  126.                                         HttpServletRequest servletRequest,
  127.                                         HttpServletResponse servletResponse) {
  128.         PageInfo pageInfo = null;
  129.         int pageNo = 0;
  130.         try {
  131.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  132.         } catch (Exception ex1) {}
  133.         try {
  134.             rs.beginTran();
  135.             pageInfo = rs.getPageInfo(pageNo);
  136.             rs.commit();
  137.         } catch (Exception ex) {
  138.             log.error(ex.getMessage(), ex);
  139.             try {
  140.                 rs.rollback();
  141.             } catch (Exception ex2) {
  142.                 log.error(ex2.getMessage(), ex2);
  143.             }
  144.         }
  145.         servletRequest.setAttribute("pageInfo", pageInfo);
  146.         return actionMapping.findForward("OpenResumeList");
  147.     }
  148.     //打开后台应聘者详细信息页
  149.     public ActionForward OpenResumeInfo(ActionMapping actionMapping,
  150.                                         ActionForm actionForm,
  151.                                         HttpServletRequest servletRequest,
  152.                                         HttpServletResponse servletResponse) {
  153.         Long resID = new Long(0);
  154.         Resume resume = null;
  155.         try {
  156.             resID = new Long(servletRequest.getParameter("resID"));
  157.             rs.beginTran();
  158.             resume = rs.GetResumeById(resID);
  159.             rs.commit();
  160.         } catch (Exception ex) {
  161.             log.error(ex.getMessage(), ex);
  162.             try {
  163.                 rs.rollback();
  164.             } catch (Exception ex2) {
  165.                 log.error(ex2.getMessage(), ex2);
  166.             }
  167.         }
  168.         servletRequest.setAttribute("resume", resume);
  169.         return actionMapping.findForward("OpenResumeInfo");
  170.     }
  171.     public ActionForward DeleteResume(ActionMapping actionMapping,
  172.                                       ActionForm actionForm,
  173.                                       HttpServletRequest servletRequest,
  174.                                       HttpServletResponse servletResponse) {
  175.         boolean b = false;
  176.         String Message = "";
  177.         try {
  178.             rs.beginTran();
  179.             Resume res = rs.GetResumeById(new Long(servletRequest.getParameter(
  180.                     "resID")));
  181.             b = rs.DeleteResume(res);
  182.             Message = "删除成功,请返回!";
  183.             rs.commit();
  184.         } catch (Exception ex) {
  185.             log.error(ex.getMessage(), ex);
  186.             try {
  187.                 rs.rollback();
  188.             } catch (Exception ex2) {
  189.                 log.error(ex2.getMessage(), ex2);
  190.             }
  191.         }
  192.         if (b == false) {
  193.             Message = "删除失败,请返回!";
  194.         }
  195.         servletRequest.setAttribute("Message", Message);
  196.         servletRequest.setAttribute("Url",
  197.                                     "/Manage/Resume.do?todo=OpenResumeList");
  198.         return actionMapping.findForward("DeleteResume");
  199.     }
  200. }