public void CreateLoginUser() { loginUserMgtController.FunTypeKey = "Create"; commonFixture.MockControllerInfo(loginUserMgtController, "http://localhost:50653/AccessControl/LoginUserManage/Create"); Random random = new Random(); #region [ Create Login User with Specific Functions ] //00010001 FunctionVM entity_FunctionVM = entityList_FunctionVM.Where(current => current.FunctionPath == "00010001").FirstOrDefault(); string str_FunID = entity_FunctionVM.ID.ToString(); FunDetailInfo entity_FunDetailInfo = new FunDetailInfo(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(loginUserMgtController, (entity_WCFSessionVM) => { entity_FunDetailInfo = loginUserMgtController.funMgtHelper.Value.GetFunDetailInfo_FID(entity_WCFSessionVM, str_FunID); entity_FunDetailInfo.FDSelected.ForEach(current => current = true); }); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); List <FunDetailInfo> entityList_FunDetailInfo = new List <FunDetailInfo>(); entityList_FunDetailInfo.Add(entity_FunDetailInfo); int r = random.Next(1, 1000); string str_LoginName = "A" + r; //LoginUser LoginUserVM loginUserVM = new LoginUserVM() { LoginName = str_LoginName, NewPwd = "A12346.b", ConfirmNewPwd = "A12346.b", Status = 1, UserType = 1, funDListJson = javaScriptSerializer.Serialize(entityList_FunDetailInfo) }; ActionResult actionResult = loginUserMgtController.Create(loginUserVM); Assert.IsType <RedirectToRouteResult>(actionResult); #endregion #region [ Create Login User with Role ] r = random.Next(1, 1000); str_LoginName = "A" + r; loginUserVM = new LoginUserVM() { LoginName = str_LoginName, NewPwd = "A12346.b", ConfirmNewPwd = "A12346.b", Status = 1, UserType = 2, roleListIDList = String.Join("|", entityList_LUserRoleVM.Select(current => current.ID.ToString()).ToArray()) }; actionResult = loginUserMgtController.Create(loginUserVM); Assert.IsType <RedirectToRouteResult>(actionResult); #endregion #region [ Create Login User with Org ] List <string> strList_Org = entityList_LUserOrganizationVM.Where(current => current.OrganizationPath == "00010001" || current.OrganizationPath == "000100010002").Select(current => current.ID.ToString()).ToList(); List <string> strList_OrgDetail = entityList_LUserOrgDetailsVM.Select(current => current.ID.ToString()).ToList(); r = random.Next(1, 1000); str_LoginName = "A" + r; loginUserVM = new LoginUserVM() { LoginName = str_LoginName, NewPwd = "A12346.b", ConfirmNewPwd = "A12346.b", Status = 1, UserType = 3, orgListIDList = String.Join("|", strList_Org), orgDetailsIDList = String.Join("|", strList_OrgDetail) }; actionResult = loginUserMgtController.Create(loginUserVM); Assert.IsType <RedirectToRouteResult>(actionResult); #endregion }
public ActionResult Edit(LUserOrganizationVM organizationVM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LUOrganizationManage_Edit"); WebCommonHelper webCommonHelper = new WebCommonHelper(); List <LUserRoleVM> entityList_RoleVM = new List <LUserRoleVM>(); List <FunctionVM> entityList_FunVM = new List <FunctionVM>(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entityList_FunVM = funMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); entityList_RoleVM = roleMgtHelper.Value.GetAll(entity_WCFAuthInfoVM); }); ViewBag.RoleList = webCommonHelper.GetSelectList(entityList_RoleVM, "RoleName", "ID", true); entityList_FunVM.ForEach(current => current.FunctionKey = current.FunctionPath + " - " + MultilingualHelper.GetStringFromResource(current.FunctionKey)); ViewBag.FunIDs = webCommonHelper.GetSelectList(entityList_FunVM, "FunctionKey", "ID", true); ModelState.Clear(); TryValidateModel(organizationVM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(organizationVM)); } string strError = ""; WCFReturnResult entity_Return = new WCFReturnResult(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = orgMgtHelper.Value.Update(entity_WCFAuthInfoVM, organizationVM); }); if (entity_Return != null && entity_Return.IsSuccess) { webCommonHelper.RefreshSeverSideSession(this, this.HttpContext, postOffice.LoginUserMgtSerPath); } 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) { 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(organizationVM)); } }
public ActionResult Delete(FormCollection collection) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "FManage_Edit"); 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 = funMgtHelper.Value.Delete(entity_WCFAuthInfoVM, str_ID); }); if (ret != null && ret.IsSuccess) { //Refresh Server Side Session webCommonHelper.RefreshSeverSideSession(this, this.HttpContext, postOffice.LoginUserMgtSerPath); commonJsonResult.ReturnUrl = Url.Action("Index", "FManage", 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", "FManage", 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", "FManage", 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 Reset(FormCollection collection) { string str_Error = ""; string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource("Login_Reset"); List <string> strList_Error = new List <string>(); if (UserGuid.HasValue) { LoginUserVM entity_LUVM = new LoginUserVM(); entity_LUVM.ID = this.UserGuid.Value; WebCommonHelper webCommonHelper = new WebCommonHelper(); LUSerEditResult entity_LUSerEditResult = new LUSerEditResult(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_LUSerEditResult = loginUserMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, entity_LUVM.ID.ToString()); }); if (entity_LUSerEditResult.StrList_Error.Count > 0) { foreach (var item in entity_LUSerEditResult.StrList_Error) { strList_Error.Add(item); } } if (strList_Error.Count > 0) { str_Error = string.Join("<br/>", strList_Error.ToArray()); } else { entity_LUVM = entity_LUSerEditResult.Entity_LoginUserVM; typeof(LoginUserVM).GetProperties(BindingFlags.SetProperty | BindingFlags.Public | BindingFlags.Instance).ToList().ForEach(current => { if (collection.AllKeys.Contains(current.Name)) { current.SetValue(entity_LUVM, collection[current.Name], null); } }); ClientSessionInfo entity_ClientSessionInfo = null; if (ViewData.ContainsKey(Bootstrapper.UserClientSessionKey.ToString())) { entity_ClientSessionInfo = (ClientSessionInfo)ViewData[Bootstrapper.UserClientSessionKey.ToString()]; } WCFReturnResult entity_Return = new WCFReturnResult(); //webCommonHelper.CallWCFHelper<ILoginUserMgtSer>(this, this.HttpContext, postOffice.LoginUserMgtSerPath, (entity_ILoginUserMgtSer, entity_WCFAuthInfoVM) => //{ // entity_Return = entity_ILoginUserMgtSer.ResetPwd(entity_WCFAuthInfoVM, entity_LUVM); //}); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = loginUserMgtHelper.Value.ResetPwd(entity_WCFAuthInfoVM, entity_LUVM); }); if (entity_Return.StrList_Error.Count > 0) { foreach (var item in entity_Return.StrList_Error) { strList_Error.Add(item); } str_Error = string.Join("<br/>", entity_Return.StrList_Error.ToArray()); } else if (entity_Return.IsSuccess) { return(Redirect("/AccessControl/FManage")); } } } 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()); }
public ActionResult Logout() { #region [ Add data into language combo box ] if (TempData.Keys.Contains(StaticContent.LanguageKey)) { LanguageKey temp = (LanguageKey)(TempData[StaticContent.LanguageKey]); initLanguageComboBox(temp.ToString()); } else { initLanguageComboBox(); } #endregion string str_IpAddr = this.HttpContext.Request.UserHostAddress; string str_HostName = this.HttpContext.Request.UserHostName; string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource("LoginScreentTitle"); string strError = MultilingualHelper.GetStringFromResource("I003"); string str_SaveAuthorizedHistory_Error = ""; if (ViewData.ContainsKey(Bootstrapper.UserClientSessionKey.ToString())) { ClientSessionInfo entity_ClientSessionInfo = null; if (ViewData.ContainsKey(Bootstrapper.UserClientSessionKey.ToString())) { entity_ClientSessionInfo = (ClientSessionInfo)ViewData[Bootstrapper.UserClientSessionKey.ToString()]; } if (entity_ClientSessionInfo != null) { BaseSession entity_BaseSession = entity_SessionWUserInfo; if (entity_BaseSession != null) { WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { WCFReturnResult entity = loginUserMgtHelper.Value.Logout(entity_WCFAuthInfoVM); if (!entity.IsSuccess) { str_SaveAuthorizedHistory_Error = string.Join("<br/>", entity.StrList_Error.ToArray()); } else { MVCSessionMgt.RemoveServerSideSession(entity_BaseSession); } }); } if (ViewData.ContainsKey(Bootstrapper.UserClientSessionKey.ToString())) { ViewData.Remove(Bootstrapper.UserClientSessionKey.ToString()); } if (TempData.ContainsKey(Bootstrapper.UserClientSessionKey.ToString())) { TempData.Remove(Bootstrapper.UserClientSessionKey.ToString()); } } } if (!string.IsNullOrWhiteSpace(str_SaveAuthorizedHistory_Error)) { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = str_SaveAuthorizedHistory_Error; errorMsgInfo.MsgType = MessageType.ValidationError; ViewBag.ActionMessage = errorMsgInfo; TempData[ActionMessageKey] = errorMsgInfo; } else { MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = strError; errorMsgInfo.MsgType = MessageType.Success; ViewBag.ActionMessage = errorMsgInfo; TempData[ActionMessageKey] = errorMsgInfo; } return(View("Index")); }
public ActionResult Export(FormCollection collection) { string sort = ""; string sortDir = ""; if (collection.AllKeys.Contains("sort")) { sort = collection["sort"]; } if (collection.AllKeys.Contains("sortDir")) { sortDir = collection["sortDir"]; } //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "AuditLogManage_Export"); ExportFileJsonResult commonJsonResult = new ExportFileJsonResult(); commonJsonResult.MsgTitle = str_MsgBoxTitle; AuditLogVM selectionCriteria = new AuditLogVM(); if (TempData.ContainsKey(SelectionCriteriaKey)) { selectionCriteria = (AuditLogVM)TempData[SelectionCriteriaKey]; } TempData[SelectionCriteriaKey] = selectionCriteria; ViewBag.SelectionCriteria = selectionCriteria; 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, int.MaxValue, sort, sortDir, CustomFilter(selectionCriteria)); }); //webCommonHelper.CallWCFHelper<IAuditLogMgtSer>(this, this.HttpContext, postOffice.AuditLogMgtSerPath, (entity_IAuditLogMgtSer, entity_WCFAuthInfoVM) => //{ // entity_ALSerListResult = entity_IAuditLogMgtSer.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, 1, int.MaxValue, sort, sortDir, CustomFilter(selectionCriteria)); //}); //Assign data to local variable if (entity_ALSerListResult != null) { recordCount = entity_ALSerListResult.Int_TotalRecordCount; entityList_Result = entity_ALSerListResult.EntityList_AuditLogVM; } if (entityList_Result != null && entityList_Result.Count > 0) { RendDtlToExcelPolicy rendDtlToExcelPolicy = new RendDtlToExcelPolicy(); List <string> strList_DisplayColumn = new List <string>(); strList_DisplayColumn.Add("Operator"); strList_DisplayColumn.Add("AL_CreateDate"); strList_DisplayColumn.Add("AL_TableName"); strList_DisplayColumn.Add("AL_EventType"); strList_DisplayColumn.Add("AL_OriginalValue"); strList_DisplayColumn.Add("AL_NewValue"); Dictionary <string, string> dic_OutputMapping = new Dictionary <string, string>() { { "Operator", MultilingualHelper.GetStringFromResource("Operator") }, { "AL_CreateDate", MultilingualHelper.GetStringFromResource("Date") }, { "AL_TableName", MultilingualHelper.GetStringFromResource("TableName") }, { "AL_EventType", MultilingualHelper.GetStringFromResource("OperationType") }, { "AL_OriginalValue", MultilingualHelper.GetStringFromResource("OriginalValue") }, { "AL_NewValue", MultilingualHelper.GetStringFromResource("NewValue") }, { "AL_RecordKey", MultilingualHelper.GetStringFromResource("RecordKey") }, }; MemoryStream memoryStream = rendDtlToExcelPolicy.ExportEntityListToXlsx <AuditLogVM>("AuditLog", entityList_Result, true, 1, 1, strList_DisplayColumn, dic_OutputMapping); string Key = Guid.NewGuid().ToString(); TempData[Key] = memoryStream; commonJsonResult.ReturnUrl = Url.Action("ExportExcel", "Export", new { Area = "Common" }, Request.Url.Scheme); commonJsonResult.Success = true; commonJsonResult.Key = Key; commonJsonResult.OutputFileName = "AuditLog" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".xlsx"; return(Json(commonJsonResult)); } else { commonJsonResult.ReturnUrl = Url.Action("Index", "AuditLogManage", new { Area = "AccessControl" }, Request.Url.Scheme); commonJsonResult.Success = false; MsgInfo errorMsgInfo = new MsgInfo(); errorMsgInfo.MsgTitle = str_MsgBoxTitle; errorMsgInfo.MsgDesc = MultilingualHelper.GetStringFromResource(languageKey, "E019"); errorMsgInfo.MsgType = MessageType.ValidationError; TempData[ActionMessageKey] = errorMsgInfo; return(Json(commonJsonResult)); } }
// 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, "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; AuditLogVM selectionCriteria = new AuditLogVM(); GetSelectionCriteriaFromViewData(ref selectionCriteria); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_ALSerListResult = auditLogMgtHelper.Value.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria)); }); //webCommonHelper.CallWCFHelper<IAuditLogMgtSer>(this, this.HttpContext, postOffice.AuditLogMgtSerPath, (entity_IAuditLogMgtSer, entity_WCFAuthInfoVM) => //{ // entity_ALSerListResult = entity_IAuditLogMgtSer.GetListWithPaging(entity_WCFAuthInfoVM, selectionCriteria, page, PageSize, sort, sortDir, CustomFilter(selectionCriteria)); //}); //Assign data to local variable if (entity_ALSerListResult != null) { recordCount = entity_ALSerListResult.Int_TotalRecordCount; entityList_Result = entity_ALSerListResult.EntityList_AuditLogVM; } StorePageInfo(recordCount, page); StoreSelectionCriteria <AuditLogVM>(null); 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(string guid) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LUOrgDetailsManage_Edit"); initOrgDetailsList(); Guid ID = Guid.Parse(guid); string strError = ""; ODSerEditResult entity_Return = new ODSerEditResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = orgDetailMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, guid); }); if (entity_Return.StrList_Error.Count > 0 || entity_Return.Entity_LUserOrgDetailsVM == 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 { //By Role Settings if (entity_Return.Entity_LUserOrgDetailsVM.OrgDetailsType.HasValue && entity_Return.Entity_LUserOrgDetailsVM.OrgDetailsType.Value == 2) { webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { List <LUserRoleVM> entityList = orgDetailMgtHelper.Value.GetRoleSettingsByOrgDID(entity_WCFAuthInfoVM, guid); if (entityList.Count > 0) { entity_Return.Entity_LUserOrgDetailsVM.roleListIDList = entityList.Select(currrent => currrent.ID.ToString()).Aggregate((first, next) => { return(first + "|" + next); }); } }); } //By Specified Functions Settings else { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { List <FunDetailInfo> entityList_FunDetailInfo = orgDetailMgtHelper.Value.GetPrivilegeByUserID(entity_WCFAuthInfoVM, ID.ToString(), RoleType.Organization); entity_Return.Entity_LUserOrgDetailsVM.EntityList_FDInfo = entityList_FunDetailInfo; entity_Return.Entity_LUserOrgDetailsVM.funDListJson = javaScriptSerializer.Serialize(entityList_FunDetailInfo); }); } return(View(entity_Return.Entity_LUserOrgDetailsVM)); } }
public ActionResult Edit(LoginUserVM loginUserVM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LoginUserManage_Edit"); List <string> strList_Error = new List <string>(); //Retrieve Drop Down List Item RetrieveDropDownListInfo(); //Error Message string strError = ""; LoginUserVM entityInst_Existing = null; WebCommonHelper webCommonHelper = new WebCommonHelper(); //Define object to receive service result LUSerEditResult entity_LUSerEditResult = new LUSerEditResult(); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_LUSerEditResult = loginUserMgtHelper.Value.GetEntityByID(entity_WCFAuthInfoVM, loginUserVM.ID.ToString()); }); if (entity_LUSerEditResult.StrList_Error.Count > 0) { foreach (var item in entity_LUSerEditResult.StrList_Error) { strList_Error.Add(item); } } else { entityInst_Existing = entity_LUSerEditResult.Entity_LoginUserVM; if (loginUserVM.isChangePwd) { loginUserVM.LoginPwd = loginUserVM.NewPwd; } else { loginUserVM.LoginPwd = loginUserVM.NewPwd = loginUserVM.ConfirmNewPwd = entityInst_Existing.LoginPwd; } ModelState.Clear(); TryValidateModel(loginUserVM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(loginUserVM)); } if (loginUserVM.UserType.HasValue && loginUserVM.UserType.Value == 1 && !string.IsNullOrWhiteSpace(loginUserVM.funDListJson)) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); loginUserVM.EntityList_FDInfo = javaScriptSerializer.Deserialize <List <FunDetailInfo> >(loginUserVM.funDListJson); } WCFReturnResult entity_Return = new WCFReturnResult(); //webCommonHelper.CallWCFHelper<ILoginUserMgtSer>(this, this.HttpContext, postOffice.LoginUserMgtSerPath, (entity_ILoginUserMgtSer, entity_WCFAuthInfoVM) => //{ // entity_Return = entity_ILoginUserMgtSer.Update(entity_WCFAuthInfoVM, loginUserVM); //}); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = loginUserMgtHelper.Value.Update(entity_WCFAuthInfoVM, loginUserVM); }); // Refresh Server Side Session if (entity_Return != null && entity_Return.IsSuccess) { webCommonHelper.RefreshSeverSideSession(this, this.HttpContext, postOffice.LoginUserMgtSerPath); } if (entity_Return.StrList_Error.Count > 0) { foreach (var item in entity_Return.StrList_Error) { strList_Error.Add(item); } } } if (strList_Error.Count > 0) { strError = string.Join("<br/>", strList_Error.ToArray()); } if (strList_Error.Count == 0) { 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(loginUserVM)); } }
public ActionResult Create(LoginUserVM loginUserVM) { //Message Box Title -- When Error occured, Message Box would be showed. string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LoginUserManage_Create"); //Retrieve Drop Down List Item RetrieveDropDownListInfo(); if (!string.IsNullOrWhiteSpace(loginUserVM.NewPwd)) { loginUserVM.LoginPwd = loginUserVM.NewPwd; } ModelState.Clear(); TryValidateModel(loginUserVM); if (!ErrorMsgHelper.CustomValiation(str_MsgBoxTitle, ModelState, ViewBag)) { return(View(loginUserVM)); } string strError = ""; if (!string.IsNullOrWhiteSpace(loginUserVM.funDListJson) && (loginUserVM.UserType.HasValue && loginUserVM.UserType.Value == 1)) { JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); loginUserVM.EntityList_FDInfo = javaScriptSerializer.Deserialize <List <FunDetailInfo> >(loginUserVM.funDListJson); } WCFReturnResult entity_Return = new WCFReturnResult(); WebCommonHelper webCommonHelper = new WebCommonHelper(); //webCommonHelper.CallWCFHelper<ILoginUserMgtSer>(this, this.HttpContext, postOffice.LoginUserMgtSerPath, (entity_ILoginUserMgtSer, entity_WCFAuthInfoVM) => //{ // entity_Return = entity_ILoginUserMgtSer.Create(entity_WCFAuthInfoVM, loginUserVM); //}); webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) => { entity_Return = loginUserMgtHelper.Value.Create(entity_WCFAuthInfoVM, loginUserVM); }); if (entity_Return.StrList_Error.Count() > 0) { strError = string.Join("<br/>", entity_Return.StrList_Error.ToArray()); } if (entity_Return.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(loginUserVM)); } }