Beispiel #1
0
 public void TwoObjectSameIdNotEquals()
 {
     Employee emp1 = new Employee();
     emp1.Id = 1;
     Employee emp2 = new Employee();
     emp2.Id = 1;
     Assert.IsFalse(emp1 == emp2);
 }
Beispiel #2
0
 public void ObjectNotContainsListObject()
 {
     Employee emp1 = new Employee();
     emp1.Id = 1;
     emp1.LastName = "Hoang";
     Employee em2 = new Employee();
     em2.Id = 2;
     em2.LastName = "Hung";
     List<Employee> listEmp = new List<Employee>();
     listEmp.Add(emp1);
     Assert.IsFalse(listEmp.Contains(em2));
 }
 public EmployeeTransferFormModel(Employee Employee)
 {
     TransferDate = DateTime.Now;
       this.EmployeeCode = Employee.EmployeeCode;
       this.EmployeeId = Employee.Id;
       this.Name = Employee.FullName;
       this.CompanyName = Employee.Company.CompanyName;
       this.NewDepartement = Employee.Departement;
       this.NewCompanyId = Employee.Company.Id;
       this.NewPositionId = Employee.Position.Id;
       this.Address = Employee.Address;
       this.Gender = Employee.Gender;
       this.Departement = Employee.Departement;
       this.PositionName = Employee.Position.PositionName;
       this.JoinedDate = Employee.JoinedDate;
       this.Salary = Employee.Salary;
       this.NewSalary = this.Salary;
       this.IsInsuranceTransfer = false;
       this.InsuranceAmount = 0;
       this.InsuranceApplyDate = (Employee.GetMadatoryInsurance() != null ) ? Employee.GetMadatoryInsurance().DateOfIssue : DateTime.Now;
       this.OldMandatoryInsurance = (Employee.GetMadatoryInsurance() != null) ? Employee.GetMadatoryInsurance().Values : 0;
 }
Beispiel #4
0
 public void TwoObjectNotEquals()
 {
     Employee emp1 = new Employee();
     Employee emp2 = new Employee();
     Assert.IsTrue(emp1 != emp2);
 }
Beispiel #5
0
        //[ValidateInput(false)]
        //public ActionResult EmployeeDetail(int? id)
        //{
        //    if(id.HasValue && id != 0)
        //    {
        //        var employee = employeeService.GetEmployee(id.Value);
        //        if(employee != null)
        //        {
        //            EmployeeInfoModel employeeInfor = new EmployeeInfoModel() {
        //                Id = employee.Id,
        //                LastName = employee.LastName,
        //                FirstName = employee.FirstName,
        //                EmployeeNo = employee.EmployeeNo,
        //                IdentityNo = employee.Identity.IdentityNo,
        //                IdentityDateOfIssue = employee.Identity.DateOfIssue,
        //                Gender = employee.Gender,
        //                MaritalStatus = employee.MaritalStatus,
        //                Nationality = employee.Nationality,
        //                Photo = employee.Photo,
        //                BirthDay = (DateTime)employee.BirthDay,
        //            };
        //            ViewData["employeeInfor"] = employeeInfor;
        //            //
        //            EmployeeFunctionTabViewModel employeeFunctionTabViewModel = CreateEmployeeFunctionViewModelFromEmployee(employee);
        //            return View(employeeFunctionTabViewModel);
        //        }
        //    }
        //    return RedirectToAction("EmployeeList");
        //}
        private EmployeeFunctionTabViewModel CreateEmployeeFunctionViewModelFromEmployee(Employee employee)
        {
            EmployeeFunctionTabViewModel employeeFunctionTabViewModel = new EmployeeFunctionTabViewModel();
            if (employee.Status == EmployeeStatus.Terminated)
            {
                employeeFunctionTabViewModel.IsEnabled = false;
            }
            else
            {
                employeeFunctionTabViewModel.IsEnabled = true;
            }
            EmployeeContactTabViewModel employeeContactTabViewModel = Mapper.Map<Employee, EmployeeContactTabViewModel>(employee);
            EmployeeJobTabViewModel employeeJobTabViewModel = Mapper.Map<Employee, EmployeeJobTabViewModel>(employee);
            employeeJobTabViewModel.PositionsList = positionService.GetPositions();
            employeeJobTabViewModel.CompanyList = companyService.GetCompanies();

            EmployeeContractTabViewModel employeeContractTabViewModel = new EmployeeContractTabViewModel();
            employeeContractTabViewModel.ContractsViewModel = Mapper.Map<IEnumerable<Contract>, IEnumerable<EmployeeContractsViewModel>>(employee.Contracts);
            employeeContractTabViewModel.ContractTypeList = contractService.GetContractTypes();
            employeeContractTabViewModel.IsEnable = employee.Status == EmployeeStatus.Terminated ? false : true;

            GetInsuranceByEmployeeIdRequest request = new GetInsuranceByEmployeeIdRequest()
            {
                EmployeeId = employee.Id
            };
            GetInsuranceByEmployeeIdResponse response = insuranceService.GetInsuranceByEmployeeId(request);
            EmployeeInsuranceTabViewModel empInsuranceTabView = new EmployeeInsuranceTabViewModel()
            {

                InsuranceList = Mapper.Map<IEnumerable<Insurance>,IEnumerable<InsuranceGridView>>( response.InsuranceList),
                HasMandatoryInsurance = response.HasMandatoryInsurance,
                HasVoluntaryInsurance = response.HasVoluntaryInsurance
            };

            var empSalaryComponents = salaryService.GetSalaryComponentByEmployeeId(employee.Id);
            var empSalaryComponentsView = Mapper.Map<IEnumerable<EmployeeSalaryComponents>, IEnumerable<EmployeeSalaryComponentViewModel>>(empSalaryComponents);

            EmployeeSalaryTabViewModel empSalaryTabView = new EmployeeSalaryTabViewModel(){
                EmployeeSalaryComponents = empSalaryComponentsView,
                HaveSalaryComponent = empSalaryComponents.Count() == 0 ? false : true,

            };

            // Experience
            var experiences = experienceService.GetExperirenceByEmployeeId(employee.Id);
            EmployeeExperienceTabViewModel experienceTabView = new EmployeeExperienceTabViewModel();
            var experiencesViewModel = Mapper.Map<IEnumerable<Experience>, IEnumerable<TransferEmployeeGridViewModel>>(experiences);
            experienceTabView.ExperiencesList = experiencesViewModel;

            employeeFunctionTabViewModel.EmployeeId = employee.Id;
            employeeFunctionTabViewModel.EmployeeContactTabViewModel = employeeContactTabViewModel;
            employeeFunctionTabViewModel.EmployeeContractTabViewModel = employeeContractTabViewModel;
            employeeFunctionTabViewModel.EmployeeJobTabViewModel = employeeJobTabViewModel;
            employeeFunctionTabViewModel.EmployeeInsuranceTabViewModel = empInsuranceTabView;
            employeeFunctionTabViewModel.EmployeeSalaryTabViewModel = empSalaryTabView;
            employeeFunctionTabViewModel.EmployeeExperienceTabViewModel = experienceTabView;
            return employeeFunctionTabViewModel;
        }
Beispiel #6
0
 public ActionResult EmployeesContractsGridView(int? id)
 {
     if(id.HasValue && id != 0)
     {
         var employee = employeeService.GetEmployee(id.Value);
         var contracts = Mapper.Map<IEnumerable<Contract>,IEnumerable<EmployeeContractsViewModel>>(employee.Contracts);
         ViewData["IsEnable"] = employee.Status == EmployeeStatus.Terminated ? false : true;
         return PartialView("EmployeeContractTabs/_EmployeeContractsHistoryGridViewPartial", contracts);
     }
     Employee employeeNew = new Employee();
     return PartialView("EmployeeContractTabs/_EmployeeContractsHistoryGridViewPartial", employeeNew.Contracts);
 }
Beispiel #7
0
        public ActionResult AjaxEmployeeSimpleAdd(EmployeeSimpleFormModel employeeSimpleAdd)
        {
            string checkModel = employeeSimpleAdd.CheckIfViewModelIsValid();
            if (ModelState.IsValid && checkModel == "")
            {

                if (employeeService.GetEmployeeByEmployeeCode(employeeSimpleAdd.EmployeeCode) == null)
                {
                    var employee = new Employee()
                    {
                        LastName = employeeSimpleAdd.LastName,
                        FirstName = employeeSimpleAdd.FirstName,
                        Gender = employeeSimpleAdd.Gender,
                        BirthDay = employeeSimpleAdd.BirthDay,
                        Identity = new Identity() { IdentityNo = employeeSimpleAdd.IdentityNo, DateOfIssue = employeeSimpleAdd.IdentityDateOfIssue },
                        CompanyId = employeeSimpleAdd.CompanyId,
                        PositionId = employeeSimpleAdd.PositionId,
                        JoinedDate = employeeSimpleAdd.JoinedDate,
                        Salary = employeeSimpleAdd.Salary,
                        MaritalStatus = employeeSimpleAdd.MaritalStatus,
                        Departement = employeeSimpleAdd.Departement,
                        Nationality = employeeSimpleAdd.Nationality,
                        EmployeeCode = employeeSimpleAdd.EmployeeCode,
                    };
                    CreateEmployeeResponse response = employeeService.CreateEmployee(employee);
                    if (response.Status)
                    {
                        return Json(new { status = "Success", message = response.Message });
                    }
                    else
                    {
                        return Json(new { status = "Fail", message = response.Message });
                    }
                }
                else {
                    return Json(new { status = "Fail", message = "Mã nhân viên đã tồn tại" });
                }
            }
            else
            {

                if (checkModel != "")
                {
                    return Json(new { status = "Fail", message = checkModel });
                }
                else {
                    return Json(new { status = "Fail", message = "Kiểm tra dữ liệu nhập" });
                }

            }
        }