public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { BatchEditViewModel batchEditViewModel = new BatchEditViewModel(); batchEditViewModel.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken); batchEditViewModel.AuthList = GetAllAuthByProfileId(SessionHelper.CurrentUser.UserToken, model.ProfileId); batchEditViewModel.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, model.ProfileId); return(View(batchEditViewModel)); } if (model.SubmitType == "Add") { if (model.AuthWhichIsNotIncludeList != null) { List <AuthCheckViewModel> record = model.AuthWhichIsNotIncludeList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { ProfileDetail profileDetail = new ProfileDetail(); profileDetail.AuthId = item.Id; profileDetail.ProfileId = model.ProfileId; _profileDetailService.Add(SessionHelper.CurrentUser.UserToken, profileDetail); } } } } if (model.SubmitType == "Delete") { if (model.AuthList != null) { List <AuthCheckViewModel> record = model.AuthList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profileDetailService.DeleteByProfileIdAndAuthId(SessionHelper.CurrentUser.UserToken, model.ProfileId, item.Id); if (apiResponseModel.ResultStatusCode == ResultStatusCodeStatic.Success) { //not error } else { BatchEditViewModel batchEditViewModel = new BatchEditViewModel(); batchEditViewModel.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken); batchEditViewModel.AuthList = GetAllAuthByProfileId(SessionHelper.CurrentUser.UserToken, model.ProfileId); batchEditViewModel.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, model.ProfileId); ViewBag.ErrorMessage = apiResponseModel.ResultStatusMessage; return(View(batchEditViewModel)); } } } } } return(RedirectToAction(nameof(ProfileDetailController.BatchEdit), new { profileId = model.ProfileId })); }
public ActionResult BatchEdit() { BatchEditViewModel model = new BatchEditViewModel(); model.ProfileSelectList = GetProfileSelectList(); model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); return(View(model)); }
public ActionResult BatchEdit() { BatchEditViewModel model = new BatchEditViewModel(); model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar); model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); return(View(model)); }
public ActionResult BatchEdit() { BatchEditViewModel model = new BatchEditViewModel(); model.ProfileSelectList = GetProfileSelectList(); model.PersonnelList = new DefinedPersonnelListViewModel(); model.PersonnelList.Filter = new DefinedPersonnelListFilterViewModel(); model.PersonnelList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); model.PersonnelList.CurrentPage = 1; model.PersonnelList.PageSize = 10; model.PersonnelWhichIsNotIncludeList = new UndefinedPersonnelListViewModel(); model.PersonnelWhichIsNotIncludeList.Filter = new UndefinedPersonnelListFilterViewModel(); model.PersonnelWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); model.PersonnelWhichIsNotIncludeList.CurrentPage = 1; model.PersonnelWhichIsNotIncludeList.PageSize = 10; return(View(model)); }
public ActionResult BatchEdit() { BatchEditViewModel model = new BatchEditViewModel(); model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar); model.EmployeeList = new DefinedEmployeeListViewModel(); model.EmployeeList.Filter = new DefinedEmployeeListFilterViewModel(); model.EmployeeList.DataList = new Business.Models.PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""); model.EmployeeList.CurrentPage = 1; model.EmployeeList.PageSize = 10; model.EmployeeWhichIsNotIncludeList = new UndefinedEmployeeListViewModel(); model.EmployeeWhichIsNotIncludeList.Filter = new UndefinedEmployeeListFilterViewModel(); model.EmployeeWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""); model.EmployeeWhichIsNotIncludeList.CurrentPage = 1; model.EmployeeWhichIsNotIncludeList.PageSize = 10; return(View(model)); }
public ActionResult BatchEdit(int profileId = 0) { BatchEditViewModel model = new BatchEditViewModel(); if (profileId > 0) { var profile = _profileService.GetById(SessionHelper.CurrentUser.UserToken, profileId).Data; if (profile == null) { return(View("_ErrorNotExistProfile")); } model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken); model.AuthList = GetAllAuthByProfileId(SessionHelper.CurrentUser.UserToken, profileId); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, profileId); } else { model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken); model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { model.ProfileSelectList = GetProfileSelectList(); if (model.ProfileId.HasValue) { if (model.PersonnelList.Filter == null) { model.PersonnelList.Filter = new DefinedPersonnelListFilterViewModel(); } if (model.PersonnelWhichIsNotIncludeList.Filter == null) { model.PersonnelWhichIsNotIncludeList.Filter = new UndefinedPersonnelListFilterViewModel(); } if (!model.PersonnelList.CurrentPage.HasValue) { model.PersonnelList.CurrentPage = 1; } if (!model.PersonnelList.PageSize.HasValue) { model.PersonnelList.PageSize = 10; } if (!model.PersonnelWhichIsNotIncludeList.CurrentPage.HasValue) { model.PersonnelWhichIsNotIncludeList.CurrentPage = 1; } if (!model.PersonnelWhichIsNotIncludeList.PageSize.HasValue) { model.PersonnelWhichIsNotIncludeList.PageSize = 10; } model.PersonnelList.DataList = GetAllEmployeeByProfileId(model.ProfileId.Value, model.PersonnelList.Filter.Filter_Personnel_Name, model.PersonnelList.Filter.Filter_Personnel_LastName, model.PersonnelList.CurrentPage.Value, model.PersonnelList.PageSize.Value, model.PersonnelList.SortOn, model.PersonnelList.SortDirection); model.PersonnelWhichIsNotIncludeList.DataList = GetAllEmployeeByProfileIdWhichIsNotIncluded(model.ProfileId.Value, model.PersonnelWhichIsNotIncludeList.Filter.Filter_Personnel_Name, model.PersonnelWhichIsNotIncludeList.Filter.Filter_Personnel_LastName, model.PersonnelWhichIsNotIncludeList.CurrentPage.Value, model.PersonnelWhichIsNotIncludeList.PageSize.Value, model.PersonnelWhichIsNotIncludeList.SortOn, model.PersonnelWhichIsNotIncludeList.SortDirection); } else { model.PersonnelList = new DefinedPersonnelListViewModel(); model.PersonnelList.Filter = new DefinedPersonnelListFilterViewModel(); model.PersonnelList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); model.PersonnelList.CurrentPage = 1; model.PersonnelList.PageSize = 10; model.PersonnelWhichIsNotIncludeList = new UndefinedPersonnelListViewModel(); model.PersonnelWhichIsNotIncludeList.Filter = new UndefinedPersonnelListFilterViewModel(); model.PersonnelWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); model.PersonnelWhichIsNotIncludeList.CurrentPage = 1; model.PersonnelWhichIsNotIncludeList.PageSize = 10; } return(View(model)); } if (model.SubmitType == "Add") { if (model.PersonnelWhichIsNotIncludeList.DataList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <PersonnelCheckViewModel> records = model.PersonnelWhichIsNotIncludeList.DataList.Items.Where(x => x.Checked == true).ToList(); if (records != null) { foreach (var item in records) { AddRequestModel profilePersonnel = new AddRequestModel(); profilePersonnel.PersonnelId = item.Id; profilePersonnel.ProfileId = model.ProfileId.Value; _profilePersonnelService.Add(profilePersonnel); } } } } if (model.SubmitType == "Delete") { if (model.PersonnelList.DataList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <PersonnelCheckViewModel> record = model.PersonnelList.DataList.Items.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profilePersonnelService.Delete(model.ProfileId.Value, item.Id); } } } } model.ProfileSelectList = GetProfileSelectList(); if (model.ProfileId.HasValue) { if (model.PersonnelList.Filter == null) { model.PersonnelList.Filter = new DefinedPersonnelListFilterViewModel(); } if (model.PersonnelWhichIsNotIncludeList.Filter == null) { model.PersonnelWhichIsNotIncludeList.Filter = new UndefinedPersonnelListFilterViewModel(); } if (!model.PersonnelList.CurrentPage.HasValue) { model.PersonnelList.CurrentPage = 1; } if (!model.PersonnelList.PageSize.HasValue) { model.PersonnelList.PageSize = 10; } if (!model.PersonnelWhichIsNotIncludeList.CurrentPage.HasValue) { model.PersonnelWhichIsNotIncludeList.CurrentPage = 1; } if (!model.PersonnelWhichIsNotIncludeList.PageSize.HasValue) { model.PersonnelWhichIsNotIncludeList.PageSize = 10; } model.PersonnelList.DataList = GetAllEmployeeByProfileId(model.ProfileId.Value, model.PersonnelList.Filter.Filter_Personnel_Name, model.PersonnelList.Filter.Filter_Personnel_LastName, model.PersonnelList.CurrentPage.Value, model.PersonnelList.PageSize.Value, model.PersonnelList.SortOn, model.PersonnelList.SortDirection); model.PersonnelWhichIsNotIncludeList.DataList = GetAllEmployeeByProfileIdWhichIsNotIncluded(model.ProfileId.Value, model.PersonnelWhichIsNotIncludeList.Filter.Filter_Personnel_Name, model.PersonnelWhichIsNotIncludeList.Filter.Filter_Personnel_LastName, model.PersonnelWhichIsNotIncludeList.CurrentPage.Value, model.PersonnelWhichIsNotIncludeList.PageSize.Value, model.PersonnelWhichIsNotIncludeList.SortOn, model.PersonnelWhichIsNotIncludeList.SortDirection); if (model.PersonnelList.DataList == null || model.PersonnelList.DataList.Items == null) { model.PersonnelList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); } if (model.PersonnelWhichIsNotIncludeList.DataList == null || model.PersonnelWhichIsNotIncludeList.DataList.Items == null) { model.PersonnelWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); } } else { model.PersonnelList = new DefinedPersonnelListViewModel(); model.PersonnelList.Filter = new DefinedPersonnelListFilterViewModel(); model.PersonnelList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); model.PersonnelList.CurrentPage = 1; model.PersonnelList.PageSize = 10; model.PersonnelWhichIsNotIncludeList = new UndefinedPersonnelListViewModel(); model.PersonnelWhichIsNotIncludeList.Filter = new UndefinedPersonnelListFilterViewModel(); model.PersonnelWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <PersonnelCheckViewModel>(new List <PersonnelCheckViewModel>(), 0, 1, 10, "", ""); model.PersonnelWhichIsNotIncludeList.CurrentPage = 1; model.PersonnelWhichIsNotIncludeList.PageSize = 10; } return(View(model)); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { if (model.ProfileId.HasValue) { model.AuthList = GetAllAuthByProfileId(model.ProfileId.Value); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); } if (model.SubmitType == "Add") { if (model.AuthWhichIsNotIncludeList != null) { ModelState.Clear(); List <AuthCheckViewModel> record = model.AuthWhichIsNotIncludeList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { ProfileDetail profileDetail = new ProfileDetail(); profileDetail.AuthId = item.Id; profileDetail.ProfileId = model.ProfileId.Value; _profileDetailService.Add(profileDetail); } } } } if (model.SubmitType == "Delete") { if (model.AuthList != null) { ModelState.Clear(); List <AuthCheckViewModel> record = model.AuthList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var result = _profileDetailService.DeleteByProfileIdAndAuthId(model.ProfileId.Value, item.Id); if (result <= 0) { BatchEditViewModel batchEditViewModel = new BatchEditViewModel(); batchEditViewModel.ProfileSelectList = GetProfileSelectList(); batchEditViewModel.AuthList = GetAllAuthByProfileId(model.ProfileId.Value); batchEditViewModel.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(model.ProfileId.Value); ViewBag.ErrorMessage = "Error"; return(View(batchEditViewModel)); } } } } } model.ProfileSelectList = GetProfileSelectList(); if (model.ProfileId.HasValue) { model.AuthList = GetAllAuthByProfileId(model.ProfileId.Value); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { if (model.ProfileId.HasValue) { model.AuthList = GetAllAuthByProfileId(model.ProfileId.Value); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); } if (model.SubmitType == "Add") { if (model.AuthWhichIsNotIncludeList != null) { ModelState.Clear(); List <AuthCheckViewModel> record = model.AuthWhichIsNotIncludeList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { AddRequestModel profileDetail = new AddRequestModel(); profileDetail.AuthId = item.Id; profileDetail.ProfileId = model.ProfileId.Value; var result = _profileDetailService.Add(profileDetail).Result; } } } } if (model.SubmitType == "Delete") { if (model.AuthList != null) { ModelState.Clear(); List <AuthCheckViewModel> record = model.AuthList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profileDetailService.Delete(model.ProfileId.Value, item.Id).Result; if (apiResponseModel.Status == ResultStatusCodeStatic.Success) { //not error } else { BatchEditViewModel batchEditViewModel = new BatchEditViewModel(); batchEditViewModel.ProfileSelectList = GetProfileSelectList(); batchEditViewModel.AuthList = GetAllAuthByProfileId(model.ProfileId.Value); batchEditViewModel.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(model.ProfileId.Value); ViewBag.ErrorMessage = apiResponseModel.Message; return(View(batchEditViewModel)); } } } } } model.ProfileSelectList = GetProfileSelectList(); if (model.ProfileId.HasValue) { model.AuthList = GetAllAuthByProfileId(model.ProfileId.Value); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { if (model.ProfileId.HasValue) { model.AuthList = GetAllAuthByProfileId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value); } else { model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); } if (model.SubmitType == "Add") { if (model.AuthWhichIsNotIncludeList != null) { ModelState.Clear(); List <AuthCheckViewModel> record = model.AuthWhichIsNotIncludeList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { ProfileDetail profileDetail = new ProfileDetail(); profileDetail.AuthId = item.Id; profileDetail.ProfileId = model.ProfileId.Value; _profileDetailService.Add(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileDetail); } } } } if (model.SubmitType == "Delete") { if (model.AuthList != null) { ModelState.Clear(); List <AuthCheckViewModel> record = model.AuthList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profileDetailService.DeleteByProfileIdAndAuthId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value, item.Id); if (apiResponseModel.ResultStatusCode == ResultStatusCodeStatic.Success) { //not error } else { BatchEditViewModel batchEditViewModel = new BatchEditViewModel(); batchEditViewModel.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar); batchEditViewModel.AuthList = GetAllAuthByProfileId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value); batchEditViewModel.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value); ViewBag.ErrorMessage = apiResponseModel.ResultStatusMessage; ViewBag.ErrorMessageList = apiResponseModel.ErrorMessageList; return(View(batchEditViewModel)); } } } } } model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar); if (model.ProfileId.HasValue) { model.AuthList = GetAllAuthByProfileId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value); model.AuthWhichIsNotIncludeList = GetAllAuthByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value); } else { model.AuthList = new List <AuthCheckViewModel>(); model.AuthWhichIsNotIncludeList = new List <AuthCheckViewModel>(); } return(View(model)); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { if (model.ProfileId.HasValue) { model.MemberList = GetAllMemberByProfileId(model.ProfileId.Value); model.MemberWhichIsNotIncludeList = GetAllMemberByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.MemberList = new List <MemberCheckViewModel>(); model.MemberWhichIsNotIncludeList = new List <MemberCheckViewModel>(); } return(View(model)); } if (model.SubmitType == "Add") { if (model.MemberWhichIsNotIncludeList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <MemberCheckViewModel> records = model.MemberWhichIsNotIncludeList.Where(x => x.Checked == true).ToList(); if (records != null) { foreach (var item in records) { ProfileMember profileMember = new ProfileMember(); profileMember.MemberId = item.ID; profileMember.ProfileId = model.ProfileId.Value; _profileMemberService.Add(profileMember); } } } } if (model.SubmitType == "Delete") { if (model.MemberList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <MemberCheckViewModel> record = model.MemberList.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profileMemberService.DeleteByProfileIdAndEmployeeId(model.ProfileId.Value, item.ID); } } } } model.ProfileSelectList = GetProfileSelectList(); if (model.ProfileId.HasValue) { model.MemberList = GetAllMemberByProfileId(model.ProfileId.Value); model.MemberWhichIsNotIncludeList = GetAllMemberByProfileIdWhichIsNotIncluded(model.ProfileId.Value); } else { model.MemberList = new List <MemberCheckViewModel>(); model.MemberWhichIsNotIncludeList = new List <MemberCheckViewModel>(); } return(View(model)); }
public ActionResult BatchEdit(BatchEditViewModel model) { if (!ModelState.IsValid) { model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar); if (model.ProfileId.HasValue) { if (model.EmployeeList.Filter == null) { model.EmployeeList.Filter = new DefinedEmployeeListFilterViewModel(); } if (model.EmployeeWhichIsNotIncludeList.Filter == null) { model.EmployeeWhichIsNotIncludeList.Filter = new UndefinedEmployeeListFilterViewModel(); } if (!model.EmployeeList.CurrentPage.HasValue) { model.EmployeeList.CurrentPage = 1; } if (!model.EmployeeList.PageSize.HasValue) { model.EmployeeList.PageSize = 10; } if (!model.EmployeeWhichIsNotIncludeList.CurrentPage.HasValue) { model.EmployeeWhichIsNotIncludeList.CurrentPage = 1; } if (!model.EmployeeWhichIsNotIncludeList.PageSize.HasValue) { model.EmployeeWhichIsNotIncludeList.PageSize = 10; } ProfileEmployeeSearchFilter profileEmployeeSearchFilter = new ProfileEmployeeSearchFilter(); profileEmployeeSearchFilter.Filter_ProfileId = model.ProfileId.Value; profileEmployeeSearchFilter.CurrentPage = model.EmployeeList.CurrentPage.HasValue ? model.EmployeeList.CurrentPage.Value : 1; profileEmployeeSearchFilter.PageSize = model.EmployeeList.PageSize.HasValue ? model.EmployeeList.PageSize.Value : 10; profileEmployeeSearchFilter.SortOn = model.EmployeeList.SortOn; profileEmployeeSearchFilter.SortDirection = model.EmployeeList.SortDirection; profileEmployeeSearchFilter.Filter_Employee_Name = model.EmployeeList.Filter.Filter_Employee_Name; profileEmployeeSearchFilter.Filter_Employee_LastName = model.EmployeeList.Filter.Filter_Employee_LastName; ProfileEmployeeSearchFilter profileEmployeeWhichIsNotIncludeListSearchFilter = new ProfileEmployeeSearchFilter(); profileEmployeeWhichIsNotIncludeListSearchFilter.Filter_ProfileId = model.ProfileId.Value; profileEmployeeWhichIsNotIncludeListSearchFilter.CurrentPage = model.EmployeeWhichIsNotIncludeList.CurrentPage.HasValue ? model.EmployeeWhichIsNotIncludeList.CurrentPage.Value : 1; profileEmployeeWhichIsNotIncludeListSearchFilter.PageSize = model.EmployeeWhichIsNotIncludeList.PageSize.HasValue ? model.EmployeeWhichIsNotIncludeList.PageSize.Value : 10; profileEmployeeWhichIsNotIncludeListSearchFilter.SortOn = model.EmployeeWhichIsNotIncludeList.SortOn; profileEmployeeWhichIsNotIncludeListSearchFilter.SortDirection = model.EmployeeWhichIsNotIncludeList.SortDirection; profileEmployeeWhichIsNotIncludeListSearchFilter.Filter_Employee_Name = model.EmployeeWhichIsNotIncludeList.Filter.Filter_Employee_Name; profileEmployeeWhichIsNotIncludeListSearchFilter.Filter_Employee_LastName = model.EmployeeWhichIsNotIncludeList.Filter.Filter_Employee_LastName; model.EmployeeList.DataList = GetAllEmployeeByProfileId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileEmployeeSearchFilter); model.EmployeeWhichIsNotIncludeList.DataList = GetAllEmployeeByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileEmployeeWhichIsNotIncludeListSearchFilter); } else { model.EmployeeList = new DefinedEmployeeListViewModel(); model.EmployeeList.Filter = new DefinedEmployeeListFilterViewModel(); model.EmployeeList.DataList = new Business.Models.PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""); model.EmployeeList.CurrentPage = 1; model.EmployeeList.PageSize = 10; model.EmployeeWhichIsNotIncludeList = new UndefinedEmployeeListViewModel(); model.EmployeeWhichIsNotIncludeList.Filter = new UndefinedEmployeeListFilterViewModel(); model.EmployeeWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""); model.EmployeeWhichIsNotIncludeList.CurrentPage = 1; model.EmployeeWhichIsNotIncludeList.PageSize = 10; } return(View(model)); } if (model.SubmitType == "Add") { if (model.EmployeeWhichIsNotIncludeList.DataList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <EmployeeCheckViewModel> records = model.EmployeeWhichIsNotIncludeList.DataList.Items.Where(x => x.Checked == true).ToList(); if (records != null) { foreach (var item in records) { ProfileEmployee profileEmployee = new ProfileEmployee(); profileEmployee.EmployeeId = item.ID; profileEmployee.ProfileId = model.ProfileId.Value; _profileEmployeeService.Add(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileEmployee); } } } } if (model.SubmitType == "Delete") { if (model.EmployeeList.DataList != null && model.ProfileId.HasValue) { ModelState.Clear(); List <EmployeeCheckViewModel> record = model.EmployeeList.DataList.Items.Where(x => x.Checked == true).ToList(); if (record != null) { foreach (var item in record) { var apiResponseModel = _profileEmployeeService.DeleteByProfileIdAndEmployeeId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, model.ProfileId.Value, item.ID); } } } } model.ProfileSelectList = GetProfileSelectList(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar); if (model.ProfileId.HasValue) { if (model.EmployeeList.Filter == null) { model.EmployeeList.Filter = new DefinedEmployeeListFilterViewModel(); } if (model.EmployeeWhichIsNotIncludeList.Filter == null) { model.EmployeeWhichIsNotIncludeList.Filter = new UndefinedEmployeeListFilterViewModel(); } if (!model.EmployeeList.CurrentPage.HasValue) { model.EmployeeList.CurrentPage = 1; } if (!model.EmployeeList.PageSize.HasValue) { model.EmployeeList.PageSize = 10; } if (!model.EmployeeWhichIsNotIncludeList.CurrentPage.HasValue) { model.EmployeeWhichIsNotIncludeList.CurrentPage = 1; } if (!model.EmployeeWhichIsNotIncludeList.PageSize.HasValue) { model.EmployeeWhichIsNotIncludeList.PageSize = 10; } ProfileEmployeeSearchFilter profileEmployeeSearchFilter = new ProfileEmployeeSearchFilter(); profileEmployeeSearchFilter.Filter_ProfileId = model.ProfileId.Value; profileEmployeeSearchFilter.CurrentPage = model.EmployeeList.CurrentPage.HasValue ? model.EmployeeList.CurrentPage.Value : 1; profileEmployeeSearchFilter.PageSize = model.EmployeeList.PageSize.HasValue ? model.EmployeeList.PageSize.Value : 10; profileEmployeeSearchFilter.SortOn = model.EmployeeList.SortOn; profileEmployeeSearchFilter.SortDirection = model.EmployeeList.SortDirection; profileEmployeeSearchFilter.Filter_Employee_Name = model.EmployeeList.Filter.Filter_Employee_Name; profileEmployeeSearchFilter.Filter_Employee_LastName = model.EmployeeList.Filter.Filter_Employee_LastName; ProfileEmployeeSearchFilter profileEmployeeWhichIsNotIncludeListSearchFilter = new ProfileEmployeeSearchFilter(); profileEmployeeWhichIsNotIncludeListSearchFilter.Filter_ProfileId = model.ProfileId.Value; profileEmployeeWhichIsNotIncludeListSearchFilter.CurrentPage = model.EmployeeWhichIsNotIncludeList.CurrentPage.HasValue ? model.EmployeeWhichIsNotIncludeList.CurrentPage.Value : 1; profileEmployeeWhichIsNotIncludeListSearchFilter.PageSize = model.EmployeeWhichIsNotIncludeList.PageSize.HasValue ? model.EmployeeWhichIsNotIncludeList.PageSize.Value : 10; profileEmployeeWhichIsNotIncludeListSearchFilter.SortOn = model.EmployeeWhichIsNotIncludeList.SortOn; profileEmployeeWhichIsNotIncludeListSearchFilter.SortDirection = model.EmployeeWhichIsNotIncludeList.SortDirection; profileEmployeeWhichIsNotIncludeListSearchFilter.Filter_Employee_Name = model.EmployeeWhichIsNotIncludeList.Filter.Filter_Employee_Name; profileEmployeeWhichIsNotIncludeListSearchFilter.Filter_Employee_LastName = model.EmployeeWhichIsNotIncludeList.Filter.Filter_Employee_LastName; model.EmployeeList.DataList = GetAllEmployeeByProfileId(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileEmployeeSearchFilter); model.EmployeeWhichIsNotIncludeList.DataList = GetAllEmployeeByProfileIdWhichIsNotIncluded(SessionHelper.CurrentUser.UserToken, SessionHelper.CurrentLanguageTwoChar, profileEmployeeWhichIsNotIncludeListSearchFilter); } else { model.EmployeeList = new DefinedEmployeeListViewModel(); model.EmployeeList.Filter = new DefinedEmployeeListFilterViewModel(); model.EmployeeList.DataList = new Business.Models.PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""); model.EmployeeList.CurrentPage = 1; model.EmployeeList.PageSize = 10; model.EmployeeWhichIsNotIncludeList = new UndefinedEmployeeListViewModel(); model.EmployeeWhichIsNotIncludeList.Filter = new UndefinedEmployeeListFilterViewModel(); model.EmployeeWhichIsNotIncludeList.DataList = new Business.Models.PaginatedList <EmployeeCheckViewModel>(new List <EmployeeCheckViewModel>(), 0, 1, 10, "", ""); model.EmployeeWhichIsNotIncludeList.CurrentPage = 1; model.EmployeeWhichIsNotIncludeList.PageSize = 10; } return(View(model)); }