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); }
public EntityPostRequest ToDeleteRequest() { EntityPostRequest post = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = this }; post.AppendConditionMap(this.ID, () => this.ID); return(post); }
static EntityPostRequest BuilddeleteRoleRequest(string roleid) { TeamRole role = new TeamRole(roleid, string.Empty); EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = role }; request.AppendConditionMap(role.ID, () => role.ID); return(request); }
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); }
static EntityPostRequest BuilddeleteDroitRequest(string resourceid) { DroitResource oldResource = new DroitResource(Guid.NewGuid().ToString()) { ResourceName = resourceid }; EntityPostRequest oldPostRequest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = oldResource }; oldPostRequest.AppendConditionMap(oldResource.ResourceName, () => oldResource.ResourceName); return oldPostRequest; }
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); }
static EntityPostRequest BuilddeleteDroitRequest(string resourceid) { DroitResource oldResource = new DroitResource(Guid.NewGuid().ToString()) { ResourceName = resourceid }; EntityPostRequest oldPostRequest = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = oldResource }; oldPostRequest.AppendConditionMap(oldResource.ResourceName, () => oldResource.ResourceName); return(oldPostRequest); }
static EntityPostRequest BuilddeleteUserRoleRequest(string roleid) { UserRoleMap ur = new UserRoleMap() { RoleID = roleid }; EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = ur }; request.AppendConditionMap(ur.RoleID, () => ur.RoleID); return(request); }
static EntityPostRequest BuilddeleteRoleDroitsRequest(string roleid) { DroitResource dr = new DroitResource(string.Empty) { RoleID = roleid }; EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = dr }; request.AppendConditionMap(dr.RoleID, () => dr.RoleID); return(request); }
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); }
static EntityPostRequest BuilddeleteRoleRequest(string userid, string roleid) { UserRoleMap role = new UserRoleMap() { RoleID = roleid, UserID = userid }; EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = role }; request.AppendConditionMap(role.UserID, () => role.UserID); request.AppendConditionMap(role.RoleID, () => role.RoleID); return(request); }
/// <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; }
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)); } }
static void RegisterFactor_DeleteDroits(BizTransaction transaction, string RoleID) { IEntityRequestProcess deleteRoleDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp"); TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> > deleteRoleDroitsFactor = new TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> >(deleteRoleDroitsProcessor); deleteRoleDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) => { contract.UpdateEntity(request); }; deleteRoleDroitsFactor.Action = (Action <IEntityRequestProcess, EntityPostRequest> action) => { EntityPostRequest deleteRoleDroitRequest = BuilddeleteRoleDroitsRequest(RoleID); action(deleteRoleDroitsProcessor, deleteRoleDroitRequest); }; transaction.RegisterFactor(deleteRoleDroitsFactor); }
static void RegisterFactor_UserState(BizTransaction transaction, BzureUser user) { IEntityRequestProcess userStateProcessor = Actor.Public.BuildEntityProcessor("SecurityApp"); TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> > userStateFactor = new TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> >(userStateProcessor); userStateFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) => { contract.UpdateEntity(request); }; userStateFactor.Action = (Action <IEntityRequestProcess, EntityPostRequest> action) => { EntityPostRequest OrderRequest = BuilderUserStateRequest(user); action(userStateProcessor, OrderRequest); }; transaction.RegisterFactor(userStateFactor); }
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)); } }
static void RegisterFactor_DeleteRoles(BizTransaction transaction, BzureUser user, string[] oldRoles) { IEntityRequestProcess deleteRolesProcessor = Actor.Public.BuildEntityProcessor("SecurityApp"); TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> > deleteRolesFactor = new TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> >(deleteRolesProcessor); deleteRolesFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) => { contract.UpdateEntity(request); }; deleteRolesFactor.Action = (Action <IEntityRequestProcess, EntityPostRequest> action) => { foreach (string roleid in oldRoles) { EntityPostRequest deleteRoleRequest = BuilddeleteRoleRequest(user.UserID.ToString(), roleid); action(deleteRolesProcessor, deleteRoleRequest); } }; transaction.RegisterFactor(deleteRolesFactor); }
static void RegisterFactor_AddNewDroits(BizTransaction transaction, string ResourceName, DroitResource[] droits) { IEntityRequestProcess addDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp"); TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> > addDroitsFactor = new TransactionFactor <IEntityRequestProcess, Action <IEntityRequestProcess, EntityPostRequest> >(addDroitsProcessor); addDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) => { contract.UpdateEntity(request); }; addDroitsFactor.Action = (Action <IEntityRequestProcess, EntityPostRequest> action) => { foreach (DroitResource droit in droits) { EntityPostRequest addDroitRequest = BuildaddDroitRequest(ResourceName, droit); action(addDroitsProcessor, addDroitRequest); } }; transaction.RegisterFactor(addDroitsFactor); }
/// <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); }
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; }
static EntityPostRequest BuilddeleteUserRoleRequest(string roleid) { UserRoleMap ur = new UserRoleMap() { RoleID = roleid }; EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = ur }; request.AppendConditionMap(ur.RoleID, () => ur.RoleID); return request; }
static EntityPostRequest BuilddeleteRoleDroitsRequest(string roleid) { DroitResource dr = new DroitResource(string.Empty) { RoleID = roleid }; EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = dr }; request.AppendConditionMap(dr.RoleID, () => dr.RoleID); return request; }
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; }
static EntityPostRequest BuilddeleteRoleRequest(string userid, string roleid) { UserRoleMap role = new UserRoleMap() { RoleID = roleid, UserID = userid }; EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = role }; request.AppendConditionMap(role.UserID, () => role.UserID); request.AppendConditionMap(role.RoleID, () => role.RoleID); return request; }
static EntityPostRequest BuilddeleteRoleRequest(string roleid) { TeamRole role = new TeamRole(roleid, string.Empty); EntityPostRequest request = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = role }; request.AppendConditionMap(role.ID, () => role.ID); return request; }
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; }
public EntityPostRequest ToDeleteRequest() { EntityPostRequest post = new EntityPostRequest(EntityPostRequest.EntityPostMethod.Delete) { Entity = this }; post.AppendConditionMap(this.ID, () => this.ID); return post; }