Exemplo n.º 1
0
 public void SubmitForm(RoleAuthorizeEntity entity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         entity.Modify(keyValue);
         service.Update(entity);
     }
     else
     {
         entity.Create();
         service.Insert(entity);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 保存权限记录
 /// </summary>
 /// <param name="moduleEntity"></param>
 /// <param name="keyValue"></param>
 public void SubmitForm(RoleAuthorizeEntity roleAuthorizeEntity, string keyValue)
 {
     if (!string.IsNullOrEmpty(keyValue))
     {
         roleAuthorizeEntity.F_Id = keyValue;
         service.Update(roleAuthorizeEntity);
     }
     else
     {
         roleAuthorizeEntity.Create();
         service.Insert(roleAuthorizeEntity);
     }
 }
Exemplo n.º 3
0
        public void SubmitForm(RoleEntity roleEntity, string[] permissionIds, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                roleEntity.F_Id = keyValue;
            }
            else
            {
                roleEntity.F_Id = Common.GuId();
                roleEntity.Create();
            }
            var moduledata = moduleApp.GetList();
            var buttondata = moduleButtonApp.GetList();
            List <RoleAuthorizeEntity> roleAuthorizeEntitys = new List <RoleAuthorizeEntity>();

            if (permissionIds?.Count() > 0)
            {
                foreach (var itemId in permissionIds)
                {
                    RoleAuthorizeEntity roleAuthorizeEntity = new RoleAuthorizeEntity();
                    roleAuthorizeEntity.F_Id         = Common.GuId();
                    roleAuthorizeEntity.F_ObjectType = 1;
                    roleAuthorizeEntity.F_ObjectId   = roleEntity.F_Id;
                    roleAuthorizeEntity.F_ItemId     = itemId;
                    if (moduledata.Find(t => t.F_Id == itemId) != null)
                    {
                        roleAuthorizeEntity.F_ItemType = 1;
                    }
                    if (buttondata.Find(t => t.F_Id == itemId) != null)
                    {
                        roleAuthorizeEntity.F_ItemType = 2;
                    }
                    roleAuthorizeEntity.Create();
                    roleAuthorizeEntitys.Add(roleAuthorizeEntity);
                }
            }
            service.SubmitForm(roleEntity, roleAuthorizeEntitys, keyValue);
        }