Esempio n. 1
0
        public void Save()
        {
            EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Update)
            {
                Entity = this.Entity
            };

            request.AppendConditionMap(this.Entity.TemplateKey, () => this.Entity.TemplateKey);
            request.AppendFieldMap(this.Entity.Expression, () => this.Entity.Expression);
            request.AppendFieldMap(this.Entity.Value, () => this.Entity.Value);
            Actor.Public.BuildEntityProcessor(ConfigTemplateSource.Name).UpdateEntity(request);
        }
Esempio n. 2
0
        static EntityPostRequest BuildaddDroitRequest(string ResourceName, DroitResource resource)
        {
            EntityPostRequest postRequest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
            {
                Entity = resource
            };

            postRequest.AppendFieldMap(resource.ResourceID, () => resource.ResourceID);
            postRequest.AppendFieldMap(resource.ResourceName, () => resource.ResourceName);
            postRequest.AppendFieldMap(resource.RoleID, () => resource.RoleID);
            postRequest.AppendFieldMap(resource.RightValue, () => resource.RightValue);
            postRequest.AppendFieldMap(resource.State, () => resource.State);
            return(postRequest);
        }
Esempio n. 3
0
        public EntityPostRequest ToUpdateRequest()
        {
            EntityPostRequest request;

            if (this.IsPersisted())
            {
                request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Update)
                {
                    Entity = this
                };
                request.AppendConditionMap(this.ID, () => this.ID);
            }
            else
            {
                request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
                {
                    Entity = this
                };
                request.AppendFieldMap(this.ID, () => this.ID);
            }
            request.AppendFieldMap(this.UserID, () => this.UserID);
            request.AppendFieldMap(this.BindID, () => this.BindID);
            request.AppendFieldMap(this.BindProvider, () => this.BindProvider);
            return(request);
        }
Esempio n. 4
0
        static EntityPostRequest BuildaddRoleRequest(string userid, string roleid)
        {
            UserRoleMap role = new UserRoleMap()
            {
                RoleID = roleid,
                UserID = userid
            };
            EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
            {
                Entity = role
            };

            request.AppendFieldMap(role.UserID, () => role.UserID);
            request.AppendFieldMap(role.RoleID, () => role.RoleID);
            return(request);
        }
Esempio n. 5
0
 /// <summary>
 /// 创建新角色,不允许角色名重复
 /// </summary>
 /// <param name="Public"></param>
 /// <param name="RoleName"></param>
 /// <param name="RoleDescription"></param>
 /// <returns></returns>
 public static TeamRole CreateRole(this Public Public, string RoleName, string RoleDescription)
 {
     if (Actor.Public.GetRoleByName(RoleName).IsNotNullAndEmpty())
     {
         return default(TeamRole);
     }
     TeamRole factor = new TeamRole(Actor.Public .AsUserManager ().GenerateRoleID(), RoleName) { RoleDescription = RoleDescription };
     EntityPostRequest createquest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
     {
         Entity = factor
     };
     createquest.AppendFieldMap(factor.ID, () => factor.ID);
     createquest.AppendFieldMap(factor.Name, () => factor.Name);
     createquest.AppendFieldMap(factor.RoleDescription, () => factor.RoleDescription);
     Actor.Public.BuildEntityProcessor("SecurityApp").UpdateEntity(createquest);
     return factor;
 }
Esempio n. 6
0
        /// <summary>
        /// 创建新角色,不允许角色名重复
        /// </summary>
        /// <param name="Public"></param>
        /// <param name="RoleName"></param>
        /// <param name="RoleDescription"></param>
        /// <returns></returns>
        public static TeamRole CreateRole(this Public Public, string RoleName, string RoleDescription)
        {
            if (Actor.Public.GetRoleByName(RoleName).IsNotNullAndEmpty())
            {
                return(default(TeamRole));
            }
            TeamRole factor = new TeamRole(Actor.Public.AsUserManager().GenerateRoleID(), RoleName)
            {
                RoleDescription = RoleDescription
            };
            EntityPostRequest createquest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
            {
                Entity = factor
            };

            createquest.AppendFieldMap(factor.ID, () => factor.ID);
            createquest.AppendFieldMap(factor.Name, () => factor.Name);
            createquest.AppendFieldMap(factor.RoleDescription, () => factor.RoleDescription);
            Actor.Public.BuildEntityProcessor("SecurityApp").UpdateEntity(createquest);
            return(factor);
        }
Esempio n. 7
0
 static EntityPostRequest BuilderUserStateRequest(BzureUser user)
 {
     if (user.IsPersisted())
     {
         EntityPostRequest userStateRequest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Update)
         {
             Entity = user
         };
         userStateRequest.AppendFieldMap(user.State, () => user.State);
         userStateRequest.AppendConditionMap(user.UserID, () => user.UserID);
         return(userStateRequest);
     }
     else
     {
         throw new Exception(string.Format("用户{0}还没有保存", user.UserName));
     }
 }
Esempio n. 8
0
        static EntityPostRequest BuilderUserStateRequest(BzureUser user)
        {
            if (user.IsPersisted())
            {
                EntityPostRequest userStateRequest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Update)
                {
                    Entity = user
                };
                userStateRequest.AppendFieldMap(user.State, () => user.State);
                userStateRequest.AppendConditionMap(user.UserID, () => user.UserID);
                return userStateRequest;
            }
            else
            {
                throw new Exception(string.Format("用户{0}还没有保存", user.UserName));
            }

        }
Esempio n. 9
0
 public void Save()
 {
     EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Update)
     {
         Entity = this.Entity
     };
     request.AppendConditionMap(this.Entity.TemplateKey, () => this.Entity.TemplateKey);
     request.AppendFieldMap(this.Entity.Expression, () => this.Entity.Expression);
     request.AppendFieldMap(this.Entity.Value, () => this.Entity.Value);
     Actor.Public.BuildEntityProcessor(ConfigTemplateSource.Name).UpdateEntity(request);
 }
Esempio n. 10
0
 static EntityPostRequest BuildaddDroitRequest(string ResourceName, DroitResource resource)
 {
     EntityPostRequest postRequest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
     {
         Entity = resource
     };
     postRequest.AppendFieldMap(resource.ResourceID, () => resource.ResourceID);
     postRequest.AppendFieldMap(resource.ResourceName, () => resource.ResourceName);
     postRequest.AppendFieldMap(resource.RoleID, () => resource.RoleID);
     postRequest.AppendFieldMap(resource.RightValue, () => resource.RightValue);
     postRequest.AppendFieldMap(resource.State, () => resource.State);
     return postRequest;
 }
Esempio n. 11
0
 public EntityPostRequest ToUpdateRequest()
 {
     EntityPostRequest request;
     if (this.IsPersisted())
     {
         request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Update)
         {
             Entity = this
         };
         request.AppendConditionMap(this.ID, () => this.ID);
     }
     else
     {
         request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
         {
             Entity = this
         };
         request.AppendFieldMap(this.ID, () => this.ID);
     }
     request.AppendFieldMap(this.UserID, () => this.UserID);
     request.AppendFieldMap(this.BindID, () => this.BindID);
     request.AppendFieldMap(this.BindProvider, () => this.BindProvider);
     return request;
 }
Esempio n. 12
0
 static EntityPostRequest BuildaddRoleRequest(string userid, string roleid)
 {
     UserRoleMap role = new UserRoleMap()
     {
         RoleID = roleid,
         UserID = userid
     };
     EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Create)
     {
         Entity = role
     };
     request.AppendFieldMap(role.UserID, () => role.UserID);
     request.AppendFieldMap(role.RoleID, () => role.RoleID);
     return request;
 }