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));
            }
        }
Exemplo n.º 2
0
        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 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));
            }
        }
Exemplo n.º 4
0
        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));
            }
        }
Exemplo n.º 5
0
        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));
            }
        }
Exemplo n.º 6
0
        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 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));
            }
        }