public void QuickGeneratePrivilege(SystemResourcesEntity resourcesEntity) { List <SystemOperationEntity> ops = this.DataObjectsContainerIocID.SystemOperationDataObjectInstance. GetList_By_ResourceID_SystemResourcesEntity(resourcesEntity); int i = 1; foreach (SystemOperationEntity operationEntity in ops) { SystemPrivilegeEntity privilegeEntity = this.DataObjectsContainerIocID.SystemPrivilegeDataObjectInstance.FindBySystemOperation(operationEntity); if (privilegeEntity == null) { privilegeEntity = new SystemPrivilegeEntity(); privilegeEntity.ResourcesID = resourcesEntity; privilegeEntity.OperationID = operationEntity; } privilegeEntity.PrivilegeEnName = resourcesEntity.ResourcesNameEn + operationEntity.OperationNameEn; privilegeEntity.PrivilegeCnName = resourcesEntity.ResourcesNameCn + operationEntity.OperationNameCn; privilegeEntity.Description = ""; privilegeEntity.PrivilegeOrder = i; this.DataObjectsContainerIocID.SystemPrivilegeDataObjectInstance.SaveOrUpdate(privilegeEntity); i++; } }
public SystemPrivilegeEntity FindBySystemResourcesEntity(SystemResourcesEntity entity) { NHibernateDynamicQueryGenerator <SystemPrivilegeEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_RESOURCESID.Eq(entity)); return(this.FindSingleEntityByQueryBuilder(dynamicQueryGenerator)); }
public SystemOperationEntity FindByResourceAndCode(SystemResourcesEntity entity, string operationNameEn) { NHibernateDynamicQueryGenerator <SystemOperationEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_RESOURCEID.Eq(entity)); dynamicQueryGenerator.AddWhereClause(PROPERTY_OPERATIONNAMEEN.Eq(operationNameEn)); return(this.FindSingleEntityByQueryBuilder(dynamicQueryGenerator)); }
private List <SystemOperationEntity> GetAllCommonOperation(SystemResourcesEntity entity) { List <SystemOperationEntity> operationEntities = new List <SystemOperationEntity>(); operationEntities.Add(GetDefaultSystemOperationEntity(entity, "添加", "Add", "添加", false, false, true, false, false, 1)); operationEntities.Add(GetDefaultSystemOperationEntity(entity, "编辑", "Edit", "编辑", false, false, true, false, false, 2)); operationEntities.Add(GetDefaultSystemOperationEntity(entity, "删除", "Delete", "删除", false, false, true, false, false, 3)); operationEntities.Add(GetDefaultSystemOperationEntity(entity, "列表", "List", "列表", false, false, true, false, false, 4)); operationEntities.Add(GetDefaultSystemOperationEntity(entity, "打印", "Print", "打印", false, false, true, false, false, 5)); operationEntities.Add(GetDefaultSystemOperationEntity(entity, "导出", "Export", "导出", false, false, true, false, false, 6)); return(operationEntities); }
internal static SystemResourcesWrapper ConvertEntityToWrapper(SystemResourcesEntity entity) { if (entity == null) { return(null); } if (entity.ResourcesID == 0) { return(null); } return(new SystemResourcesWrapper(entity)); }
private SystemOperationEntity GetDefaultSystemOperationEntity(SystemResourcesEntity entity, string name, string code, string description, bool isCanMutilOperation, bool isCanSingleOperation, bool isInListPage, bool isInSinglePage, bool isSystemOperation, int operationOrder) { SystemOperationEntity systemOperationEntity = new SystemOperationEntity(); systemOperationEntity.OperationNameEn = code; systemOperationEntity.OperationNameCn = name; systemOperationEntity.OperationDescription = description; systemOperationEntity.IsCanMutilOperation = isCanMutilOperation; systemOperationEntity.IsCanSingleOperation = isCanSingleOperation; systemOperationEntity.IsInListPage = isInListPage; systemOperationEntity.IsInSinglePage = isInSinglePage; systemOperationEntity.IsEnable = true; systemOperationEntity.IsSystemOperation = isSystemOperation; systemOperationEntity.OperationOrder = operationOrder; systemOperationEntity.ResourceID = entity; return(systemOperationEntity); }
public void PatchAssignRolePermissionsByResourcse(SystemRoleEntity roleEntity, List <string> assignedPermissionIDs, int selectResourceId) { SystemResourcesEntity resourcesEntity = this.DataObjectsContainerIocID.SystemResourcesDataObjectInstance.Load(selectResourceId); //获取所有的权限 List <SystemPrivilegeEntity> allPrivileges = this.DataObjectsContainerIocID.SystemPrivilegeDataObjectInstance. GetList_By_ResourcesID_SystemResourcesEntity(resourcesEntity); //遍历所有的权限))) foreach (SystemPrivilegeEntity privilegesEntity in allPrivileges) { //查找是否存在对应关系 SystemPrivilegeInRolesEntity systemPrivilegeInRolesEntity = this.DataObjectsContainerIocID.SystemPrivilegeInRolesDataObjectInstance.GetRelationByRoleAndPrivilege(roleEntity, privilegesEntity); //检查是否需要保存 if (assignedPermissionIDs.Contains(privilegesEntity.PrivilegeID.ToString())) { //添加或修改对应关系 if (systemPrivilegeInRolesEntity == null) { systemPrivilegeInRolesEntity = new SystemPrivilegeInRolesEntity(); } systemPrivilegeInRolesEntity.RoleID = roleEntity; systemPrivilegeInRolesEntity.PrivilegeID = privilegesEntity; systemPrivilegeInRolesEntity.CreateTime = System.DateTime.Now; systemPrivilegeInRolesEntity.UpdateTime = System.DateTime.Now; systemPrivilegeInRolesEntity.ExpiryTime = System.DateTime.Now.AddYears(20); systemPrivilegeInRolesEntity.EnableParameter = true; systemPrivilegeInRolesEntity.EnableType = ""; systemPrivilegeInRolesEntity.PrivilegeRoleValueType = "string"; systemPrivilegeInRolesEntity.PrivilegeRoleValue = null; this.DataObjectsContainerIocID.SystemPrivilegeInRolesDataObjectInstance.SaveOrUpdate(systemPrivilegeInRolesEntity); } else { //删除对应Application下面对应的菜单角色对应关系 //如果不需要保存则删除已存在的对应关系 if (systemPrivilegeInRolesEntity != null) { this.DataObjectsContainerIocID.SystemPrivilegeInRolesDataObjectInstance.Delete(systemPrivilegeInRolesEntity); } } } }
public void QuickPatchAddOperation(SystemResourcesEntity entity) { List <SystemOperationEntity> allCommonOperation = GetAllCommonOperation(entity); foreach (SystemOperationEntity systemOperationEntity in allCommonOperation) { SystemOperationEntity findOp = this.SelfDataObj.FindByResourceAndCode(entity, systemOperationEntity. OperationNameEn); if (findOp == null) { this.SelfDataObj.Save(systemOperationEntity); } else { CopyValue(findOp, systemOperationEntity); this.SelfDataObj.Update(findOp); } } }
internal SystemResourcesWrapper(SystemResourcesEntity entityObj) { entity = entityObj; }
public List <SystemPrivilegeEntity> FindAllByResourcesID(SystemResourcesEntity _resourcesID) { return(this.SelfDataObj.GetList_By_ResourcesID_SystemResourcesEntity(_resourcesID)); }
public List <SystemPrivilegeEntity> FindAllByOrderByAndFilterAndResourcesID(string orderByColumnName, bool isDesc, SystemResourcesEntity _resourcesID, PageQueryParams pageQueryParams) { return(this.SelfDataObj.GetPageList_By_ResourcesID_SystemResourcesEntity(orderByColumnName, isDesc, _resourcesID, pageQueryParams)); }
internal SystemResourcesWrapper(SystemResourcesEntity entityObj) : base(entityObj) { }
public List <SystemPrivilegeInRolesEntity> GetRoleAssignedPermissionsByResources(SystemRoleEntity role, SystemResourcesEntity resources) { NHibernateDynamicQueryGenerator <SystemPrivilegeInRolesEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_ROLEID.Eq(role)); InClude_PrivilegeID_Query(dynamicQueryGenerator); dynamicQueryGenerator.AddWhereClause(PROPERTY_PRIVILEGEID_RESOURCESID.Eq(resources)); dynamicQueryGenerator.AddOrderBy(PROPERTY_PRIVILEGEID_PRIVILEGEORDER.Asc()); return(this.FindListByQueryBuilder(dynamicQueryGenerator)); }
public SystemPrivilegeEntity FindBySystemResourcesEntity(SystemResourcesEntity entity) { return(this.DataObjectsContainerIocID.SystemPrivilegeDataObjectInstance.FindBySystemResourcesEntity(entity)); }
public List <string> GetRoleAssignedPermissionsByResources(SystemRoleEntity role, SystemResourcesEntity resources) { List <SystemPrivilegeInRolesEntity> roleAssigedPermission = this.DataObjectsContainerIocID.SystemPrivilegeInRolesDataObjectInstance.GetRoleAssignedPermissionsByResources(role, resources); List <string> roleAssigedPermissionIDs = new List <string>(); foreach (SystemPrivilegeInRolesEntity privilegeInRolesEntity in roleAssigedPermission) { roleAssigedPermissionIDs.Add(privilegeInRolesEntity.PrivilegeID.PrivilegeID.ToString()); } return(roleAssigedPermissionIDs); }
public List <SystemPrivilegeEntity> GetList_By_ResourcesID_SystemResourcesEntity(SystemResourcesEntity fkentity) { NHibernateDynamicQueryGenerator <SystemPrivilegeEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_RESOURCESID.Eq(fkentity)); return(this.FindListByQueryBuilder(dynamicQueryGenerator)); }
public List <SystemPrivilegeEntity> GetPageList_By_ResourcesID_SystemResourcesEntity(string orderByColumnName, bool isDesc, SystemResourcesEntity fkentity, PageQueryParams pageQueryParams) { NHibernateDynamicQueryGenerator <SystemPrivilegeEntity> dynamicQueryGenerator = this.GetNewQueryBuilder(); dynamicQueryGenerator.AddWhereClause(PROPERTY_RESOURCESID.Eq(fkentity)); AddDefaultOrderByToQueryGenerator(orderByColumnName, isDesc, dynamicQueryGenerator); return(FindListByPageByQueryBuilder(dynamicQueryGenerator, pageQueryParams)); }
public List <SystemOperationEntity> FindAllByResourceID(SystemResourcesEntity _resourceID) { return(this.SelfDataObj.GetList_By_ResourceID_SystemResourcesEntity(_resourceID)); }