Пример #1
0
        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 Delete(FormCollection collection)
        {
            //Message Box Title -- When Error occured, Message Box would be showed.
            string str_MsgBoxTitle = MultilingualHelper.GetStringFromResource(languageKey, "LoginUserManage_Delete");
            //Get User ID
            string str_ID = collection["UserID"];

            CommonJsonResult commonJsonResult = new CommonJsonResult();

            commonJsonResult.MsgTitle = str_MsgBoxTitle;

            WCFReturnResult ret = new WCFReturnResult();

            WebCommonHelper webCommonHelper = new WebCommonHelper();

            //webCommonHelper.CallWCFHelper<ILoginUserMgtSer>(this, this.HttpContext, postOffice.LoginUserMgtSerPath, (entity_ILoginUserMgtSer, entity_WCFAuthInfoVM) =>
            //{
            //    ret = entity_ILoginUserMgtSer.Delete(entity_WCFAuthInfoVM, str_ID);
            //});

            webCommonHelper.CallWCFHelper(this, (entity_WCFAuthInfoVM) =>
            {
                ret = loginUserMgtHelper.Value.Delete(entity_WCFAuthInfoVM, str_ID);
            });

            if (ret.IsSuccess)
            {
                //Refresh Server Side Session
                webCommonHelper.RefreshSeverSideSession(this, this.HttpContext, postOffice.LoginUserMgtSerPath);

                commonJsonResult.ReturnUrl = Url.Action("Index", "LoginUserManage", 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)
                {
                    string str_ErrorMsg = "";
                    if (ret.StrList_Error.Count() > 0)
                    {
                        str_ErrorMsg = string.Join("<br/>", ret.StrList_Error.ToArray());
                    }

                    commonJsonResult.ReturnUrl = Url.Action("Index", "LoginUserManage", 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", "LoginUserManage", 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));
                }
            }
        }