コード例 #1
0
        public LUSerEditResult GetEntityByIDWDetails(WCFAuthInfoVM entity_WCFAuthInfoVM, string UserID)
        {
            LUSerEditResult ret = null;

            ret = _client.GetEntityByIDWDetails(entity_WCFAuthInfoVM, UserID);
            return(ret);
        }
コード例 #2
0
        public LUSerEditResult GetEntityByID(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_LUID)
        {
            LUSerEditResult ret = null;

            ret = _client.GetEntityByID(entity_WCFAuthInfoVM, str_LUID);
            return(ret);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
        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));
            }
        }
コード例 #5
0
        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());
        }
コード例 #6
0
        public LUSerEditResult GetEntityByIDWDetails(WCFAuthInfoVM entity_WCFAuthInfoVM, string str_LUID)
        {
            try
            {
                //Retrieve Language And Session
                RetrieveLanguageAndSession(entity_WCFAuthInfoVM);

                List <string> strList_Error = new List <string>();

                bool ret_CheckPrivilege = false;

                LUSerEditResult ret = new LUSerEditResult();
                ret.StrList_Error = strList_Error;

                Guid ID = Guid.Parse(str_LUID);

                ret_CheckPrivilege = CheckAccPrivilege(entity_BaseSession.ID, entity_WCFAuthInfoVM.RequestFunKey, entity_WCFAuthInfoVM.RequestFunTypeKey, ref strList_Error);

                if (ret_CheckPrivilege)
                {
                    string      str_Error      = "";
                    LoginUserVM db_LoginUserVM = null;

                    DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext =>
                    {
                        LoginUserRespository Respo_LU = new LoginUserRespository(dbContext, entity_BaseSession.ID);
                        db_LoginUserVM = Respo_LU.GetEntityByID(ID, languageKey, ref strList_Error);
                    });

                    if (!string.IsNullOrWhiteSpace(str_Error))
                    {
                        ret.StrList_Error.Add(str_Error);
                    }
                    else
                    {
                        db_LoginUserVM.isChangePwd = false;

                        //By Role Settings
                        if (db_LoginUserVM.UserType.HasValue && db_LoginUserVM.UserType.Value == 2)
                        {
                            LUserAccessPolicy lUserAccessPolicy = new LUserAccessPolicy();

                            DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext =>
                            {
                                List <LUserRoleVM> entityList = lUserAccessPolicy.Get_RoleSettings_LUserID(dbContext, ID);

                                if (entityList.Count > 0)
                                {
                                    db_LoginUserVM.roleListIDList = entityList.Select(currrent => currrent.ID.ToString()).Aggregate((first, next) =>
                                    {
                                        return(first + "|" + next);
                                    });
                                }
                            });
                        }
                        //By Organization Settings
                        else if (db_LoginUserVM.UserType.HasValue && db_LoginUserVM.UserType.Value == 3)
                        {
                            DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext =>
                            {
                                LUserAccessByOrgRespository entity_LUserAccessByOrgRespo = new LUserAccessByOrgRespository(dbContext, entity_BaseSession.ID);

                                List <LUserAccessByOrgVM> entityList = entity_LUserAccessByOrgRespo.Get_LoginUserOrgSettings_LUserID(dbContext, ID);

                                if (entityList.Count > 0)
                                {
                                    db_LoginUserVM.orgListIDList = entityList.Select(currrent => currrent.UA_Org_ID.ToString()).Aggregate((first, next) =>
                                    {
                                        return(first + "|" + next);
                                    });

                                    db_LoginUserVM.orgDetailsIDList = entityList.Select(currrent => currrent.UA_OrgD_ID.ToString()).Aggregate((first, next) =>
                                    {
                                        return(first + "|" + next);
                                    });
                                }
                            });
                        }
                        //By Specific Function Settings
                        else
                        {
                            DBContextHelper.ExecuteSearchEvent(CoolPrivilegeControlContext.CreateContext(), dbContext =>
                            {
                                AccPrivilegePolicy userRoleFunDetailsPolicy = new AccPrivilegePolicy();

                                List <FunDetailInfo> entityList_FunDetailInfo = userRoleFunDetailsPolicy.Get_LoginUserPrivilege_UserID(dbContext, ID);

                                db_LoginUserVM.EntityList_FDInfo = entityList_FunDetailInfo;
                            });
                        }
                    }
                    ret.Entity_LoginUserVM = db_LoginUserVM;
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw new FaultException <WCFErrorContract>(new WCFErrorContract(ex), ex.Message);
            }
        }
コード例 #7
0
        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));
            }
        }