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