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