示例#1
0
 public ActionResult EmployeeTerminatedAdd(EmployeeTerminatedFormModel item)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Termination terminate = Mapper.Map<EmployeeTerminatedFormModel, Termination>(item);
             terminateService.CreateEmployeeTerminated(terminate);
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
             return Json(new { status = "Errors", messeage = e.Message});
         }
         return Json(new { status = "OK", messeage = "xxx" });
     }
     else
     {
         return Json(new { status = "NotValid", messeage = "yyy" });
     }
 }
示例#2
0
        public ActionResult Terminate()
        {
            ApplicationUser user = userManager.FindById(User.Identity.GetUserId());
            var companies = companyService.GetCompaniesByUser(user);
            var positions = positionService.GetPositions();
            List<int> companyIdList = new List<int>();
            foreach (Company item in companies)
            {
                companyIdList.Add(item.Id);
            }
            var employees = employeeService.GetCurrentEmployeesBySpecifyCompany(companyIdList,null);
            var employee = employees.FirstOrDefault();
            var employeesTerminated = terminateService.GetEmployeesTerminatedByUser(user);
            var employeesView = Mapper.Map<IEnumerable<Employee>, IEnumerable<EmployeeViewModel>>(employees);
            var employeesTerminatedView = Mapper.Map<IEnumerable<Termination>, IEnumerable<EmployeeTerminateViewModel>>(employeesTerminated);

            EmployeeTerminatedFormModel terminateFormModel;
            if(employee != null)
            {
                terminateFormModel = new EmployeeTerminatedFormModel(employee);
            }
            else
            {
                terminateFormModel = new EmployeeTerminatedFormModel();
            }
            ViewData["companies"] = companies.ToSelectListItems();
            ViewData["Positions"] = positions.ToSelectListItems();
            ViewData["Employees"] = employeesView;
            ViewData["TerminateFormModel"] = terminateFormModel;
            ViewData["EmployeesTerminated"] = employeesTerminatedView;
            return View();
        }
示例#3
0
 public ActionResult EmployeeInformationById(int id)
 {
     EmployeeTerminatedFormModel employeeTerminatedFormModel;
     if (id != 0)
     {
         var employee = employeeService.GetEmployee(id);
         employeeTerminatedFormModel = new EmployeeTerminatedFormModel(employee);
     }
     else
     {
         employeeTerminatedFormModel = new EmployeeTerminatedFormModel();
     }
     return PartialView("EmployeesTerminate/_CbpEmployeeTerminateInfor", employeeTerminatedFormModel);
 }