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