public string[] GetAttributeMappingOptionValues(string name, string lang = null) { var mapping = EntityType.AttributeMappings.Where(m => m.Name == name).FirstOrDefault(); if (mapping != null) { string msGuid = mapping.MetadataSet.Guid; string fieldName = mapping.FieldName; FormField field = GetMetadataSetField(msGuid, fieldName); if (field == null || !typeof(OptionsField).IsAssignableFrom(field.GetType())) { return(new string[] { string.Format("ERROR: INCORRECT {0} OPTIONS MAPPING FOUND FOR THIS ENTITY TYPE", mapping) }); } OptionsField optionField = (OptionsField)field; IEnumerable <List <TextValue> > values = optionField.Options.Where(o => o.Selected).Select(o => o.Value); if (lang != null) { return(values.SelectMany(v => v).Where(v => v.LanguageCode == lang).Select(v => v.Value).ToArray()); } return(values.Select(v => MultilingualHelper.Join(v, " / ", false)).ToArray()); } return(new string[] { }); }
public ActionResult Delete(FormCollection collection) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "AuthorizedHistoryManage_Delete"); string str_ID = collection["ID"]; string str_ErrorMsg = ""; CommonJsonResult commonJsonResult = new CommonJsonResult(); commonJsonResult.MsgTitle = str_MsgBoxTitle; WCFReturnResult ret = new WCFReturnResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { ret = authHisMgtHelper.Value.Delete(entity_WCFAuthInfoVM, str_ID); }); if (ret != null && ret.IsSuccess) { commonJsonResult.ReturnUrl = Url.Action("Index", "AuthorizedHistoryManage", new { Area = "AccessControl" }, Request.Url.Scheme); commonJsonResult.Success = true; MsgInfo successMsgInfo = new MsgInfo(); successMsgInfo.MsgTitle = str_MsgBoxTitle; successMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "I001"); successMsgInfo.MsgType = MessageType.Success; TempData[ActionMessageKey] = successMsgInfo; return(Json(commonJsonResult)); } else { if (ret.StrList_Error.Count > 0) { str_ErrorMsg = string.Join("<br/>", ret.StrList_Error.ToArray()); commonJsonResult.ReturnUrl = Url.Action("Index", "AuthorizedHistoryManage", new { Area = "AccessControl" }, Request.Url.Scheme); commonJsonResult.Success = false; MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = str_ErrorMsg; errorMsgInfo.MsgType = MessageType.ValidationError; TempData[ActionMessageKey] = errorMsgInfo; return(Json(commonJsonResult)); } else { commonJsonResult.ReturnUrl = Url.Action("Index", "AuthorizedHistoryManage", new { Area = "AccessControl" }, Request.Url.Scheme); commonJsonResult.Success = false; MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "E006"); errorMsgInfo.MsgType = MessageType.ValidationError; TempData[ActionMessageKey] = errorMsgInfo; return(Json(commonJsonResult)); } } }
public ActionResult Create() { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FManage_Create"); List <FunctionTypeVM> entityList_VM = new List <FunctionTypeVM>(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entityList_VM = funTypeMgtHelper.Value.GetAllFunType(entity_WCFAuthInfoVM); }); FunctionVM entity_Function = new FunctionVM(); if (entityList_VM != null && entityList_VM.Count() > 0) { foreach (var item in entityList_VM) { entity_Function.SelectedTypeList.Add(new FunctionSelectedType() { ID = item.ID, FunctionType = item.FunctionType, Selected = false }); } } return(View(entity_Function)); }
public string GetAttributeMappingValue(string name, string lang = null) { if (EntityType == null) { return(null); } var mapping = EntityType.AttributeMappings.Where(m => m.Name == name).FirstOrDefault(); if (mapping != null) { string msGuid = mapping.MetadataSet.Guid; string fieldName = mapping.FieldName; FormField field = GetMetadataSetField(msGuid, fieldName); if (field == null) { return(string.Format("ERROR: INCORRECT {0} MAPPING FOUND FOR THIS ENTITY TYPE", mapping)); } if (typeof(OptionsField).IsAssignableFrom(field.GetType())) { return(string.Join(", ", GetAttributeMappingOptionValues(name, lang))); } return(MultilingualHelper.Join(field.GetValues(true, lang), " / ", false)); } return(null); }
public void initLanguageComboBox(string str_Language = "en") { List <SelectListItem> _list = new List <SelectListItem>(); _list.Add(new SelectListItem() { Value = "", Text = MultilingualHelper.GetStringFromResource("PleaseSelect") }); _list.Add(new SelectListItem() { Value = "en", Text = "English" }); _list.Add(new SelectListItem() { Value = "cn", Text = "简体中文" }); _list.Add(new SelectListItem() { Value = "tw", Text = "繁体中文" }); _list.Add(new SelectListItem() { Value = "esve", Text = "Español - Venezuela" }); ViewBag.Langs = new SelectList((IEnumerable <SelectListItem>)_list, "Value", "Text", str_Language); }
public ActionResult Edit(LUserRoleVM entity_VM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LURoleManage_Edit"); initFunsList(); ModelState.Clear(); TryValidateModel(entity_VM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(entity_VM)); } string strError = ""; if (!string.IsNullOrWhiteSpace(entity_VM.funDListJson)) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); entity_VM.EntityList_FDInfo = javaScriptSerializer.Deserialize <List <FunDetailInfo> >(entity_VM.funDListJson); } WCFReturnResult entity_Return = new WCFReturnResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = roleMgtHelper.Value.Update(entity_WCFAuthInfoVM, entity_VM); }); if (entity_Return != null && entity_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_Return.StrList_Error.ToArray()); } if (entity_Return != null && entity_Return.IsSuccess) { webCommonHelper.RefreshSeverSideSession(this, this.HttpContext, postOffice.LoginUserMgtSerPath); MsgInfo successMsgInfo = new MsgInfo(); successMsgInfo.MsgTitle = str_MsgBoxTitle; successMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "I000"); successMsgInfo.MsgType = MessageType.Success; TempData[ActionMessageKey] = successMsgInfo; return(RedirectToAction("Index")); } else { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; return(View(entity_VM)); } }
// GET: AccessControl/LoginUserManage/Index public ActionResult Index(int page = 1, string sort = "", string sortDir = "") { //Retrieve selection criteria from cache. LoginUserVM selectionCriteria = new LoginUserVM(); //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LoginUserManage"); GetSelectionCriteriaFromViewData(ref selectionCriteria); //Define output variable(recordCount && entityList_Result) int recordCount = 0; List <LoginUserVM> entityList_Result = new List <LoginUserVM>(); //Define wcf output object; LUSerListResult entity_LUSerListResult = null; //Instantiate WebCommonHelper in order to call wcf service WebCommonHelper webCommonHelper = new WebCommonHelper(); //webCommonHelper.CallWCFHelper<ILoginUserMgtSer>(this, this.HttpContext, postOffice.LoginUserMgtSerPath, (entity_ILoginUserMgtSer, entity_WCFAuthInfoVM) => //{ // entity_LUSerListResult = entity_ILoginUserMgtSer.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria), guidList_AccessedLUserID); //}); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_LUSerListResult = loginUserMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria), guidList_AccessedLUserID); }); if (entity_LUSerListResult != null) { recordCount = entity_LUSerListResult.Int_TotalRecordCount; entityList_Result = entity_LUSerListResult.EntityList_LoginUserVM; } //Set paging bar info (Total Record Count and Page Index) StorePageInfo(recordCount, page); //Cache selection criteria StoreSelectionCriteria <LoginUserVM>(null); string strError = ""; if (entity_LUSerListResult.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_LUSerListResult.StrList_Error.ToArray()); } if (entity_LUSerListResult.StrList_Error.Count > 0) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; } return(View(entityList_Result)); }
public ActionResult Edit(string UserID) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LoginUserManage_Edit"); //Retrieve Drop Down List Item RetrieveDropDownListInfo(); LUSerEditResult wcf_Return = new LUSerEditResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); //webCommonHelper.CallWCFHelper<ILoginUserMgtSer>(this, this.HttpContext, postOffice.LoginUserMgtSerPath, (entity_ILoginUserMgtSer, entity_WCFAuthInfoVM) => //{ // wcf_Return = entity_ILoginUserMgtSer.GetEntityByIDWDetails(entity_WCFAuthInfoVM, UserID); //}); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { wcf_Return = loginUserMgtHelper.Value.GetEntityByIDWDetails(entity_WCFAuthInfoVM, UserID); }); if (wcf_Return.StrList_Error.Count > 0 || wcf_Return.Entity_LoginUserVM == null) { string strError = ""; if (wcf_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", wcf_Return.StrList_Error.ToArray()); } MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; LoginUserVM selectionCriteria = new LoginUserVM(); if (TempData.ContainsKey(SelectionCriteriaKey)) { selectionCriteria = (LoginUserVM)TempData[SelectionCriteriaKey]; } TempData[SelectionCriteriaKey] = selectionCriteria; TempData[ActionMessageKey] = errorMsgInfo; return(RedirectToAction("Index")); } else { if (wcf_Return.Entity_LoginUserVM.EntityList_FDInfo.Count > 0) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); wcf_Return.Entity_LoginUserVM.funDListJson = javaScriptSerializer.Serialize(wcf_Return.Entity_LoginUserVM.EntityList_FDInfo); } return(View(wcf_Return.Entity_LoginUserVM)); } }
public ActionResult Edit(string ID) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LURoleManage_Edit"); initFunsList(); string strError = ""; RoleSerEditResult wcf_Return = new RoleSerEditResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { wcf_Return = roleMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, ID); }); if (wcf_Return.StrList_Error.Count > 0 || wcf_Return.Entity_LUserRoleVM == null) { if (wcf_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", wcf_Return.StrList_Error.ToArray()); } MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; LUserRoleVM selectionCriteria = new LUserRoleVM(); if (TempData.ContainsKey(SelectionCriteriaKey)) { selectionCriteria = (LUserRoleVM)TempData[SelectionCriteriaKey]; } TempData[SelectionCriteriaKey] = selectionCriteria; TempData[ActionMessageKey] = errorMsgInfo; return(RedirectToAction("Index")); } else { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { List <FunDetailInfo> entityList_FunDetailInfo = orgDetailMgtHelper.Value.GetPrivilegeByUserID(entity_WCFAuthInfoVM, ID, RoleType.Role); wcf_Return.Entity_LUserRoleVM.EntityList_FDInfo = entityList_FunDetailInfo; wcf_Return.Entity_LUserRoleVM.funDListJson = javaScriptSerializer.Serialize(entityList_FunDetailInfo); }); } return(View(wcf_Return.Entity_LUserRoleVM)); }
// GET: AccessControl/FTMange public ActionResult Index(int page = 1, string sort = "", string sortDir = "") { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FTManage"); //Define output variable(recordCount && entityList_Result) int recordCount = 0; List <FunctionTypeVM> entityList_Result = new List <FunctionTypeVM>(); //Define wcf output object; FTSerListResult entity_FTSerListResult = null; FunctionTypeVM selectionCriteria = new FunctionTypeVM(); //Retrieve selection criteria that cached by system GetSelectionCriteriaFromViewData(ref selectionCriteria); //Instantiate WebCommonHelper in order to call wcf service WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_FTSerListResult = funTypeMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria)); }); //Assign data to local variable if (entity_FTSerListResult != null) { recordCount = entity_FTSerListResult.Int_TotalRecordCount; entityList_Result = entity_FTSerListResult.EntityList_FunctionTypeVM; } //Set paging bar info (Total Record Count and Page Index) StorePageInfo(recordCount, page); //Cache selection criteria StoreSelectionCriteria <FunctionVM>(null); //Pass Error To UI string strError = ""; if (entity_FTSerListResult.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_FTSerListResult.StrList_Error.ToArray()); } if (entity_FTSerListResult.StrList_Error.Count > 0) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; } return(View(entityList_Result)); }
public ActionResult Create(LUserOrgDetailsVM orgDetailsVM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LUOrgDetailsManage_Create"); initOrgDetailsList(); ModelState.Clear(); TryValidateModel(orgDetailsVM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(orgDetailsVM)); } string strError = ""; if (!string.IsNullOrWhiteSpace(orgDetailsVM.funDListJson) && (orgDetailsVM.OrgDetailsType.HasValue && orgDetailsVM.OrgDetailsType.Value == 1)) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); orgDetailsVM.EntityList_FDInfo = javaScriptSerializer.Deserialize <List <FunDetailInfo> >(orgDetailsVM.funDListJson); } WCFReturnResult ret = new WCFReturnResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { ret = orgDetailMgtHelper.Value.Create(entity_WCFAuthInfoVM, orgDetailsVM); }); if (ret != null && ret.StrList_Error.Count() > 0) { strError = string.Join("<br/>", ret.StrList_Error.ToArray()); } if (ret != null && ret.IsSuccess) { MsgInfo successMsgInfo = new MsgInfo(); successMsgInfo.MsgTitle = str_MsgBoxTitle; successMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "I000"); successMsgInfo.MsgType = MessageType.Success; TempData[ActionMessageKey] = successMsgInfo; return(RedirectToAction("Index")); } else { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; return(View(orgDetailsVM)); } }
public ActionResult Index(AuditLogVM selectionCriteria) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "AuditLogManage"); //Define output variable(recordCount && entityList_Result) int recordCount = 0; List <AuditLogVM> entityList_Result = new List <AuditLogVM>(); //Define wcf output object; ALSerListResult entity_ALSerListResult = null; WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_ALSerListResult = auditLogMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, 1, PageSize, null, null, CustomFilter(selectionCriteria)); }); //webCommonHelper.CallWCFHelper<IAuditLogMgtSer>(this, this.HttpContext, postOffice.AuditLogMgtSerPath, (entity_IAuditLogMgtSer, entity_WCFAuthInfoVM) => //{ // entity_ALSerListResult = entity_IAuditLogMgtSer.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, 1, PageSize, null, null, CustomFilter(selectionCriteria)); //}); //Assign data to local variable if (entity_ALSerListResult != null) { recordCount = entity_ALSerListResult.Int_TotalRecordCount; entityList_Result = entity_ALSerListResult.EntityList_AuditLogVM; } StorePageInfo(recordCount, 1); StoreSelectionCriteria <AuditLogVM>(selectionCriteria); initFunType(); //Pass Error To UI string strError = ""; if (entity_ALSerListResult.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_ALSerListResult.StrList_Error.ToArray()); } if (entity_ALSerListResult.StrList_Error.Count > 0) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; } return(View(entityList_Result)); }
public ActionResult Edit(SystemInfoVM entity_VM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "SystemInfoManage"); ModelState.Clear(); TryValidateModel(entity_VM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(entity_VM)); } string strError = ""; WCFReturnResult entity_Return = new WCFReturnResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = systemMgtHelper.Value.Update(entity_WCFAuthInfoVM, entity_VM); }); if (entity_Return != null && entity_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_Return.StrList_Error.ToArray()); } if (entity_Return != null && entity_Return.IsSuccess) { webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { //Update the static content StaticContent.SystemInfoInst = systemMgtHelper.Value.GetSystemInfo(entity_WCFAuthInfoVM); }); MsgInfo successMsgInfo = new MsgInfo(); successMsgInfo.MsgTitle = str_MsgBoxTitle; successMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "I000"); successMsgInfo.MsgType = MessageType.Success; TempData[ActionMessageKey] = successMsgInfo; return(RedirectToAction("Index")); } else { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; return(View("Index", entity_VM)); } }
// GET: AccessControl/LUOrganizationManage public ActionResult Index(int page = 1, string sort = "", string sortDir = "") { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LUOrganizationManage"); //Define output variable(recordCount && entityList_Result) int recordCount = 0; LUserOrganizationVM selectionCriteria = new LUserOrganizationVM(); GetSelectionCriteriaFromViewData(ref selectionCriteria); List <LUserOrganizationVM> entityList_Result = new List <LUserOrganizationVM>(); //Define wcf output object; OrgSerListResult entity_OrgSerListResult = null; WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_OrgSerListResult = orgMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria)); }); //Assign data to local variable if (entity_OrgSerListResult != null) { recordCount = entity_OrgSerListResult.Int_TotalRecordCount; entityList_Result = entity_OrgSerListResult.EntityList_LUserOrganizationVM; } StorePageInfo(recordCount, page); StoreSelectionCriteria <FunctionVM>(null); //Pass Error To UI string strError = ""; if (entity_OrgSerListResult != null && entity_OrgSerListResult.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_OrgSerListResult.StrList_Error.ToArray()); } if (!string.IsNullOrWhiteSpace(strError)) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; } return(View(entityList_Result)); }
// GET: AccessControl/LURoleManage public ActionResult Index(int page = 1, string sort = "", string sortDir = "") { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LoginUserManage_Create"); LUserRoleVM selectionCriteria = new LUserRoleVM(); GetSelectionCriteriaFromViewData(ref selectionCriteria); //Define output variable(recordCount && entityList_Result) int recordCount = 0; List <LUserRoleVM> entityList_Result = new List <LUserRoleVM>(); //Define wcf output object; RoleSerListResult entity_RoleSerListResult = null; //Instantiate WebCommonHelper in order to call wcf service WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_RoleSerListResult = roleMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria)); }); if (entity_RoleSerListResult != null) { recordCount = entity_RoleSerListResult.Int_TotalRecordCount; entityList_Result = entity_RoleSerListResult.EntityList_LUserRoleVM; } StorePageInfo(recordCount, page); StoreSelectionCriteria <LUserRoleVM>(null); string strError = ""; if (entity_RoleSerListResult.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_RoleSerListResult.StrList_Error.ToArray()); } if (entity_RoleSerListResult.StrList_Error.Count > 0) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; } return(View(entityList_Result)); }
public ActionResult Create(LUserOrganizationVM orgVM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LUOrganizationManage_Create"); WebCommonHelper webCommonHelper = new WebCommonHelper(); List <LUserOrgDetailsVM> entityList_OrgDetailsVM = initOrgDetailsList(); ViewBag.OrgDList = webCommonHelper.GetSelectList(entityList_OrgDetailsVM, "OrgDetailsKey", "ID", true); ModelState.Clear(); TryValidateModel(orgVM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(orgVM)); } string strError = ""; //Define wcf output object; WCFReturnResult ret = new WCFReturnResult(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { ret = orgMgtHelper.Value.Create(entity_WCFAuthInfoVM, orgVM); }); if (ret != null && ret.StrList_Error.Count() > 0) { strError = string.Join("<br/>", ret.StrList_Error.ToArray()); } if (ret != null && ret.IsSuccess) { MsgInfo successMsgInfo = new MsgInfo(); successMsgInfo.MsgTitle = str_MsgBoxTitle; successMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "I000"); successMsgInfo.MsgType = MessageType.Success; TempData[ActionMessageKey] = successMsgInfo; return(RedirectToAction("Index")); } else { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; return(View(orgVM)); } }
public ActionResult Edit(string guid) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LUOrganizationManage_Edit"); WebCommonHelper webCommonHelper = new WebCommonHelper(); List <LUserOrgDetailsVM> entityList_OrgDetailsVM = initOrgDetailsList(); ViewBag.OrgDList = webCommonHelper.GetSelectList(entityList_OrgDetailsVM, "OrgDetailsKey", "ID", true); Guid ID = Guid.Parse(guid); string strError = ""; OrgSerEditResult entity_Return = new OrgSerEditResult(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = orgMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, guid); }); if (entity_Return.StrList_Error.Count > 0 || entity_Return.Entity_LUserOrganizationVM == null) { if (entity_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_Return.StrList_Error.ToArray()); } MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; LUserOrgDetailsVM selectionCriteria = new LUserOrgDetailsVM(); if (TempData.ContainsKey(SelectionCriteriaKey)) { selectionCriteria = (LUserOrgDetailsVM)TempData[SelectionCriteriaKey]; } TempData[SelectionCriteriaKey] = selectionCriteria; TempData[ActionMessageKey] = errorMsgInfo; return(RedirectToAction("Index")); } else { return(View(entity_Return.Entity_LUserOrganizationVM)); } }
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 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 ActionResult Create(FunctionTypeVM functionTypeVM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FTManage_Create"); ModelState.Clear(); TryValidateModel(functionTypeVM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View()); } string strError = ""; //Define wcf output object; WCFReturnResult ret = new WCFReturnResult(); //Call WCF Service WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { ret = funTypeMgtHelper.Value.Create(entity_WCFAuthInfoVM, functionTypeVM); }); if (ret != null && ret.StrList_Error.Count() > 0) { strError = string.Join("<br/>", ret.StrList_Error.ToArray()); } if (ret != null && ret.IsSuccess) { MsgInfo successMsgInfo = new MsgInfo(); successMsgInfo.MsgTitle = str_MsgBoxTitle; successMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "I000"); successMsgInfo.MsgType = MessageType.Success; TempData[ActionMessageKey] = successMsgInfo; return(RedirectToAction("Index")); } else { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; return(View(functionTypeVM)); } }
public ActionResult Edit(string guid) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FTManage_Edit"); string strError = ""; //Define wcf output object; FTSerEditResult entity_Return = new FTSerEditResult(); //Call WCF Service WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = funTypeMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, guid); }); if (entity_Return.StrList_Error.Count > 0 || entity_Return.Entity_FunctionTypeVM == null) { if (entity_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_Return.StrList_Error.ToArray()); } MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; FunctionTypeVM selectionCriteria = new FunctionTypeVM(); if (TempData.ContainsKey(SelectionCriteriaKey)) { selectionCriteria = (FunctionTypeVM)TempData[SelectionCriteriaKey]; } TempData[SelectionCriteriaKey] = selectionCriteria; TempData[ActionMessageKey] = errorMsgInfo; return(RedirectToAction("Index")); } else { return(View(entity_Return.Entity_FunctionTypeVM)); } }
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 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); } }
// GET: AccessControl/SystemInfoManage public ActionResult Index() { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "SystemInfoManage"); string strError = ""; SystemInfoVM entity_SystemInfoVM = null; WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_SystemInfoVM = systemMgtHelper.Value.GetSystemInfo(entity_WCFAuthInfoVM); }); if (entity_SystemInfoVM == null) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.ValidationError; LUserRoleVM selectionCriteria = new LUserRoleVM(); if (TempData.ContainsKey(SelectionCriteriaKey)) { selectionCriteria = (LUserRoleVM)TempData[SelectionCriteriaKey]; } TempData[SelectionCriteriaKey] = selectionCriteria; TempData[ActionMessageKey] = errorMsgInfo; return(View("Index")); } else { if (TempData[ActionMessageKey] != null) { ViewBag.ActionMessage = TempData[ActionMessageKey]; } return(View(entity_SystemInfoVM)); } }
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 ActionResult Index(FormCollection collection) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "AuditLogManage"); //Define output variable(recordCount && entityList_Result) int recordCount = 0; List <AuthorizedHistoryVM> entityList_Result = new List <AuthorizedHistoryVM>(); AuthorizedHistoryVM selectionCriteria = new AuthorizedHistoryVM(); typeof(AuthorizedHistoryVM).GetProperties(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance).ToList().ForEach(current => { if (collection.AllKeys.Contains(current.Name)) { current.SetValue(selectionCriteria, collection[current.Name], null); } }); initOperationType(selectionCriteria.OperationType); //Define wcf output object; AHSerListResult entity_AHSerListResult = null; WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_AHSerListResult = authHisMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, 1, PageSize, null, null, null); }); //Assign data to local variable if (entity_AHSerListResult != null) { recordCount = entity_AHSerListResult.Int_TotalRecordCount; entityList_Result = entity_AHSerListResult.EntityList_AuthorizedHistoryVM; } StorePageInfo(recordCount, 1); StoreSelectionCriteria <AuthorizedHistoryVM>(selectionCriteria); return(View(entityList_Result)); }
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); } }
// GET: AccessControl/Login/Reset public ActionResult Reset() { if (UserGuid.HasValue) { return(View()); } else { string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource("LoginScreentTitle"); string str_E011 = MultilingualHelper.GetStringFromResource("E011"); MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = str_E011; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; TempData[ActionMessageKey] = errorMsgInfo; return(View("Index")); } }
private void initOperationType(string operationType) { List <SelectListItem> _list = new List <SelectListItem>(); _list.Add(new SelectListItem() { Value = "", Text = MultilingualHelper.GetStringFromResource("PleaseSelect") }); _list.Add(new SelectListItem() { Value = "L", Text = MultilingualHelper.GetStringFromResource("Login") }); _list.Add(new SelectListItem() { Value = "O", Text = MultilingualHelper.GetStringFromResource("Logout") }); ViewBag.OperationTypeList = new SelectList((IEnumerable <SelectListItem>)_list, "Value", "Text", operationType); }