Ejemplo n.º 1
0
 public void SubmitForm(ModuleButtonBaseEntity moduleButtonBaseEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         moduleButtonBaseEntity.Modify(keyValue);
         service.Update(moduleButtonBaseEntity);
     }
     else
     {
         moduleButtonBaseEntity.Create();
         service.Insert(moduleButtonBaseEntity);
     }
 }
Ejemplo n.º 2
0
        public void SubmitCloneButton(string moduleId, string Ids)
        {
            string[] ArrayId = Ids.Split(',');
            var      data    = this.GetList();
            List <ModuleButtonBaseEntity> entitys = new List <ModuleButtonBaseEntity>();

            foreach (string item in ArrayId)
            {
                ModuleButtonBaseEntity moduleButtonBaseEntity = data.Find(t => t.F_Id == item);
                moduleButtonBaseEntity.F_Id       = Common.Common.GuId();
                moduleButtonBaseEntity.F_ModuleId = moduleId;
                entitys.Add(moduleButtonBaseEntity);
            }
            service.SubmitCloneButton(entitys);
        }
Ejemplo n.º 3
0
        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    = _moduleService.GetList();
                var buttondata    = _moduleButtonService.GetList();
                var authorizedata = service.Queryable(t => t.F_ObjectId == roleId).ToList();
                foreach (var item in authorizedata)
                {
                    if (item.F_ItemType == 1)
                    {
                        ModuleBaseEntity moduleBaseEntity = moduledata.Find(t => t.F_Id == item.F_ItemId);
                        authorizeurldata.Add(new AuthorizeActionModel {
                            F_Id = moduleBaseEntity.F_Id, F_UrlAddress = moduleBaseEntity.F_UrlAddress
                        });
                    }
                    else if (item.F_ItemType == 2)
                    {
                        ModuleButtonBaseEntity moduleButtonBaseEntity = buttondata.Find(t => t.F_Id == item.F_ItemId);
                        authorizeurldata.Add(new AuthorizeActionModel {
                            F_Id = moduleButtonBaseEntity.F_ModuleId, F_UrlAddress = moduleButtonBaseEntity.F_UrlAddress
                        });
                    }
                }
                CacheFactory.Cache().WriteCache(authorizeurldata, "authorizeurldata_" + roleId, DateTime.Now.AddMinutes(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);
        }
Ejemplo n.º 4
0
        public List <ModuleButtonBaseEntity> GetButtonList(string roleId)
        {
            var data = new List <ModuleButtonBaseEntity>();

            if (OperatorProvider.Provider.GetCurrent().IsSystem)
            {
                data = _moduleButtonService.GetList();
            }
            else
            {
                var buttondata    = _moduleButtonService.GetList();
                var authorizedata = service.Queryable(t => t.F_ObjectId == roleId && t.F_ItemType == 2).ToList();
                foreach (var item in authorizedata)
                {
                    ModuleButtonBaseEntity moduleButtonBaseEntity = buttondata.Find(t => t.F_Id == item.F_ItemId);
                    if (moduleButtonBaseEntity != null)
                    {
                        data.Add(moduleButtonBaseEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.F_SortCode).ToList());
        }
Ejemplo n.º 5
0
 public ActionResult SubmitForm(ModuleButtonBaseEntity moduleButtonBaseEntity, string keyValue)
 {
     _moduleButtonService.SubmitForm(moduleButtonBaseEntity, keyValue);
     return(Success("操作成功。"));
 }