public RoleSerListResult GetListWithPaging(WCFAuthInfoVM entity_WCFAuthInfoVM, LUserRoleVM entity_SearchCriteria, int int_CurrentPage, int int_PageSize, string str_SortColumn, string str_SortDir, List <string> str_CustomFilter) { try { //Restore Server Session RetrieveServerSideSession(entity_WCFAuthInfoVM); bool ret_CheckPrivilege = false; List <string> strList_Error = new List <string>(); RoleSerListResult returnResult = new RoleSerListResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); UserRoleRespository entityRepos_Role = new UserRoleRespository(dbContext, entity_BaseSession.ID); #region [ Check Privilege ] ret_CheckPrivilege = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); #endregion returnResult.StrList_Error = strList_Error; returnResult.Int_TotalRecordCount = 0; returnResult.EntityList_LUserRoleVM = new List <LUserRoleVM>(); if (ret_CheckPrivilege) { int recordCount = 0; List <LUserRoleVM> vmList = entityRepos_Role.GetEntityListByPage(entity_SearchCriteria, int_CurrentPage, int_PageSize, str_SortColumn, str_SortDir, out recordCount, str_CustomFilter); returnResult.EntityList_LUserRoleVM = vmList; returnResult.Int_TotalRecordCount = recordCount; } return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public RoleSerListResult GetListWithPaging(WCFAuthInfoVM entity_WCFAuthInfoVM, LUserRoleVM entity_SearchCriteria, int int_CurrentPage, int int_PageSize, string str_SortColumn, string str_SortDir, List <string> str_CustomFilter) { try { //Restore Server Session RetrieveServerSideSession(entity_WCFAuthInfoVM); bool ret_CheckPrivilege = false; List <string> strList_Error = new List <string>(); RoleSerListResult returnResult = new RoleSerListResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); UserRoleRespository entityRepos_Role = new UserRoleRespository(dbContext, entity_BaseSession.ID); #region [ Check Privilege ] ret_CheckPrivilege = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); #endregion bool allowEdit = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Edit", "", null); bool allowDel = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Delete", "", null); returnResult.StrList_Error = strList_Error; returnResult.Int_TotalRecordCount = 0; returnResult.EntityList_LUserRoleVM = new List <LUserRoleVM>(); if (ret_CheckPrivilege) { int recordCount = 0; if (entity_SearchCriteria == null) { entity_SearchCriteria = new LUserRoleVM(); } if (!string.IsNullOrWhiteSpace(entity_SearchCriteria.RoleName) && str_CustomFilter.Count == 0) { str_CustomFilter.Add(String.Format("{0}.StartsWith(\"{1}\")", "UR_Name", entity_SearchCriteria.RoleName)); } List <LUserRoleVM> vmList = entityRepos_Role.GetEntityListByPage(entity_SearchCriteria, int_CurrentPage, int_PageSize, str_SortColumn, str_SortDir, out recordCount, str_CustomFilter, null, null, (entityList_VM) => { foreach (var item in entityList_VM) { item.AllowDel = allowDel; item.AllowEdit = allowEdit; } return(entityList_VM); }); returnResult.EntityList_LUserRoleVM = vmList; returnResult.Int_TotalRecordCount = recordCount; } return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }