public ActionResult CompanyAdd(CompanyConfigModel item) { if (ModelState.IsValid) { try { Company company = new Company() { CompanyName = item.CompanyName, CompanyInsuranceRatePercent = item.CompanyInsuranceRatePercent, LabaratorInsuranceRatePercent = item.LabaratorInsuranceRatePercent, NumberCodeStarRange = item.NumberCodeStarRange, NumberCodeEndRange = item.NumberCodeEndRange, CompanyCode = item.CompanyCode }; companyService.CreateCompany(company); } catch (Exception e) { ViewData["EditError"] = e.Message; } } else ViewData["EditError"] = "Xin vui lòng kiểm tra lại dữ liệu nhập."; var companies = companyService.GetCompanies(); var companiesView = Mapper.Map<IEnumerable<Company>, IEnumerable<CompanyConfigModel>>(companies); return PartialView("Company/_CompanyGridViewPartial", companiesView); }
public int[] GetTerminatedEmployeeQuantityByCompany(Company Company) { int[] result = new int[12]; for (int i = 0; i < 12; i++) { if(Company != null) { int year = DateTime.Now.Year; int month = i + 1; int lastDate = DateTime.DaysInMonth(year, month); result[i] = GetTerminatedEmployeeQuantityByDate(Company.Id, new DateTime(year, month, 1), new DateTime(year, month, lastDate)); } else { result[i] = 0; } } return result; }
public IList<EmployeeTypeQuantityChartModel> GetEmployeeTypeQuantityByCompany(Company Company) { List<EmployeeTypeQuantityChartModel> result = new List<EmployeeTypeQuantityChartModel>(); if(Company != null) { string[] types = new string[] { "Tuyển mới", "Thôi việc" }; string[] months = new string[] { "Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12" }; Dictionary<string, IList<int>> values = new Dictionary<string, IList<int>>(); values.Add(types[0], reportService.GetNewEmployeeQuantityTypeByCompany(Company)); values.Add(types[1], reportService.GetTerminatedEmployeeQuantityByCompany(Company)); foreach (string type in types) for (int i = 0; i < months.Length; i++) result.Add(new EmployeeTypeQuantityChartModel(months[i], type, values[type][i])); } return result; }
public void EditCompany(Company Company) { companyRepository.Update(Company); SaveCompany(); }
public void DeleteCompany(Company Company) { companyRepository.Delete(Company); SaveCompany(); }
public void CreateCompany(Company Company) { companyRepository.Add(Company); SaveCompany(); }
public double GetTotalSalaryByCompany(Company Company) { return Company.GetSumSalaryEmployeesByDate(DateTime.Now, DateTime.Now); }