public IActionResult Index(SolutionModel model) { FilterContainer <Solution.Domain.Solution> container = FilterContainerBuilder.Build <Solution.Domain.Solution>(); container.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.Name.IsNotEmpty()) { container.And(n => n.Name == model.Name); } if (!model.IsSortBySeted) { model.SortBy = "Name"; model.SortDirection = (int)SortDirection.Asc; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Solution.Domain.Solution> result = _solutionService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; return(DynamicResult(model)); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <QueryView.Domain.QueryView> filter = FilterContainerBuilder.Build <QueryView.Domain.QueryView>(); filter.And(x => x.StateCode == RecordState.Enabled && x.IsDefault == false && x.IsPrivate == false); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled); } var data = _queryViewFinder.Query(x => x.Select(s => new { s.QueryViewId, s.Name, s.EntityId, s.AuthorizationEnabled }).Where(filter)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll()?.OrderBy(x => x.LocalizedName).ToList(); foreach (var item in entities) { var views = data.Where(x => x.EntityId == item.EntityId); if (!views.Any()) { continue; } var group1 = new PrivilegeResourceItem { Label = item.LocalizedName, Children = views.Select(x => (new PrivilegeResourceItem { Id = x.QueryViewId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList() }; result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult Index(AttributeModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <Schema.Domain.Attribute> container = FilterContainerBuilder.Build <Schema.Domain.Attribute>(); container.And(n => n.EntityId == model.EntityId); if (model.Name.IsNotEmpty()) { container.And(n => n.Name.Like(model.Name)); } if (model.AttributeTypeName != null && model.AttributeTypeName.Length > 0) { container.And(n => n.AttributeTypeName.In(model.AttributeTypeName)); } if (model.FilterSysAttribute) { container.And(n => n.Name.NotIn(AttributeDefaults.SystemAttributes)); container.And(n => n.AttributeTypeName != AttributeTypeIds.PRIMARYKEY); } if (!model.IsSortBySeted) { model.SortBy = "name"; model.SortDirection = (int)SortDirection.Asc; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Schema.Domain.Attribute> result = _attributeFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
//[HttpPost] public IActionResult Dialog(WebResourceModel model, DialogModel dm) { FilterContainer <WebResource.Domain.WebResource> container = FilterContainerBuilder.Build <WebResource.Domain.WebResource>(); container.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.SolutionId.HasValue && !model.SolutionId.Value.Equals(Guid.Empty)) { container.And(n => n.SolutionId == model.SolutionId.Value); } if (model.Name.IsNotEmpty()) { container.And(n => n.Name.Like(model.Name)); } if (model.WebResourceType.HasValue) { container.And(n => n.WebResourceType == model.WebResourceType.Value); } var result = _webResourceFinder.QueryPaged(x => x .Select(s => new { s.WebResourceId, s.WebResourceType, s.Name, s.Description, s.CreatedOn }) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; ViewData["DialogModel"] = dm; return(View(model)); }
public IActionResult Index(EntityMapModel model) { if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <EntityMap> filter = FilterContainerBuilder.Build <EntityMap>(); filter.And(x => x.ParentEntityMapId == Guid.Empty); if (!model.EntityId.Equals(Guid.Empty)) { filter.And(n => n.TargetEntityId == model.EntityId); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <EntityMap> result = _entityMapFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Index(ReportModel model) { FilterContainer <Report> filter = FilterContainerBuilder.Build <Report>(); filter.And(n => n.SolutionId == SolutionId.Value); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Report> result = _reportService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult EntityLogs(EntityLogsModel model) { model.Attributes = _attributeFinder.FindByEntityId(model.EntityId); FilterContainer <EntityLog> container = FilterContainerBuilder.Build <EntityLog>(); container.And(n => n.OrganizationId == CurrentUser.OrganizationId); container.And(n => n.EntityId == model.EntityId); if (model.OperationType.HasValue) { container.And(n => n.OperationType == model.OperationType.Value); } if (model.GetAll) { List <EntityLog> result = _entityLogService.Query(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { PagedList <EntityLog> result = _entityLogService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } return(DynamicResult(model, $"~/Views/Entity/{WebContext.ActionName}.cshtml")); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <Flow.Domain.WorkFlow> filter = FilterContainerBuilder.Build <Flow.Domain.WorkFlow>(); filter.And(x => x.StateCode == RecordState.Enabled); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled.Value); } var data = _workFlowFinder.Query(x => x.Select(s => new { s.WorkFlowId, s.Name, s.EntityId, s.AuthorizationEnabled }).Where(f => f.StateCode == Core.RecordState.Enabled)); if (data.NotEmpty()) { var result = new List <PrivilegeResourceItem>(); var entities = _entityFinder.FindAll(); foreach (var item in entities) { var attributes = data.Where(x => x.EntityId == item.EntityId); if (!attributes.Any()) { continue; } var group1 = new PrivilegeResourceItem(); group1.Label = item.LocalizedName; group1.Children = attributes.Select(x => (new PrivilegeResourceItem { Id = x.WorkFlowId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList(); result.Add(group1); } return(JOk(result)); } return(JOk()); }
public IActionResult Get([FromQuery] GetAttributesModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } FilterContainer <Schema.Domain.Attribute> container = FilterContainerBuilder.Build <Schema.Domain.Attribute>(); container.And(n => n.EntityId == model.EntityId); if (model.AttributeTypeName != null && model.AttributeTypeName.Length > 0) { container.And(n => n.AttributeTypeName.In(model.AttributeTypeName)); } List <Schema.Domain.Attribute> result = _attributeFinder.Query(x => x .Where(container) .Sort(n => n.OnFile("name").ByDirection(SortDirection.Asc)) ); if (model.FilterSysAttribute) { result.RemoveAll(n => n.IsSystemControl()); } return(JOk(result)); }
public IActionResult Index(PrivilegeModel model, bool isAutoComplete = false) { if (IsRequestJson) { if (!isAutoComplete) { FilterContainer <Privilege> filter = FilterContainerBuilder.Build <Privilege>(); filter.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.IsEnable.HasValue) { filter.And(n => n.AuthorizationEnabled == model.IsEnable.Value); } if (model.IsShowAsMenu.HasValue) { filter.And(n => n.IsVisibled == model.IsShowAsMenu.Value); } var result = _privilegeTreeBuilder.Build(x => x .Where(filter) .Sort(s => s.SortAscending(ss => ss.DisplayOrder)) ); return(JOk(result)); } else { FilterContainer <Privilege> filter = FilterContainerBuilder.Build <Privilege>(); filter.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.MethodName.IsNotEmpty()) { filter.And(n => n.MethodName.Like(model.MethodName)); } if (model.DisplayName.IsNotEmpty()) { filter.And(n => n.DisplayName.Like(model.DisplayName)); } if (model.GetAll) { var result = _privilegeService.Query(x => x .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { PagedList <Privilege> result = _privilegeService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } return(JOk(model)); } } return(View("~/Views/Security/Privileges.cshtml")); }
public IActionResult Index(RibbonButtonModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <RibbonButton.Domain.RibbonButton> filter = FilterContainerBuilder.Build <RibbonButton.Domain.RibbonButton>(); filter.And(n => n.EntityId == model.EntityId); if (model.ShowArea.HasValue) { filter.And(n => n.ShowArea == model.ShowArea.Value); } if (model.Label.IsNotEmpty()) { filter.And(n => n.Label.Like(model.Label)); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } if (!model.IsSortBySeted) { model.SortBy = "showarea"; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <RibbonButton.Domain.RibbonButton> result = _ribbonButtonFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Index(DuplicateRuleModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <DuplicateRule> filter = FilterContainerBuilder.Build <DuplicateRule>(); filter.And(n => n.EntityId == model.EntityId); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.GetAll) { List <DuplicateRule> result = _duplicateRuleFinder.Query(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <DuplicateRule> result = _duplicateRuleFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Get(Guid entityId, RibbonButtonArea?showarea) { FilterContainer <RibbonButton.Domain.RibbonButton> filter = FilterContainerBuilder.Build <RibbonButton.Domain.RibbonButton>(); filter.And(x => x.EntityId == entityId); if (showarea.HasValue) { filter.And(x => x.ShowArea == showarea.Value); } var result = _ribbonButtonFinder.Query(x => x.Where(filter)); return(JOk(result)); }
public IActionResult Get([FromQuery] RetrieveEntityModel model) { FilterContainer <Schema.Domain.Entity> filter = FilterContainerBuilder.Build <Schema.Domain.Entity>(); filter.And(x => x.OrganizationId == CurrentUser.OrganizationId); if (model.Name.NotEmpty()) { filter.And(x => x.Name.In(model.Name)); } if (model.IsAuthorization.HasValue) { filter.And(x => x.AuthorizationEnabled == model.IsAuthorization.Value); } if (model.IsCustomizable.HasValue) { filter.And(x => x.IsCustomizable == model.IsCustomizable.Value); } if (model.IsLoged.HasValue) { filter.And(x => x.LogEnabled == model.IsLoged.Value); } if (model.DuplicateEnabled.HasValue) { filter.And(x => x.DuplicateEnabled == model.DuplicateEnabled.Value); } if (model.WorkFlowEnabled.HasValue) { filter.And(x => x.WorkFlowEnabled == model.WorkFlowEnabled.Value); } if (model.BusinessFlowEnabled.HasValue) { filter.And(x => x.BusinessFlowEnabled == model.BusinessFlowEnabled.Value); } if (model.GetAll) { model.PageSize = 25000; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; List <Schema.Domain.Entity> result; if (model.SolutionId.HasValue) { var pagedResult = _entityFinder.QueryPaged(x => x .Page(1, model.PageSize) .Where(filter), model.SolutionId.Value, true); result = pagedResult.Items; } else { result = _entityFinder.Query(x => x .Where(filter)); } return(JOk(result)); }
public IActionResult Get(FilterRulesModel model) { FilterContainer <FilterRule> filter = FilterContainerBuilder.Build <FilterRule>(); //filter.And(n => n.SolutionId == this.solutionId.Value); if (!model.EntityId.Equals(Guid.Empty)) { filter.And(n => n.EntityId == model.EntityId); } if (model.GetAll) { model.Page = 1; model.PageSize = 25000; } else if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <FilterRule> result = _filterRuleFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))); model.Items = result.Items; model.TotalItems = result.TotalItems; return(JOk(model)); }
public IActionResult WorkFlowProcess(WorkFlowProcessModel model) { if (!model.IsSortBySeted) { model.SortBy = "steporder"; model.SortDirection = 0; } FilterContainer <WorkFlowProcess> filter = FilterContainerBuilder.Build <WorkFlowProcess>(); filter.And(n => n.WorkFlowInstanceId == model.WorkFlowInstanceId); if (model.GetAll) { List <WorkFlowProcess> result = _workFlowProcessFinder.Query(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { PagedList <WorkFlowProcess> result = _workFlowProcessFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } return(DynamicResult(model)); }
public IActionResult Index(DashBoardModel model) { if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <SystemForm> filter = FilterContainerBuilder.Build <SystemForm>(); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <SystemForm> result = _systemFormFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true, FormType.Dashboard); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult HomePage() { HomePageModel model = new HomePageModel(); FilterContainer <Solution.Domain.SolutionComponent> filter = FilterContainerBuilder.Build <Solution.Domain.SolutionComponent>(); filter.And(x => x.SolutionId == SolutionId.Value); var data = _solutionComponentService.Query(n => n.Select(s => new { s.SolutionComponentId, s.ComponentType, s.SolutionId }).Where(filter)); var sortedDescriptors = SolutionComponentCollection.SortedDescriptors; List <HomePageSolutionComponentModel> solutionComponents = new List <HomePageSolutionComponentModel>(); var group = data.GroupBy(x => x.ComponentType); foreach (var item in group) { var sortedDescriptor = sortedDescriptors.First(x => x.Module.Identity == item.Key); solutionComponents.Add(new HomePageSolutionComponentModel() { Name = sortedDescriptor.Module.Name, LocalizedName = sortedDescriptor.Module.LocalizedName, TotalCount = item.Count() }); } model.SolutionComponents = solutionComponents; model.SolutionId = SolutionId; return(View(model)); }
public IActionResult WorkFlowInstances(WorkFlowInstanceModel model) { if (model.WorkFlowId.Equals(Guid.Empty)) { return(NotFound()); } model.FlowInfo = _workFlowFinder.FindById(model.WorkFlowId); FilterContainer <WorkFlowInstance> filter = FilterContainerBuilder.Build <WorkFlowInstance>(); filter.And(n => n.WorkFlowId == model.WorkFlowId); if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <WorkFlowInstance> result = _workFlowInstanceService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; return(DynamicResult(model)); }
public IActionResult Get(SerialNumberModel model) { FilterContainer <SerialNumberRule> filter = FilterContainerBuilder.Build <SerialNumberRule>(); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name == model.Name); } if (model.GetAll) { model.Page = 1; model.PageSize = 25000; } else if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <SerialNumberRule> result = _serialNumberRuleFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(JOk(model)); }
public IActionResult Index(LocalizationLabelsModel model) { return(ToBePerfected()); if (!model.IsSortBySeted) { model.SortBy = "ObjectColumnName"; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; FilterContainer <LocalizedLabel> filter = FilterContainerBuilder.Build <LocalizedLabel>(); if (model.TypeCode.HasValue) { filter.And(n => n.LabelTypeCode == model.TypeCode.Value); } var result = _localizedLabelService.QueryPaged(n => n.Page(model.Page, model.PageSize) .Where(filter) .Sort(s => s.OnFile(model.SortBy).ByDirection(model.SortDirection))); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Dialog([FromBody] CustomButtonsDialogModel model) { FilterContainer <RibbonButton.Domain.RibbonButton> container = FilterContainerBuilder.Build <RibbonButton.Domain.RibbonButton>(); container.And(n => n.EntityId == model.EntityId); if (model.ButtonArea.HasValue) { container.And(n => n.ShowArea == model.ButtonArea.Value); } var result = _ribbonButtonFinder.Query(x => x .Where(container) ); model.Buttons = result; return(View(model)); }
public IActionResult Index(EntityModel model) { if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <Schema.Domain.Entity> filter = FilterContainerBuilder.Build <Schema.Domain.Entity>(); filter.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name == model.Name); } if (!model.IsSortBySeted) { model.SortBy = "Name"; model.SortDirection = (int)SortDirection.Asc; } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } if (!model.EntityGroupId.IsEmpty()) { filter.And(n => n.EntityGroups.Like(model.EntityGroupId.ToString())); } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Schema.Domain.Entity> result = _entityFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) , SolutionId.Value, true); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Get([FromQuery] RibbonButtonModel model) { if (model.EntityId.Equals(Guid.Empty)) { return(NotFound()); } var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; FilterContainer <RibbonButton.Domain.RibbonButton> filter = FilterContainerBuilder.Build <RibbonButton.Domain.RibbonButton>(); filter.And(n => n.EntityId == model.EntityId); if (model.ShowArea.HasValue) { filter.And(n => n.ShowArea == model.ShowArea.Value); } if (model.Label.IsNotEmpty()) { filter.And(n => n.Label.Like(model.Label)); } if (model.GetAll) { model.Page = 1; model.PageSize = 25000; } else if (CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <RibbonButton.Domain.RibbonButton> result = _ribbonButtonFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(JOk(model)); }
public IActionResult Get([FromQuery] OrganizationModel model) { model.EntityMeta = _entityFinder.FindByName("organization"); model.Attributes = _attributeFinder.FindByEntityId(model.EntityMeta.EntityId); FilterContainer <Organization.Domain.Organization> container = FilterContainerBuilder.Build <Organization.Domain.Organization>(); if (model.Name.IsNotEmpty()) { container.And(n => n.Name.Like(model.Name)); } if (model.Name.IsNotEmpty()) { container.And(n => n.Name.Like(model.Name)); } if (model.StatusCode.HasValue) { container.And(n => n.StatusCode == model.StatusCode.Value); } if (model.GetAll) { var result = _organizationService.Query(x => x .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result; model.TotalItems = result.Count; } else { if (!model.PageSizeBySeted) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } PagedList <Organization.Domain.Organization> result = _organizationService.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; } return(JOk(model)); }
public IActionResult GetAll([FromQuery] RoleModel model) { FilterContainer <Role> filter = FilterContainerBuilder.Build <Role>(); filter.And(n => n.OrganizationId == CurrentUser.OrganizationId); if (model.Name.IsNotEmpty()) { filter.And(n => n.Name.Like(model.Name)); } if (model.State.HasValue) { filter.And(n => n.StateCode == model.State.Value); } var result = _roleService.QueryPaged(x => x.Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))); return(JOk(result)); }
public IActionResult Index(QueryViewModel model) { var entity = _entityFinder.FindById(model.EntityId); if (entity == null) { return(NotFound()); } model.Entity = entity; if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <QueryView.Domain.QueryView> container = FilterContainerBuilder.Build <QueryView.Domain.QueryView>(); container.And(n => n.EntityId == model.EntityId); if (model.Name.IsNotEmpty()) { container.And(n => n.Name == model.Name); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <QueryView.Domain.QueryView> result = _queryViewFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(container) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection)) ); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; return(DynamicResult(model)); }
public IActionResult Index(RelationShipsModel model) { if (!model.LoadData) { return(DynamicResult(model)); } FilterContainer <Schema.Domain.RelationShip> filter = FilterContainerBuilder.Build <Schema.Domain.RelationShip>(); if (model.Type == RelationShipType.OneToMany) { filter.And(n => n.ReferencedEntityId == model.EntityId); } else if (model.Type == RelationShipType.ManyToOne) { filter.And(n => n.ReferencingEntityId == model.EntityId); } else if (model.Type == RelationShipType.ManyToMany) { filter.And(n => n.ReferencingEntityId == model.EntityId); } if (model.GetAll) { model.Page = 1; model.PageSize = WebContext.PlatformSettings.MaxFetchRecords; } else if (!model.PageSizeBySeted && CurrentUser.UserSettings.PagingLimit > 0) { model.PageSize = CurrentUser.UserSettings.PagingLimit; } model.PageSize = model.PageSize > WebContext.PlatformSettings.MaxFetchRecords ? WebContext.PlatformSettings.MaxFetchRecords : model.PageSize; PagedList <Schema.Domain.RelationShip> result = _relationShipFinder.QueryPaged(x => x .Page(model.Page, model.PageSize) .Where(filter) .Sort(n => n.OnFile(model.SortBy).ByDirection(model.SortDirection))); _relationShipFinder.WrapLocalizedLabel(result.Items); model.Items = result.Items; model.TotalItems = result.TotalItems; model.SolutionId = SolutionId.Value; model.Entity = _entityFinder.FindById(model.EntityId); return(DynamicResult(model)); }
public IActionResult PrivilegeResource(bool?authorizationEnabled) { FilterContainer <Form.Domain.SystemForm> filter = FilterContainerBuilder.Build <Form.Domain.SystemForm>(); filter.And(x => x.StateCode == Core.RecordState.Enabled && x.FormType == (int)FormType.Dashboard); if (authorizationEnabled.HasValue) { filter.And(x => x.AuthorizationEnabled == authorizationEnabled); } var data = _systemFormFinder.Query(x => x.Select(s => new { s.SystemFormId, s.Name, s.EntityId, s.AuthorizationEnabled }) .Where(filter)); if (data.NotEmpty()) { return(JOk(data.Select(x => (new PrivilegeResourceItem { Id = x.SystemFormId, Label = x.Name, AuthorizationEnabled = x.AuthorizationEnabled })).ToList())); } return(JOk()); }
public IActionResult EditEntityPlugin(Guid id) { var entity = _entityPluginFinder.FindById(id); FilterContainer <EntityPlugin> filter = FilterContainerBuilder.Build <EntityPlugin>(); filter.And(n => n.IsVisibled == true); filter.And(n => n.AssemblyName == entity.AssemblyName); EditPluginListModel model = new EditPluginListModel(); var entityPlugins = _entityPluginFinder.Query(x => x.Where(filter)); Dictionary <Guid, List <QueryView.Domain.QueryView> > queryViews = new Dictionary <Guid, List <QueryView.Domain.QueryView> >(); Dictionary <Guid, List <Form.Domain.SystemForm> > systemForms = new Dictionary <Guid, List <Form.Domain.SystemForm> >(); if (entityPlugins.NotEmpty()) { entityPlugins.Where(x => x.TypeCode != (int)PlugInType.Entity && x.TypeCode != (int)PlugInType.WorkFlow).ToList().ForEach(x => { if (x.TypeCode == (int)PlugInType.List) { var queryView = _queryViewFinder.FindById(x.EntityId); if (queryView != null && !queryViews.Keys.Contains(queryView.EntityId)) { queryViews.Add(queryView.EntityId, _queryViewFinder.FindByEntityId(queryView.EntityId)); } } else if (x.TypeCode == (int)PlugInType.Form) { var systemForm = _systemFormFinder.FindById(x.EntityId); if (systemForm != null && !systemForms.Keys.Contains(systemForm.EntityId)) { systemForms.Add(systemForm.EntityId, _systemFormFinder.FindByEntityId(systemForm.EntityId)); } } }); } model.EntityPlugins = _entityPluginFinder.Query(x => x.Where(filter)); model.PluginAnalysis = _entityPluginCreater.BeforehandLoad(entity.AssemblyName); model.QueryViews = queryViews; model.SystemForms = systemForms; model.SolutionId = SolutionId.Value; return(View(model)); }