private void SearchCompanyEmployees(CompanyEmployeeSearchViewModel model) { using (UnitOfWorkManager.NewUnitOfWork()) { LoadPostStatus(model); var healthStatus = _categoryService.GetByParentName("HealthStatus"); LoadHealthStatus(model, healthStatus); var adverseFactors = _companyEmployeeService.GetAdverseFactors(); LoadAdverseFator(model, _companyEmployeeService.GetAdverseFactors()); IList <string> departments = _companyEmployeeService.GetDepartments(); IList <string> workTypes = _companyEmployeeService.GetWorkTypes(WorkContext.CurrentMembershipUser.Company.Id); LoadDepartments(model, departments); LoadWorkTypes(model, workTypes); var searchModel = new CompanyEmployeeSearchModel { PageIndex = model.PageIndex, KeyWords = string.IsNullOrEmpty(model.KeyWords) ? "" : model.KeyWords, SelectedAdverseFactor = model.SelectedAdverseFactor, SelectedHealthStatus = model.SelectedHealthStatus, SelectedPostStatus = model.SelectedPostStatus, SeletedWorkType = model.SelectedWorkType, SelectedDepartment = model.SelectedDepartment, CompanyId = WorkContext.CurrentMembershipUser.Company.Id, PageSize = int.MaxValue }; model.Employees = _companyEmployeeService.Search(searchModel); } }
public ActionResult SelectEmployeeModal() { var model = new CompanyEmployeeSearchViewModel(); SearchCompanyEmployees(model); return(PartialView(model)); }
// GET: EmployeeManage public ActionResult Index() { var model = new CompanyEmployeeSearchViewModel(); SearchCompanyEmployees(model); return(View(model)); }
private void LoadPostStatus(CompanyEmployeeSearchViewModel model) { model.PostStatusList.Add(new SelectListItem { Text = "所有", Value = string.Empty }); model.PostStatusList.Add(new SelectListItem { Text = "在职", Value = ((int)CompanyEmployeePostStatus.Stay).ToString() }); model.PostStatusList.Add(new SelectListItem { Text = "离职", Value = ((int)CompanyEmployeePostStatus.Leave).ToString() }); }
private void LoadHealthStatus(CompanyEmployeeSearchViewModel model, IList <Category> healthStatus) { model.HealthStatusList.Add(new SelectListItem { Text = "所有", Value = string.Empty }); foreach (var item in healthStatus) { model.HealthStatusList.Add(new SelectListItem { Text = item.Name, Value = item.Id.ToString() }); } }
private void LoadAdverseFator(CompanyEmployeeSearchViewModel model, IList <string> list) { foreach (var item in list) { if (item == string.Empty) { model.AdverseFactorList.Add("NULL"); } else { model.AdverseFactorList.Add(item); } } }
private void LoadDepartments(CompanyEmployeeSearchViewModel model, IList <string> departments) { foreach (var item in departments) { if (item == string.Empty) { model.DepartmentList.Add("NULL"); } else { model.DepartmentList.Add(item); } } }
private void LoadWorkTypes(CompanyEmployeeSearchViewModel model, IList <string> workTypes) { foreach (var item in workTypes) { if (item == string.Empty) { model.WorkTypeList.Add("NULL"); } else { model.WorkTypeList.Add(item); } } }
public ActionResult SelectEmployeeModal(CompanyEmployeeSearchViewModel model) { SearchCompanyEmployees(model); return(PartialView(model)); }
public ActionResult Index(CompanyEmployeeSearchViewModel model) { SearchCompanyEmployees(model); return(View(model)); }