Esempio n. 1
0
        public ActionResult UserRoleUpdate(string Role_Guid)
        {
            try
            {
                string sRoleses = Request["menuGuids[]"];
                if (string.IsNullOrEmpty(Role_Guid))
                {
                    return(Json(new NBCMSResultJson
                    {
                        Status = StatusType.Error,
                        Data = "Request is illegal!"
                    }));
                }

                string             cookis      = Request[ConfigurationManager.AppSettings["userInfoCookiesKey"]];
                var                serializer  = new JavaScriptSerializer();
                string             decCookies  = CryptTools.Decrypt(cookis);
                User_Profile_Model curUserInfo = serializer.Deserialize(decCookies, typeof(User_Profile_Model)) as User_Profile_Model;
                MenuServices       mSvr        = new MenuServices();
                if (sRoleses == null)
                {
                    if (mSvr.DeleteAllRoleByUser(new Guid(Role_Guid)))
                    {
                        return(Json(new NBCMSResultJson
                        {
                            Status = StatusType.OK,
                            Data = "Successfully update user's role"
                        }));
                    }
                    else
                    {
                        return(Json(new NBCMSResultJson
                        {
                            Status = StatusType.Error,
                            Data = "faile to update user's role"
                        }));
                    }
                }
                string[] arrRoles = sRoleses.Split(',');
                if (mSvr.UpdateRoleInUser(arrRoles, new Guid(Role_Guid)))
                {
                    return(Json(new NBCMSResultJson
                    {
                        Status = StatusType.OK,
                        Data = "Successfully update Role's menu"
                    }));
                }
                else
                {
                    return(Json(new NBCMSResultJson
                    {
                        Status = StatusType.Error,
                        Data = "faile to update Role's menu"
                    }));
                }
            }
            catch (Exception ex)
            {
                NBCMSLoggerManager.Fatal(ex.Message);
                NBCMSLoggerManager.Fatal(ex.StackTrace);
                NBCMSLoggerManager.Error("");
                return(Json(new NBCMSResultJson
                {
                    Status = StatusType.Exception,
                    Data = ex.Message
                }));
            }
        }