public ActionResult GroupServiceRequestList(SrSearchFilter searchFilter) { try { Logger.Info(_logMsg.Clear().SetPrefixMsg("Get GroupServiceRequestList").Add("UserId", this.UserInfo.UserId).ToInputLogString()); _userFacade = new UserFacade(); _commonFacade = new CommonFacade(); _customerFacade = new CustomerFacade(); HomeViewModel homeVM = new HomeViewModel(); homeVM.GroupSrSearchFilter = searchFilter; var lstDummyUser = _userFacade.GetDummyUsers(this.UserInfo); homeVM.GroupSrSearchFilter.OwnerList = lstDummyUser; homeVM.GroupServiceRequestList = _customerFacade.GetSrList(homeVM.GroupSrSearchFilter); ViewBag.GroupPageSize = homeVM.GroupSrSearchFilter.PageSize; ViewBag.GroupPageSizeList = _commonFacade.GetPageSizeList(); Logger.Info(_logMsg.Clear().SetPrefixMsg("Get GroupServiceRequestList").ToSuccessLogString()); return(PartialView("~/Views/Home/_GroupServiceRequestList.cshtml", homeVM)); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("Get GroupServiceRequestList").Add("Error Message", ex.Message).ToFailLogString()); return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString()))); } }
public ActionResult CustomerSrList(SrSearchFilter searchFilter) { Logger.Info(_logMsg.Clear().SetPrefixMsg("Search SR").Add("CustomerId", searchFilter.CustomerId) .ToInputLogString()); try { if (ModelState.IsValid) { //ViewBag.userId = this.UserInfo.UserId; _commonFacade = new CommonFacade(); _customerFacade = new CustomerFacade(); _userFacade = new UserFacade(); SrViewModel srVM = new SrViewModel(); if (searchFilter.CurrentUserId != UserInfo.UserId) { // First Load OR Change User searchFilter.CurrentUserId = UserInfo.UserId; searchFilter.CanViewAllUsers = null; searchFilter.CanViewUserIds = string.Empty; searchFilter.CanViewSrPageIds = string.Empty; } if (searchFilter.CurrentUserRoleCode != UserInfo.RoleCode) { // First Load OR Change Role searchFilter.CurrentUserRoleCode = UserInfo.RoleCode; } srVM.SearchFilter = searchFilter; srVM.SrList = _customerFacade.GetSrList(srVM.SearchFilter); ViewBag.PageSize = srVM.SearchFilter.PageSize; ViewBag.PageSizeList = _commonFacade.GetPageSizeList(); // Set ViewBag.OwnerList var lstEmployeeUser = _userFacade.GetEmployees(this.UserInfo); lstEmployeeUser.Add(this.UserInfo); // add current user ViewBag.OwnerList = lstEmployeeUser.Select(x => x.UserId).ToList(); // for enabled btnEdit Logger.Info(_logMsg.Clear().SetPrefixMsg("CustomerSrList").ToSuccessLogString()); return(PartialView("~/Views/SR/_CustomerSrList.cshtml", srVM)); } return(Json(new { Valid = false, Error = string.Empty, Errors = GetModelValidationErrors() })); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("Search SR").Add("Error Message", ex.Message).ToFailLogString()); return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString()))); } }
public ActionResult IndividualServiceRequestList(SrSearchFilter searchFilter) { try { Logger.Info(_logMsg.Clear().SetPrefixMsg("Get IndividualServiceRequestList").Add("UserId", this.UserInfo.UserId) .ToInputLogString()); _commonFacade = new CommonFacade(); _customerFacade = new CustomerFacade(); var lstEmployeeUser = new List <UserEntity>(); // กรณีเลือก ทั้งหมด FilterType จะมีค่าเป็น null if (searchFilter.FilterType == null) { _userFacade = new UserFacade(); lstEmployeeUser = _userFacade.GetEmployees(this.UserInfo); } lstEmployeeUser.Add(this.UserInfo); // add current user if (searchFilter.CurrentUserId != UserInfo.UserId) { // First Load OR Change User searchFilter.CurrentUserId = UserInfo.UserId; searchFilter.CanViewAllUsers = null; searchFilter.CanViewUserIds = string.Empty; searchFilter.CanViewSrPageIds = string.Empty; } if (searchFilter.CurrentUserRoleCode != UserInfo.RoleCode) { // First Load OR Change Role searchFilter.CurrentUserRoleCode = UserInfo.RoleCode; } HomeViewModel homeVM = new HomeViewModel(); homeVM.IndividualSrSearchFilter = searchFilter; homeVM.IndividualSrSearchFilter.OwnerList = lstEmployeeUser; homeVM.IndividualServiceRequestList = _customerFacade.GetSrList(homeVM.IndividualSrSearchFilter); ViewBag.IndyPageSize = homeVM.IndividualSrSearchFilter.PageSize; ViewBag.IndyPageSizeList = _commonFacade.GetPageSizeList(); Logger.Info(_logMsg.Clear().SetPrefixMsg("Get IndividualServiceRequestList").ToSuccessLogString()); return(PartialView("~/Views/Home/_IndividualServiceRequestList.cshtml", homeVM)); } catch (Exception ex) { Logger.Error("Exception occur:\n", ex); Logger.Info(_logMsg.Clear().SetPrefixMsg("Get IndividualServiceRequestList").Add("Error Message", ex.Message).ToFailLogString()); return(Error(new HandleErrorInfo(ex, this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString()))); } }