public LUSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_LUID) { try { //Restore Server Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); LUSerEditResult returnResult = new LUSerEditResult(); WCFSesssionPolicy wcfPolicy = new WCFSesssionPolicy(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LoginUserRespository loginUserRespo = new LoginUserRespository(dbContext, null); LoginUserVM db_LoginUserVM = loginUserRespo.GetEntityByID(Guid.Parse(str_LUID), languageKey, ref strList_Error); returnResult.StrList_Error = strList_Error; returnResult.Entity_LoginUserVM = db_LoginUserVM; return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <string> GetOrgPathListByLUID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_UserID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_OrgPath_CheckUser = new List <string>(); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext => { strList_OrgPath_CheckUser = CoolUtilities.CoolLinqUtility.InnerJoin( dbContext.LUserAccessByOrgs.AsNoTracking().Where(current => current.UA_User_ID.ToString() == str_UserID).ToList(), dbContext.LUserOrganizations.AsNoTracking().ToList(), (left, right) => left.UA_Org_ID == right.ID, (left, right) => right).Select(current => current.LUO_Path).ToList(); }); } return(strList_OrgPath_CheckUser); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <FunctionVM> GetParentFunctions(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunKey) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <FunctionVM> entityList_Fun = new List <FunctionVM>(); if (entity_BaseSession != null) { //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionRespository Respo_F = new FunctionRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { entityList_Fun = Respo_F.GetParents(str_FunKey); } } return(entityList_Fun); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public WCFReturnResult Update(WCFAuthInfoVM entity_WCFAuthInfoVM, LUserOrgDetailsVM entity_OrgDetailsVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); OrgDRespository Respo_OrgD = new OrgDRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { ret = Respo_OrgD.Update(entity_OrgDetailsVM, languageKey, ref strList_Error); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public List <LUserRoleVM> GetEntityListByIDList(WCFAuthInfoVM entity_WCFAuthInfoVM, List <string> strList_RoleID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); bool ret_CheckPrivilege = false; List <LUserRoleVM> ret = new List <LUserRoleVM>(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); UserRoleRespository entityRepos_Role = new UserRoleRespository(dbContext, entity_BaseSession.ID); ret_CheckPrivilege = CheckTokenOnly(entity_BaseSession, ref strList_Error); List <LUserRoleVM> entityList_RoleVM = new List <LUserRoleVM>(); if (ret_CheckPrivilege) { entityList_RoleVM = (List <LUserRoleVM>)entityRepos_Role.GetLURoleVMList_ByIDList(strList_RoleID); } return(entityList_RoleVM); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public WCFReturnResult Delete(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FTID) { try { RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionTypeRespository Respo_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { ret = Respo_FT.Delete(str_FTID, languageKey, ref strList_Error); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <FunctionTypeVM> GetAllFunType(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <FunctionTypeVM> returnResult = new List <FunctionTypeVM>(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionTypeRespository Respo_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { returnResult = Respo_FT.GetAllFunctionType(); } return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public WCFReturnResult ResetPwd(WCFAuthInfoVM entity_WCFAuthInfoVM, LoginUserVM entity_LUVM) { try { //Restore Server Session WCFReturnResult returnResult = new WCFReturnResult(); WCFSesssionPolicy wcfPolicy = new WCFSesssionPolicy(); BaseSession entity_BaseSession = wcfPolicy.RestoreWCFSesssion(entity_WCFAuthInfoVM); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LoginUserRespository loginUserRespo = new LoginUserRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); var ret = loginUserRespo.ResetPwd(entity_LUVM, languageKey, ref strList_Error); returnResult.IsSuccess = ret; if (strList_Error.Count > 0) { foreach (var item in strList_Error) { returnResult.StrList_Error.Add(item); } } return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <LUserOrganizationVM> GetAll(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LUserOrganizationRespository orgRespo = new LUserOrganizationRespository(dbContext, entity_BaseSession.ID); List <LUserOrganizationVM> entityList_OrgVM = new List <LUserOrganizationVM>(); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { entityList_OrgVM = orgRespo.GetLUOrgVM_All(); } return(entityList_OrgVM); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public SessionWUserInfo getAuthorizedInfoByUserID(Guid guid_UserID) { CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LoginUserRespository Respo_LU = new LoginUserRespository(dbContext, guid_UserID); SessionWUserInfo entity_SessionWUserInfo = Respo_LU.GetLoginUserAccRight(guid_UserID); return(entity_SessionWUserInfo); }
public List <Guid> GetLUIDList(WCFAuthInfoVM entity_WCFAuthInfoVM, List <string> strList_OrgPath) { List <Guid> lUserList = new List <Guid>(); try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); bool ret = false; List <string> strList_Error = new List <string>(); ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { if (strList_OrgPath.Count() == 0) { DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext => { lUserList = dbContext.LUsers.Select(current => current.ID).ToList(); }); } else { DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext => { //Filter Under Organization List <LUserOrganization> entityList_LUserOrganization = dbContext.LUserOrganizations.AsNoTracking().Where(current => strList_OrgPath.Where(current1 => current.LUO_Path.IndexOf(current1) == 0 && current.LUO_Path != current1).Count() > 0).ToList(); List <Guid> guidList_OrgID = entityList_LUserOrganization.Select(current => current.ID).ToList(); var entityList_LUserAccessByOrgs = dbContext.LUserAccessByOrgs.AsNoTracking().ToList().Where(current => guidList_OrgID.Contains(current.UA_Org_ID)); List <Guid> guidList = CoolUtilities.CoolLinqUtility.InnerJoin(entityList_LUserAccessByOrgs, dbContext.LUsers.AsNoTracking().ToList(), (left, right) => left.UA_User_ID == right.ID, (left, right) => right.ID ).ToList(); //Add Current User guidList.Add(entity_BaseSession.ID); if (guidList.Count > 0) { lUserList = guidList; } }); } } } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } return(lUserList); }
public List <FunctionVM> GetAll(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); if (entity_BaseSession != null) { CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionRespository funRespo = new FunctionRespository(dbContext, entity_BaseSession.ID); List <FunctionVM> entityList_OrgVM = new List <FunctionVM>(); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { IPrivilegeFun entity_IPrivilegeFun = WCFBootstrapper.Container.GetExportedValue <IPrivilegeFun>(); SessionWUserInfo entity_SessionWUserInfo = entity_IPrivilegeFun.getAuthorizedInfoByUserID(entity_BaseSession.ID); entity_BaseSession = entity_SessionWUserInfo; bool allowEdit = entity_BaseSession.CheckAccessRight("FManage", "Edit", "", null); bool allowDel = entity_BaseSession.CheckAccessRight("FManage", "Delete", "", null); entityList_OrgVM = funRespo.GetFuns_All(); entityList_OrgVM.ForEach(current => { current.FunctionName = MultilingualHelper.GetStringFromResource(languageKey, current.FunctionKey); current.AllowDel = allowDel; current.AllowEdit = allowEdit; }); } return(entityList_OrgVM); } return(new List <FunctionVM>()); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public ODSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_OrgDetailsID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); ODSerEditResult returnResult = new ODSerEditResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); OrgDRespository Respo_OD = new OrgDRespository(dbContext, entity_BaseSession.ID); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); bool allowEdit = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Edit", "", null); bool allowDel = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Delete", "", null); if (ret) { Guid guid_OrgDID = default(Guid); if (Guid.TryParse(str_OrgDetailsID, out guid_OrgDID)) { LUserOrgDetailsVM entity_LUserOrgDetailsVM = Respo_OD.GetEntityByID(guid_OrgDID, languageKey, ref strList_Error); entity_LUserOrgDetailsVM.AllowEdit = allowEdit; entity_LUserOrgDetailsVM.AllowDel = allowDel; returnResult.Entity_LUserOrgDetailsVM = entity_LUserOrgDetailsVM; } else { ret = false; string str_Message = MultilingualHelper.GetStringFromResource(languageKey, "E012"); strList_Error.Add(string.Format(str_Message, "ID")); } } returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public IList <string> GetOrgPathListBy(Guid guid_UserID) { IList <string> strList_OrgPath_CheckUser = new List <string>(); DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext => { strList_OrgPath_CheckUser = CoolUtilities.CoolLinqUtility.InnerJoin( dbContext.LUserAccessByOrgs.AsNoTracking().Where(current => current.UA_User_ID == guid_UserID).ToList(), dbContext.LUserOrganizations.AsNoTracking().ToList(), (left, right) => left.UA_Org_ID == right.ID, (left, right) => right).Select(current => current.LUO_Path).ToList(); }); return(strList_OrgPath_CheckUser); }
public FSerMenusResult GetMenuByAuthInfo(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); bool ret_CheckPrivilege = false; CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FSerMenusResult ret = new FSerMenusResult(); ret_CheckPrivilege = CheckTokenOnly(entity_BaseSession, ref strList_Error); ret.StrList_Error = strList_Error; if (ret_CheckPrivilege) { FunctionRespository funRespo = new FunctionRespository(dbContext, entity_BaseSession.ID); List <FunctionVM> entityList_FunVM = funRespo.GetFuns_All(); LoginUserRespository loginUserRespo = new LoginUserRespository(dbContext, null); SessionWUserInfo entity_SessionWUserInfo = loginUserRespo.GetLoginUserAccRight(entity_BaseSession.ID); List <Guid> entityList_FId = entity_SessionWUserInfo.EntityList_FDInfo.Select(current => current.FID).ToList(); List <MenuItem> entityList_MenuItem = funRespo.GetMenuItems(entityList_FunVM, entityList_FId, languageKey); List <MenuItem> outputMenu = new List <MenuItem>(); if (entityList_MenuItem.Count > 0) { outputMenu = funRespo.ConverToHierarchyFormat(entityList_MenuItem); } ret.Json_MenuItems = outputMenu; } return(ret); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public FTSerListResult GetListWithPaging(WCFAuthInfoVM entity_WCFAuthInfoVM, FunctionTypeVM entity_SearchCriteria, int int_CurrentPage, int int_PageSize, string str_SortColumn, string str_SortDir, List <string> str_CustomFilter) { try { //Restore Server Session by token RetrieveServerSideSession(entity_WCFAuthInfoVM); //Flag Success or Fail bool ret = false; //Define error list List <string> strList_Error = new List <string>(); //Instantiate FTSerListResult FTSerListResult returnResult = new FTSerListResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionTypeRespository entityRepos_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID); #region [ Check Privilege ] ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); #endregion //Initialize FTSerListResult instance returnResult.StrList_Error = strList_Error; returnResult.Int_TotalRecordCount = 0; returnResult.EntityList_FunctionTypeVM = new List <FunctionTypeVM>(); //Success if (ret) { int recordCount = 0; List <FunctionTypeVM> vmList = entityRepos_FT.GetEntityListByPage(entity_SearchCriteria, int_CurrentPage, int_PageSize, str_SortColumn, str_SortDir, out recordCount, str_CustomFilter); //Assign data to FTSerListResult instance returnResult.EntityList_FunctionTypeVM = vmList; returnResult.Int_TotalRecordCount = recordCount; } return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public OrgSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_OrgID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); OrgSerEditResult returnResult = new OrgSerEditResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LUserOrganizationRespository Respo_Org = new LUserOrganizationRespository(dbContext, entity_BaseSession.ID); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { Guid guid_OrgDID = default(Guid); if (Guid.TryParse(str_OrgID, out guid_OrgDID)) { LUserOrganizationVM db_OrgVM = Respo_Org.GetEntityByID(guid_OrgDID, languageKey, ref strList_Error); returnResult.Entity_LUserOrganizationVM = db_OrgVM; } else { ret = false; string str_Message = MultilingualHelper.GetStringFromResource(languageKey, "E012"); strList_Error.Add(string.Format(str_Message, "ID")); } } returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public WCFReturnResult Delete(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_RoleID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); UserRoleRespository entityRepos_Role = new UserRoleRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { Guid guid_RoleID = default(Guid); if (Guid.TryParse(str_RoleID, out guid_RoleID)) { ret = entityRepos_Role.Delete(guid_RoleID, languageKey, ref strList_Error); } else { ret = false; string str_Message = MultilingualHelper.GetStringFromResource(languageKey, "E012"); strList_Error.Add(string.Format(str_Message, "ID")); } } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public List <FunctionTypeVM> GetAllFunType(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <FunctionTypeVM> returnResult = new List <FunctionTypeVM>(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionTypeRespository Respo_FT = new FunctionTypeRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { IPrivilegeFun entity_IPrivilegeFun = WCFBootstrapper.Container.GetExportedValue <IPrivilegeFun>(); SessionWUserInfo entity_SessionWUserInfo = entity_IPrivilegeFun.getAuthorizedInfoByUserID(entity_BaseSession.ID); entity_BaseSession = entity_SessionWUserInfo; bool allowEdit = entity_BaseSession.CheckAccessRight("FTManage", "Edit", "", null); bool allowDel = entity_BaseSession.CheckAccessRight("FTManage", "Delete", "", null); returnResult = Respo_FT.GetAllFunctionType(); foreach (var item in returnResult) { item.AllowEdit = allowEdit; item.AllowDel = allowDel; } } return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public List <LUserRoleVM> GetAll(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); bool ret_CheckPrivilege = false; ret_CheckPrivilege = CheckTokenOnly(entity_BaseSession, ref strList_Error); List <LUserRoleVM> entityList_RoleVM = new List <LUserRoleVM>(); if (ret_CheckPrivilege) { IPrivilegeFun entity_IPrivilegeFun = WCFBootstrapper.Container.GetExportedValue <IPrivilegeFun>(); SessionWUserInfo entity_SessionWUserInfo = entity_IPrivilegeFun.getAuthorizedInfoByUserID(entity_BaseSession.ID); entity_BaseSession = entity_SessionWUserInfo; bool allowEdit = entity_BaseSession.CheckAccessRight("LURoleManage", "Edit", "", null); bool allowDel = entity_BaseSession.CheckAccessRight("LURoleManage", "Delete", "", null); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); UserRoleRespository roleRespo = new UserRoleRespository(dbContext, entity_BaseSession.ID); entityList_RoleVM = roleRespo.GetLURoleVM_All(); entityList_RoleVM.ForEach(current => { current.AllowDel = allowDel; current.AllowEdit = allowEdit; }); } return(entityList_RoleVM); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public FunDetailInfo GetFunDetailInfo_FID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); bool ret_CheckPrivilege = false; List <LUserAccessByOrgVM> ret = new List <LUserAccessByOrgVM>(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LoginUserRespository entityRepos_LoginUser = new LoginUserRespository(dbContext, entity_BaseSession.ID); SessionWUserInfo entity_SessionWUserInfo = entityRepos_LoginUser.GetLoginUserAccRight(entity_BaseSession.ID); string str_E025 = MultilingualHelper.GetStringFromResource(languageKey, "E025"); if (entity_SessionWUserInfo == null) { if (!ret_CheckPrivilege) { strList_Error.Add(str_E025); } } FunDetailInfo entity_FunDetailInfo = null; if (strList_Error.Count == 0) { FunctionDetailPolicy functionDetailPolicy = new FunctionDetailPolicy(); entity_FunDetailInfo = functionDetailPolicy.GetFunDetailInfo_FID(dbContext, Guid.Parse(str_FunID)); entity_FunDetailInfo.FName = MultilingualHelper.GetStringFromResource(languageKey, entity_FunDetailInfo.FKey); } return(entity_FunDetailInfo); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
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 IDictionary <Guid, List <string> > GetOrgPathListByUserIDList(List <Guid> guidList_UserID) { IDictionary <Guid, List <string> > ret = new Dictionary <Guid, List <string> >(); foreach (var guid_UserID in guidList_UserID) { List <string> strList_OrgPath_CheckUser = new List <string>(); DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext => { strList_OrgPath_CheckUser = CoolUtilities.CoolLinqUtility.InnerJoin( dbContext.LUserAccessByOrgs.AsNoTracking().Where(current => current.UA_User_ID == guid_UserID).ToList(), dbContext.LUserOrganizations.AsNoTracking().ToList(), (left, right) => left.UA_Org_ID == right.ID, (left, right) => right).Select(current => current.LUO_Path).ToList(); }); ret[guid_UserID] = strList_OrgPath_CheckUser; } return(ret); }
public FSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_FunID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); List <string> strList_Error = new List <string>(); FSerEditResult returnResult = new FSerEditResult(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); FunctionRespository Respo_F = new FunctionRespository(dbContext, entity_BaseSession.ID); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); bool allowEdit = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Edit", "", null); bool allowDel = entity_BaseSession.CheckAccessRight(entity_WCFAuthInfoVM.RequestFunKey, "Delete", "", null); if (ret) { FunctionVM db_FunctionVM = Respo_F.GetEntityByID(Guid.Parse(str_FunID), languageKey, ref strList_Error); db_FunctionVM.AllowEdit = allowEdit; db_FunctionVM.AllowDel = allowDel; returnResult.Entity_FunctionVM = db_FunctionVM; } returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public WCFReturnResult Update(WCFAuthInfoVM entity_WCFAuthInfoVM, LoginUserVM entity_LUVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LoginUserRespository loginUserRespo = new LoginUserRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; if (StaticContent.LockAdmin()) { ret = CheckAccPrivilegeWSpID(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, entity_LUVM.ID.ToString(), false, ref strList_Error); } else { ret = CheckAccPrivilegeWSpID(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, entity_LUVM.ID.ToString(), true, ref strList_Error); } if (ret) { ret = loginUserRespo.Update(entity_LUVM, languageKey, ref strList_Error); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public int GetTotalAuthorizationCount(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { WCFSesssionPolicy wcfPolicy = new WCFSesssionPolicy(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); BaseSession entity_BaseSession = wcfPolicy.RestoreWCFSesssion(entity_WCFAuthInfoVM); AuthorizedHistoryRespository authorizedHistoryRespo = new AuthorizedHistoryRespository(dbContext, entity_BaseSession.ID); int int_Counter = authorizedHistoryRespo.GetTotalAuthorizationCount(OperationType.L); return(int_Counter); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
public WCFReturnResult Delete(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_LUID) { try { RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); //Contruct Login User Respository CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); LoginUserRespository loginUserRespo = new LoginUserRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; if (StaticContent.LockAdmin()) { ret = CheckAccPrivilegeWSpID(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, str_LUID, false, ref strList_Error); } else { ret = CheckAccPrivilegeWSpID(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, str_LUID, true, ref strList_Error); } if (ret) { ret = loginUserRespo.Delete(str_LUID, languageKey, ref strList_Error); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public List <FunDetailInfo> GetPrivilegeByUserID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_ID, RoleType enum_RoleType) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); AccPrivilegePolicy userRoleFunDetailsPolicy = new AccPrivilegePolicy(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); bool ret = false; List <FunDetailInfo> entityList_FunDetailInfo = new List <FunDetailInfo>(); List <string> strList_Error = new List <string>(); ret = CheckTokenOnly(entity_BaseSession, ref strList_Error); if (ret) { Guid guid_OrgDID = default(Guid); if (Guid.TryParse(str_ID, out guid_OrgDID)) { entityList_FunDetailInfo = userRoleFunDetailsPolicy.Get_LoginUserPrivilege_UserID(dbContext, guid_OrgDID, enum_RoleType); foreach (var item in entityList_FunDetailInfo) { item.FName = MultilingualHelper.GetStringFromResource(languageKey, item.FKey); } } } return(entityList_FunDetailInfo); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public WCFReturnResult Delete(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_OrgDetailsID) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); OrgDRespository entityRepos_OrgD = new OrgDRespository(dbContext, entity_BaseSession.ID); List <string> strList_Error = new List <string>(); bool ret = false; ret = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error); if (ret) { ret = entityRepos_OrgD.Delete(str_OrgDetailsID, languageKey, ref strList_Error); } else { ret = false; string str_Message = MultilingualHelper.GetStringFromResource(languageKey, "E012"); strList_Error.Add(string.Format(str_Message, "ID")); } returnResult.IsSuccess = ret; returnResult.StrList_Error = strList_Error; return(returnResult); } catch (Exception ex) { throw new WebFaultException <WCFErrorContract>(new WCFErrorContract(ex), System.Net.HttpStatusCode.ExpectationFailed); } }
public WCFReturnResult Logout(WCFAuthInfoVM entity_WCFAuthInfoVM) { try { //Retrieve Language And Session RetrieveLanguageAndSession(entity_WCFAuthInfoVM); WCFReturnResult returnResult = new WCFReturnResult(); string str_SaveAuthorizedHistory_Error = ""; if (entity_BaseSession != null) { CoolPrivilegeControlContext dbContext = CoolPrivilegeControlContext.CreateContext(); AuthorizedHistoryRespository authorityHistoryRespos = new AuthorizedHistoryRespository(dbContext, entity_BaseSession.ID); authorityHistoryRespos.Create(new AuthorizedHistoryVM(), languageKey, out str_SaveAuthorizedHistory_Error, false); wcfPolicy.RemoveWCFSession(entity_BaseSession); } else { str_SaveAuthorizedHistory_Error = MultilingualHelper.GetStringFromResource(languageKey, "E011"); } if (!string.IsNullOrWhiteSpace(str_SaveAuthorizedHistory_Error)) { returnResult.StrList_Error.Add(str_SaveAuthorizedHistory_Error); returnResult.IsSuccess = false; } else { returnResult.IsSuccess = true; } return(returnResult); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }