示例#1
0
 public void SubmitForm(SysModulebutton moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.FId = keyValue;
         var LoginInfo = OperatorProvider.Provider.GetCurrent();
         if (LoginInfo != null)
         {
             moduleButtonEntity.FLastModifyUserId = LoginInfo.UserId;
         }
         moduleButtonEntity.FLastModifyTime = DateTime.Now;
         service.Update(moduleButtonEntity);
     }
     else
     {
         moduleButtonEntity.FId = Common.GuId();
         var LoginInfo = OperatorProvider.Provider.GetCurrent();
         if (LoginInfo != null)
         {
             moduleButtonEntity.FCreatorUserId = LoginInfo.UserId;
         }
         moduleButtonEntity.FCreatorTime = DateTime.Now;
         service.Insert(moduleButtonEntity);
     }
 }
 public void SubmitForm(SysModulebutton moduleButtonEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonEntity.Modify(keyValue);
         service.Update(moduleButtonEntity);
     }
     else
     {
         moduleButtonEntity.Create();
         service.Insert(moduleButtonEntity);
     }
 }
        public void SubmitCloneButton(string moduleId, string Ids)
        {
            string[] ArrayId = Ids.Split(',');
            var      data    = this.GetList();
            List <SysModulebutton> entitys = new List <SysModulebutton>();

            foreach (string item in ArrayId)
            {
                SysModulebutton moduleButtonEntity = data.Find(t => t.FId == item);
                moduleButtonEntity.FId       = Common.GuId();
                moduleButtonEntity.FModuleId = moduleId;
                entitys.Add(moduleButtonEntity);
            }
            service.SubmitCloneButton(entitys);
        }
        public bool ActionValidate(string roleId, string moduleId, string action)
        {
            var authorizeurldata = new List <AuthorizeActionModel>();
            var cachedata        = CacheFactory.Cache().GetCache <List <AuthorizeActionModel> >("authorizeurldata_" + roleId);

            if (cachedata == null)
            {
                var moduledata    = moduleApp.GetList();
                var buttondata    = moduleButtonApp.GetList();
                var authorizedata = service.IQueryable(t => t.FObjectId == roleId).ToList();
                foreach (var item in authorizedata)
                {
                    if (item.FItemType == 1)
                    {
                        SysModule moduleEntity = moduledata.Find(t => t.FId == item.FItemId);
                        authorizeurldata.Add(new AuthorizeActionModel {
                            F_Id = moduleEntity.FId, F_UrlAddress = moduleEntity.FUrlAddress
                        });
                    }
                    else if (item.FItemType == 2)
                    {
                        SysModulebutton moduleButtonEntity = buttondata.Find(t => t.FId == item.FItemId);
                        authorizeurldata.Add(new AuthorizeActionModel {
                            F_Id = moduleButtonEntity.FModuleId, F_UrlAddress = moduleButtonEntity.FUrlAddress
                        });
                    }
                }
                CacheFactory.Cache().WriteCache(authorizeurldata, "authorizeurldata_" + roleId, 5);
            }
            else
            {
                authorizeurldata = cachedata;
            }
            authorizeurldata = authorizeurldata.FindAll(t => t.F_Id.Equals(moduleId));
            foreach (var item in authorizeurldata)
            {
                if (!string.IsNullOrEmpty(item.F_UrlAddress))
                {
                    string[] url = item.F_UrlAddress.Split('?');
                    if (item.F_Id == moduleId && url[0] == action)
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }
        public List <SysModulebutton> GetButtonList(string roleId)
        {
            var data = new List <SysModulebutton>();

            if (OperatorProvider.Provider.GetCurrent().IsSystem)
            {
                data = moduleButtonApp.GetList();
            }
            else
            {
                var buttondata    = moduleButtonApp.GetList();
                var authorizedata = service.IQueryable(t => t.FObjectId == roleId && t.FItemType == 2).ToList();
                foreach (var item in authorizedata)
                {
                    SysModulebutton moduleButtonEntity = buttondata.Find(t => t.FId == item.FItemId);
                    if (moduleButtonEntity != null)
                    {
                        data.Add(moduleButtonEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.FSortCode).ToList());
        }
示例#6
0
 public ActionResult SubmitForm(SysModulebutton moduleButtonEntity, string keyValue)
 {
     moduleButtonApp.SubmitForm(moduleButtonEntity, keyValue);
     return(Success("操作成功。"));
 }