예제 #1
0
        public string DelRole(string id)
        {
            //bool result = new RolePermission().DelRole(id);
            bool   result = new UserVerify(RMUrl).DelRole(id);
            string msg    = string.Empty;

            if (result)
            {
                msg = General.Resource.Common.Success;
            }
            else
            {
                msg = General.Resource.Common.Failed;
            }
            return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}"
                                 , result.ToString().ToLower(), msg));
        }
예제 #2
0
        public string UpdRolePermission(string RoleID, string Funs)
        {
            //R_LocalRole_Subfunction
            List <string> funs = Funs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            //bool result = new RolePermission().UpdRolePermission(RoleID, funs);
            List <R_LocalRole_Subfunction> rfs     = new List <R_LocalRole_Subfunction>();
            R_LocalRole_Subfunction        item    = new R_LocalRole_Subfunction();
            List <TreeMenuItem>            menuLst = this.HttpContext.Application["Functions"] as List <TreeMenuItem>;
            TreeMenuItem menuItem = new TreeMenuItem();
            string       msg      = string.Empty;

            foreach (string fun in funs)
            {
                menuItem = menuLst.Find(i => i.GUID.Equals(fun));
                item     = new R_LocalRole_Subfunction()
                {
                    CreateDate             = DateTime.Now,
                    CreateUTCDate          = DateTime.UtcNow,
                    LocalRoleSymbolID      = RoleID,
                    ModuleID               = string.IsNullOrEmpty(menuItem.ModuleID) ? fun : menuItem.ModuleID,
                    SubfunctionEnglishName = menuItem.EnglishName,
                    SubfunctionID          = fun,
                    SubfunctionName        = menuItem.ChineseName,
                    SystemID               = SubSystemID,
                    SystemName             = SystemName
                };
                rfs.Add(item);
            }
            bool result = new UserVerify(RMUrl).UpdRolePermission(RoleID, rfs);

            if (result)
            {
                msg = General.Resource.Common.Success;
            }
            else
            {
                msg = General.Resource.Common.Failed;
            }
            return(string.Format("{{\"Result\":{0},\"Msg\":\"{1}\"}}"
                                 , result.ToString().ToLower(), msg));
        }