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) { entityList_OrgVM = funRespo.GetFuns_All(); } return(entityList_OrgVM); } return(new List <FunctionVM>()); } catch (Exception ex) { throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message); } }
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 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); } }