ResumeAction.java
上传用户: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.             Message = "To succeed, please wait for return!";
  74.         }
  75.         servletRequest.setAttribute("Message", Message);
  76.         servletRequest.setAttribute
  77.                 ("Url", "/Index.do?todo=OpenJobs&fMenuID=" +
  78.                  servletRequest.getParameter("fMenuID"));
  79.         servletRequest.setAttribute("resume", resume);
  80.         return actionMapping.findForward("AddResume");
  81.     }
  82.     //打开招聘页
  83.     public ActionForward OpenResume(ActionMapping actionMapping,
  84.                                     ActionForm actionForm,
  85.                                     HttpServletRequest servletRequest,
  86.                                     HttpServletResponse servletResponse) {
  87.         JobsService js = new JobsService();
  88.         Long jobID = new Long(0);
  89.         Jobs job = null;
  90.         String Language = "CN";
  91.         try {
  92.             if (servletRequest.getSession().getAttribute("Language") != null) {
  93.                 Language = servletRequest.getSession().getAttribute("Language").
  94.                            toString();
  95.             }
  96.             js.beginTran();
  97.             jobID = new Long(servletRequest.getParameter("jobID"));
  98.             job = js.GetJobsById(jobID);
  99.             LeftMenu(Language,servletRequest);
  100.             js.commit();
  101.         } catch (Exception ex) {
  102.             log.error(ex.getMessage(), ex);
  103.             try {
  104.                 js.rollback();
  105.             } catch (Exception ex2) {
  106.                 log.error(ex2.getMessage(), ex2);
  107.             }
  108.         }
  109.         servletRequest.setAttribute("jobs", job);
  110.         return actionMapping.findForward("OpenResume");
  111.     }
  112.     private void LeftMenu(String Language, HttpServletRequest servletRequest) {
  113.         List menuList = null;
  114.         Menu fMenu = null;
  115.         Long fMenuID = new Long(0);
  116.         if (servletRequest.getParameter("fMenuID") != null) {
  117.             fMenuID = new Long(servletRequest.getParameter("fMenuID"));
  118.         }
  119.         fMenu = ms.GetMenuById(fMenuID);
  120.         menuList = ms.GetMenuBySuperior(fMenuID, Language);
  121.         servletRequest.setAttribute("menu", fMenu);
  122.         servletRequest.setAttribute("menuList", menuList);
  123.     }
  124.     //打开后台应聘列表页
  125.     public ActionForward OpenResumeList(ActionMapping actionMapping,
  126.                                         ActionForm actionForm,
  127.                                         HttpServletRequest servletRequest,
  128.                                         HttpServletResponse servletResponse) {
  129.         PageInfo pageInfo = null;
  130.         int pageNo = 0;
  131.         try {
  132.             pageNo = Integer.parseInt(servletRequest.getParameter("pageNo"));
  133.         } catch (Exception ex1) {}
  134.         try {
  135.             rs.beginTran();
  136.             pageInfo = rs.getPageInfo(pageNo);
  137.             rs.commit();
  138.         } catch (Exception ex) {
  139.             log.error(ex.getMessage(), ex);
  140.             try {
  141.                 rs.rollback();
  142.             } catch (Exception ex2) {
  143.                 log.error(ex2.getMessage(), ex2);
  144.             }
  145.         }
  146.         servletRequest.setAttribute("pageInfo", pageInfo);
  147.         return actionMapping.findForward("OpenResumeList");
  148.     }
  149.     //打开后台应聘者详细信息页
  150.     public ActionForward OpenResumeInfo(ActionMapping actionMapping,
  151.                                         ActionForm actionForm,
  152.                                         HttpServletRequest servletRequest,
  153.                                         HttpServletResponse servletResponse) {
  154.         Long resID = new Long(0);
  155.         Resume resume = null;
  156.         try {
  157.             resID = new Long(servletRequest.getParameter("resID"));
  158.             rs.beginTran();
  159.             resume = rs.GetResumeById(resID);
  160.             rs.commit();
  161.         } catch (Exception ex) {
  162.             log.error(ex.getMessage(), ex);
  163.             try {
  164.                 rs.rollback();
  165.             } catch (Exception ex2) {
  166.                 log.error(ex2.getMessage(), ex2);
  167.             }
  168.         }
  169.         servletRequest.setAttribute("resume", resume);
  170.         return actionMapping.findForward("OpenResumeInfo");
  171.     }
  172.     public ActionForward DeleteResume(ActionMapping actionMapping,
  173.                                       ActionForm actionForm,
  174.                                       HttpServletRequest servletRequest,
  175.                                       HttpServletResponse servletResponse) {
  176.         boolean b = false;
  177.         String Message = "";
  178.         try {
  179.             rs.beginTran();
  180.             Resume res = rs.GetResumeById(new Long(servletRequest.getParameter(
  181.                     "resID")));
  182.             b = rs.DeleteResume(res);
  183.             Message = "删除成功,请返回!";
  184.             rs.commit();
  185.         } catch (Exception ex) {
  186.             log.error(ex.getMessage(), ex);
  187.             try {
  188.                 rs.rollback();
  189.             } catch (Exception ex2) {
  190.                 log.error(ex2.getMessage(), ex2);
  191.             }
  192.         }
  193.         if (b == false) {
  194.             Message = "删除失败,请返回!";
  195.         }
  196.         servletRequest.setAttribute("Message", Message);
  197.         servletRequest.setAttribute("Url",
  198.                                     "Manage/Resume.do?todo=OpenResumeList");
  199.         return actionMapping.findForward("DeleteResume");
  200.     }
  201. }