private void OnSelectResource(ResourceType obj) { var ticketResource = SelectedTicket.TicketResources.SingleOrDefault(x => x.ResourceTypeId == obj.Id); var selectedResource = ticketResource != null?_cacheService.GetResourceById(ticketResource.ResourceId) : Resource.GetNullResource(obj.Id); EntityOperationRequest <Resource> .Publish(selectedResource, EventTopicNames.SelectResource, EventTopicNames.ResourceSelected); }
private void OnSelectEntity(EntityType obj) { var ticketEntity = SelectedTicket.TicketEntities.SingleOrDefault(x => x.EntityTypeId == obj.Id); var selectedEntity = ticketEntity != null?_cacheService.GetEntityById(ticketEntity.EntityId) : Entity.GetNullEntity(obj.Id); EntityOperationRequest <Entity> .Publish(selectedEntity, EventTopicNames.SelectEntity, EventTopicNames.EntitySelected); }
private ResourceScreen UpdateResourceScreens(EntityOperationRequest <Resource> value) { var resourceScreens = _cacheService.GetResourceScreens().ToList(); if (!resourceScreens.Any()) { return(null); } _resourceScreens = resourceScreens.OrderBy(x => x.Order).ToList(); _resourceSwitcherButtons = null; var selectedScreen = _applicationState.SelectedResourceScreen; if (value != null && value.SelectedEntity != null && _applicationState.CurrentDepartment != null) { if (_applicationState.IsLocked) { _resourceScreens = _resourceScreens.Where(x => x.ResourceTypeId == value.SelectedEntity.ResourceTypeId).OrderBy(x => x.Order); } if (!_resourceScreens.Any()) { return(resourceScreens.ElementAt(0)); } if (selectedScreen == null || selectedScreen.ResourceTypeId != value.SelectedEntity.ResourceTypeId) { selectedScreen = _resourceScreens.First(x => x.ResourceTypeId == value.SelectedEntity.ResourceTypeId); } if (selectedScreen == null) { selectedScreen = _resourceScreens.ElementAt(0); } } return(selectedScreen ?? ResourceScreens.ElementAt(0)); }
public EntityPackTS?ConstructFromEntity([Required, FromBody] EntityOperationRequest request) { var op = request.GetOperationSymbol(request.entity.GetType()); var entity = OperationLogic.ServiceConstructFrom(request.entity, op, request.ParseArgs(op)); return(entity == null ? null : SignumServer.GetEntityPack(entity)); }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest <Resource> currentOperationRequest) { _resourceService.UpdateResourceScreen(resourceScreen); if (_currentResourceScreen != resourceScreen || Widgets == null) { _currentResourceScreen = resourceScreen; Widgets = new ObservableCollection <IDiagram>(resourceScreen.Widgets.Select(WidgetCreatorRegistry.CreateWidgetViewModel)); } Widgets.Where(x => x.AutoRefresh).ToList().ForEach(x => x.Refresh()); RaisePropertyChanged(() => Widgets); }
private void OnEditResource(EventParameters<EntityOperationRequest<Resource>> obj) { if (obj.Topic == EventTopicNames.EditResourceDetails) { _operationRequest = obj.Value; var resourceTemplate = _cacheService.GetResourceTemplateById(obj.Value.SelectedEntity.ResourceTemplateId); SelectedResource = new ResourceSearchResultViewModel(obj.Value.SelectedEntity, resourceTemplate); CustomDataViewModel = new ResourceCustomDataViewModel(obj.Value.SelectedEntity, resourceTemplate); RaisePropertyChanged(() => CustomDataViewModel); } }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest<Resource> currentOperationRequest) { _resourceService.UpdateResourceScreen(resourceScreen); if (_currentResourceScreen != resourceScreen || Widgets == null) { _currentResourceScreen = resourceScreen; Widgets = new ObservableCollection<IDiagram>(resourceScreen.Widgets.Select(WidgetCreatorRegistry.CreateWidgetViewModel)); } Widgets.Where(x => x.AutoRefresh).ToList().ForEach(x => x.Refresh()); RaisePropertyChanged(() => Widgets); }
public void Refresh(EntityScreen entityScreen, EntityOperationRequest <Entity> currentOperationRequest) { _entityService.UpdateEntityScreen(entityScreen); if (_currentEntityScreen != entityScreen || Widgets == null) { _currentEntityScreen = entityScreen; Widgets = new ObservableCollection <IDiagram>(entityScreen.Widgets.Select(x => WidgetCreatorRegistry.CreateWidgetViewModel(x, _applicationState))); } Widgets.Where(x => x.AutoRefresh).ToList().ForEach(x => x.Refresh()); RaisePropertyChanged(() => Widgets); RaisePropertyChanged(() => SelectedEntityScreen); }
private void OnDisplayAccountTransactions(EventParameters <EntityOperationRequest <AccountData> > obj) { if (obj.Topic == EventTopicNames.DisplayAccountTransactions) { var account = _accountService.GetAccountById(obj.Value.SelectedEntity.AccountId); if (obj.Value != null && !string.IsNullOrEmpty(obj.Value.GetExpectedEvent())) { _currentOperationRequest = obj.Value; } SelectedAccount = account; } }
private void OnEditResource(EventParameters <EntityOperationRequest <Resource> > obj) { if (obj.Topic == EventTopicNames.EditResourceDetails) { _operationRequest = obj.Value; var resourceType = _cacheService.GetResourceTypeById(obj.Value.SelectedEntity.ResourceTypeId); SelectedResource = new ResourceSearchResultViewModel(obj.Value.SelectedEntity, resourceType); CustomDataViewModel = new ResourceCustomDataViewModel(obj.Value.SelectedEntity, resourceType); SelectedResource.UpdateDetailedInfo(); RaisePropertyChanged(() => CustomDataViewModel); } }
private void OnEditEntity(EventParameters <EntityOperationRequest <Entity> > obj) { if (obj.Topic == EventTopicNames.EditEntityDetails) { _operationRequest = obj.Value; var entityType = _cacheService.GetEntityTypeById(obj.Value.SelectedEntity.EntityTypeId); SelectedEntity = new EntitySearchResultViewModel(obj.Value.SelectedEntity, entityType); CustomDataViewModel = new EntityCustomDataViewModel(obj.Value.SelectedEntity, entityType); //SelectedEntity.UpdateDetailedInfo(); RaisePropertyChanged(() => CustomDataViewModel); RaisePropertyChanged(() => IsEntitySelectorVisible); } }
public EntitySearchWidgetViewModel(Widget model, IApplicationState applicationState, ICacheService cacheService, IEntityService entityService) : base(model, applicationState) { _applicationState = applicationState; _cacheService = cacheService; EntitySearchViewModel = new EntitySearchViewModel(applicationState, cacheService, entityService) { IsKeyboardVisible = false }; EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<Entity>>>().Subscribe(x => { if (x.Topic == EventTopicNames.SelectEntity) { _request = x.Value; } }); }
public EntityPackTS ExecuteEntity(EntityOperationRequest request) { Entity entity; try { entity = OperationLogic.ServiceExecute(request.entity, request.operarionSymbol, request.args); } catch (IntegrityCheckException ex) { GraphExplorer.SetValidationErrors(GraphExplorer.FromRoot(request.entity), ex); this.Validate(request, "request"); throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState)); } return SignumServer.GetEntityPack(entity); }
public EntitySearchWidgetViewModel(Widget model, IApplicationState applicationState, ICacheService cacheService, IEntityService entityService) : base(model, applicationState) { _applicationState = applicationState; _cacheService = cacheService; EntitySearchViewModel = new EntitySearchViewModel(applicationState, cacheService, entityService) { IsKeyboardVisible = false }; EventServiceFactory.EventService.GetEvent <GenericEvent <EntityOperationRequest <Entity> > >().Subscribe(x => { if (x.Topic == EventTopicNames.SelectEntity) { _request = x.Value; } }); }
public ActionResult <EntityPackTS> ExecuteEntity([Required, FromBody] EntityOperationRequest request) { Entity entity; try { entity = OperationLogic.ServiceExecute(request.entity, request.GetOperationSymbol(request.entity.GetType()), request.args); } catch (IntegrityCheckException ex) { GraphExplorer.SetValidationErrors(GraphExplorer.FromRoot(request.entity), ex); this.TryValidateModel(request, "request"); return(BadRequest(this.ModelState)); } return(SignumServer.GetEntityPack(entity)); }
public EntityPackTS ExecuteEntity(EntityOperationRequest request) { Entity entity; try { entity = OperationLogic.ServiceExecute(request.entity, request.GetOperationSymbol(request.entity.GetType()), request.args); } catch (IntegrityCheckException ex) { GraphExplorer.SetValidationErrors(GraphExplorer.FromRoot(request.entity), ex); this.Validate(request, "request"); throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, this.ModelState)); } return(SignumServer.GetEntityPack(entity)); }
public void RefreshSelectedResource(EntityOperationRequest <Resource> value) { ClearSearchValues(); _currentResourceSelectionRequest = value; if (_currentResourceSelectionRequest != null && _currentResourceSelectionRequest.SelectedEntity != null && !string.IsNullOrEmpty(_currentResourceSelectionRequest.SelectedEntity.Name)) { ClearSearchValues(); if (_currentResourceSelectionRequest.SelectedEntity.Name != "*") { FoundResources.Add(new ResourceSearchResultViewModel(_currentResourceSelectionRequest.SelectedEntity, SelectedResourceType)); } } RaisePropertyChanged(() => SelectedResourceType); RaisePropertyChanged(() => SelectedResource); RaisePropertyChanged(() => ResourceTypes); }
public void RefreshSelectedEntity(EntityOperationRequest <Entity> value) { ClearSearchValues(); _currentEntitySelectionRequest = value; if (_currentEntitySelectionRequest != null && _currentEntitySelectionRequest.SelectedEntity != null && !string.IsNullOrEmpty(_currentEntitySelectionRequest.SelectedEntity.Name)) { ClearSearchValues(); if (_currentEntitySelectionRequest.SelectedEntity.Name != "*" && _currentEntitySelectionRequest.SelectedEntity.EntityTypeId == SelectedEntityType.Id) { FoundEntities.Add(new EntitySearchResultViewModel(_currentEntitySelectionRequest.SelectedEntity, SelectedEntityType)); } } RaisePropertyChanged(() => SelectedEntityType); RaisePropertyChanged(() => SelectedEntity); RaisePropertyChanged(() => EntityTypes); }
public ActionResult <EntityPackWithIssues> SaveWorkflow([Required, FromBody] EntityOperationRequest request) { WorkflowEntity entity; List <WorkflowIssue> issuesContainer = new List <WorkflowIssue>(); try { entity = ((WorkflowEntity)request.entity).Execute(WorkflowOperation.Save, (request.args.EmptyIfNull()).And(issuesContainer).ToArray()); } catch (IntegrityCheckException ex) { GraphExplorer.SetValidationErrors(GraphExplorer.FromRoot(request.entity), ex); this.TryValidateModel(request, "request"); this.ModelState.AddModelError("workflowIssues", JsonConvert.SerializeObject(issuesContainer, SignumServer.JsonSerializerSettings)); return(BadRequest(this.ModelState)); } return(new EntityPackWithIssues(SignumServer.GetEntityPack(entity), issuesContainer)); }
public EntitySwitcherViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, ICacheService cacheService, EntitySelectorView entitySelectorView, EntitySelectorViewModel entitySelectorViewModel, EntitySearchView entitySearchView, EntitySearchViewModel entitySearchViewModel, EntityDashboardView entityDashboardView, EntityDashboardViewModel entityDashboardViewModel) { _regionManager = regionManager; _applicationState = applicationState; _applicationStateSetter = applicationStateSetter; _cacheService = cacheService; _entitySelectorView = entitySelectorView; _entitySelectorViewModel = entitySelectorViewModel; _entitySearchView = entitySearchView; _entitySearchViewModel = entitySearchViewModel; _entityDashboardView = entityDashboardView; _entityDashboardViewModel = entityDashboardViewModel; SelectEntityCategoryCommand = new DelegateCommand<EntityScreen>(OnSelectEntityCategoryExecuted); EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe( x => { if (x.Topic == EventTopicNames.ResetCache) { _entityScreens = null; _entitySwitcherButtons = null; RaisePropertyChanged(() => EntitySwitcherButtons); } }); EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<Entity>>>().Subscribe(x => { if (x.Topic == EventTopicNames.SelectEntity) { var ss = UpdateEntityScreens(x.Value); _currentOperationRequest = x.Value; ActivateEntityScreen(ss); if (ss.DisplayMode == 1) _entitySearchViewModel.SearchString = x.Value.Data; } }); }
private void OnItemClickExecute(EntityButtonWidgetViewModel obj) { if (DesignMode) { return; } if (_applicationState.SelectedEntityScreen == null) { return; } var si = _applicationState.SelectedEntityScreen.ScreenItems.SingleOrDefault(x => x.Name == Settings.ResourceName); if (si == null) { return; } var resource = _cacheService.GetEntityById(si.EntityId); EntityOperationRequest <Entity> .Publish(resource, EventTopicNames.EntitySelected, null); }
public EntitySwitcherViewModel(IRegionManager regionManager, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, ICacheService cacheService, EntitySelectorView entitySelectorView, EntitySelectorViewModel entitySelectorViewModel, EntitySearchView entitySearchView, EntitySearchViewModel entitySearchViewModel, EntityDashboardView entityDashboardView, EntityDashboardViewModel entityDashboardViewModel) { _regionManager = regionManager; _applicationState = applicationState; _applicationStateSetter = applicationStateSetter; _cacheService = cacheService; _entitySelectorView = entitySelectorView; _entitySelectorViewModel = entitySelectorViewModel; _entitySearchView = entitySearchView; _entitySearchViewModel = entitySearchViewModel; _entityDashboardView = entityDashboardView; _entityDashboardViewModel = entityDashboardViewModel; SelectEntityCategoryCommand = new DelegateCommand <EntityScreen>(OnSelectEntityCategoryExecuted); EventServiceFactory.EventService.GetEvent <GenericEvent <EventAggregator> >().Subscribe( x => { if (x.Topic == EventTopicNames.ResetCache) { _entityScreens = null; _entitySwitcherButtons = null; RaisePropertyChanged(() => EntitySwitcherButtons); } }); EventServiceFactory.EventService.GetEvent <GenericEvent <EntityOperationRequest <Entity> > >().Subscribe(x => { if (x.Topic == EventTopicNames.SelectEntity) { var ss = UpdateEntityScreens(x.Value); _currentOperationRequest = x.Value; ActivateEntityScreen(ss); } }); }
public ResourceSwitcherViewModel(IRegionManager regionManager, ICacheService cacheService, IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, ResourceSelectorView resourceSelectorView, ResourceSelectorViewModel resourceSelectorViewModel, ResourceSearchView resourceSearchView, ResourceSearchViewModel resourceSearchViewModel, ResourceDashboardView resourceDashboardView, ResourceDashboardViewModel resourceDashboardViewModel) { _regionManager = regionManager; _cacheService = cacheService; _applicationState = applicationState; _applicationStateSetter = applicationStateSetter; _resourceSelectorView = resourceSelectorView; _resourceSelectorViewModel = resourceSelectorViewModel; _resourceSearchView = resourceSearchView; _resourceSearchViewModel = resourceSearchViewModel; _resourceDashboardView = resourceDashboardView; _resourceDashboardViewModel = resourceDashboardViewModel; SelectResourceCategoryCommand = new DelegateCommand<ResourceScreen>(OnSelectResourceCategoryExecuted); EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe( x => { if (x.Topic == EventTopicNames.ResetCache) { _resourceScreens = null; _resourceSwitcherButtons = null; RaisePropertyChanged(() => ResourceSwitcherButtons); } }); EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<Resource>>>().Subscribe(x => { if (x.Topic == EventTopicNames.SelectResource) { var ss = UpdateResourceScreens(x.Value); _currentOperationRequest = x.Value; ActivateResourceScreen(ss); } }); }
public ResourceSelectorViewModel(IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, IResourceService resourceService, IUserService userService, ICacheService cacheService) { _applicationState = applicationState; _applicationStateSetter = applicationStateSetter; _resourceService = resourceService; _userService = userService; _cacheService = cacheService; SelectResourceCategoryCommand = new DelegateCommand<ResourceScreen>(OnSelectResourceCategoryExecuted); ResourceSelectionCommand = new DelegateCommand<ResourceButtonViewModel>(OnSelectResourceExecuted); CloseScreenCommand = new CaptionCommand<string>(Resources.Close, OnCloseScreenExecuted); EditSelectedResourceScreenPropertiesCommand = new CaptionCommand<string>(Resources.Properties, OnEditSelectedResourceScreenProperties, CanEditSelectedResourceScreenProperties); IncPageNumberCommand = new CaptionCommand<string>(Resources.NextPage + " >>", OnIncPageNumber, CanIncPageNumber); DecPageNumberCommand = new CaptionCommand<string>("<< " + Resources.PreviousPage, OnDecPageNumber, CanDecPageNumber); EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe( x => { if (_applicationState.ActiveAppScreen == AppScreens.LocationList && x.Topic == EventTopicNames.MessageReceivedEvent && x.Value.Command == Messages.TicketRefreshMessage) { RefreshResourceScreenItems(); } }); EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<ResourceScreenItem>>>().Subscribe( x => { if (x.Topic == EventTopicNames.SelectLocation) { _currentOperationRequest = x.Value; UpdateResourceScreenItems(_applicationState.SelectedResourceScreen ?? _applicationState.CurrentDepartment.LocationScreens[0]); } }); }
private EntityScreen UpdateEntityScreens(EntityOperationRequest <Entity> value) { var entityScreens = _applicationState.IsLocked ? _applicationState.GetTicketEntityScreens().ToList() : _applicationState.GetEntityScreens().ToList(); if (!entityScreens.Any()) { return(null); } _entityScreens = entityScreens.OrderBy(x => x.SortOrder).ToList(); _entitySwitcherButtons = null; var selectedScreen = _applicationState.SelectedEntityScreen; if (value != null && value.SelectedEntity != null && _applicationState.CurrentDepartment != null) { if (_applicationState.IsLocked || _applicationState.CurrentDepartment.TicketCreationMethod == 1) { _entityScreens = _entityScreens.Where(x => x.EntityTypeId == value.SelectedEntity.EntityTypeId).OrderBy(x => x.SortOrder); } if (!_entityScreens.Any()) { return(entityScreens.ElementAt(0)); } if (selectedScreen == null || selectedScreen.EntityTypeId != value.SelectedEntity.EntityTypeId) { selectedScreen = _entityScreens.First(x => x.EntityTypeId == value.SelectedEntity.EntityTypeId); } if (selectedScreen == null) { selectedScreen = _entityScreens.ElementAt(0); } } return(selectedScreen ?? EntityScreens.ElementAt(0)); }
public void Refresh(EntityScreen entityScreen, EntityOperationRequest<Entity> currentOperationRequest) { _entityService.UpdateEntityScreen(entityScreen); if (_currentEntityScreen != entityScreen || Widgets == null) { _currentEntityScreen = entityScreen; Widgets = new ObservableCollection<IDiagram>(entityScreen.Widgets.Select(x => WidgetCreatorRegistry.CreateWidgetViewModel(x, _applicationState))); } Widgets.Where(x => x.AutoRefresh).ToList().ForEach(x => x.Refresh()); RaisePropertyChanged(() => Widgets); RaisePropertyChanged(() => SelectedEntityScreen); }
public static void PublishEntityOperation <T>(T entity, string requestedEvent, string expectedEvent = "") { EntityOperationRequest <T> .Publish(entity, requestedEvent, expectedEvent); }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest<Resource> currentOperationRequest) { SelectedResourceTemplate = _cacheService.GetResourceTemplateById(resourceScreen.ResourceTemplateId); RefreshSelectedResource(currentOperationRequest); }
private EntityScreen UpdateEntityScreens(EntityOperationRequest<Entity> value) { var entityScreens = _applicationState.IsLocked ? _applicationState.GetTicketEntityScreens().ToList() : _applicationState.GetEntityScreens().ToList(); if (!entityScreens.Any()) return null; _entityScreens = entityScreens.OrderBy(x => x.SortOrder).ToList(); _entitySwitcherButtons = null; var selectedScreen = _applicationState.SelectedEntityScreen; if (value != null && value.SelectedEntity != null && _applicationState.CurrentDepartment != null) { if (_applicationState.IsLocked || _applicationState.CurrentDepartment.TicketCreationMethod == 1) _entityScreens = _entityScreens.Where(x => x.EntityTypeId == value.SelectedEntity.EntityTypeId).OrderBy(x => x.SortOrder); if (!_entityScreens.Any()) return entityScreens.ElementAt(0); if (selectedScreen == null || selectedScreen.EntityTypeId != value.SelectedEntity.EntityTypeId) selectedScreen = _entityScreens.First(x => x.EntityTypeId == value.SelectedEntity.EntityTypeId); if (selectedScreen == null) selectedScreen = _entityScreens.ElementAt(0); } return selectedScreen ?? EntityScreens.ElementAt(0); }
public void Refresh(int resourceType, string stateFilter, EntityOperationRequest<Resource> currentOperationRequest) { StateFilter = stateFilter; SelectedResourceType = _cacheService.GetResourceTypeById(resourceType); RefreshSelectedResource(currentOperationRequest); }
private void OnDisplayAccountTransactions(EventParameters<EntityOperationRequest<AccountData>> obj) { if (obj.Topic == EventTopicNames.DisplayAccountTransactions) { var account = _accountService.GetAccountById(obj.Value.SelectedEntity.AccountId); if (obj.Value != null && !string.IsNullOrEmpty(obj.Value.GetExpectedEvent())) _currentOperationRequest = obj.Value; SelectedAccount = account; } }
public void Refresh(EntityScreen entityScreen, string stateFilter, EntityOperationRequest<Entity> currentOperationRequest) { StateFilter = stateFilter; _currentOperationRequest = currentOperationRequest; UpdateEntityScreenItems(entityScreen); }
public void DeleteEntity(EntityOperationRequest request) { OperationLogic.ServiceDelete(request.entity, request.operarionSymbol, request.args); }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest<Resource> currentOperationRequest) { StateFilter = resourceScreen.StateFilterId; SelectedResourceType = _cacheService.GetResourceTypeById(resourceScreen.ResourceTypeId); RefreshSelectedResource(currentOperationRequest); }
public EntityPackTS ConstructFromEntity(EntityOperationRequest request) { var entity = OperationLogic.ServiceConstructFrom(request.entity, request.operarionSymbol, request.args); return SignumServer.GetEntityPack(entity); }
public void RefreshSelectedResource(EntityOperationRequest<Resource> value) { ClearSearchValues(); _currentResourceSelectionRequest = value; if (_currentResourceSelectionRequest != null && _currentResourceSelectionRequest.SelectedEntity != null && !string.IsNullOrEmpty(_currentResourceSelectionRequest.SelectedEntity.Name)) { ClearSearchValues(); if (_currentResourceSelectionRequest.SelectedEntity.Name != "*") { FoundResources.Add(new ResourceSearchResultViewModel(_currentResourceSelectionRequest.SelectedEntity, SelectedResourceType)); } } RaisePropertyChanged(() => SelectedResourceType); RaisePropertyChanged(() => SelectedResource); RaisePropertyChanged(() => ResourceTypes); }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest <Resource> currentOperationRequest) { StateFilter = resourceScreen.StateFilterId; SelectedResourceType = _cacheService.GetResourceTypeById(resourceScreen.ResourceTypeId); RefreshSelectedResource(currentOperationRequest); }
public void Refresh(int entityType, string stateFilter, EntityOperationRequest <Entity> currentOperationRequest) { StateFilter = stateFilter; SelectedEntityType = _cacheService.GetEntityTypeById(entityType); RefreshSelectedEntity(currentOperationRequest); }
public void Refresh(int entityType, string stateFilter, EntityOperationRequest<Entity> currentOperationRequest) { StateFilter = stateFilter; SelectedEntityType = _cacheService.GetEntityTypeById(entityType); RefreshSelectedEntity(currentOperationRequest); }
private void OnDisplayAccountTransactions(EventParameters<EntityOperationRequest<AccountData>> obj) { if (obj.Topic == EventTopicNames.DisplayAccountTransactions) { var account = _accountService.GetAccountById(obj.Value.SelectedEntity.AccountId); _currentOperationRequest = obj.Value; SelectedAccount = account;//= new ResourceSearchResultViewModel(obj.Value.SelectedEntity, _cacheService.GetResourceTemplateById(obj.Value.SelectedEntity.AccountTemplateId)); } }
public void RefreshSelectedEntity(EntityOperationRequest<Entity> value) { ClearSearchValues(); _currentEntitySelectionRequest = value; if (_currentEntitySelectionRequest != null && _currentEntitySelectionRequest.SelectedEntity != null && !string.IsNullOrEmpty(_currentEntitySelectionRequest.SelectedEntity.Name)) { ClearSearchValues(); if (_currentEntitySelectionRequest.SelectedEntity.Name != "*" && _currentEntitySelectionRequest.SelectedEntity.EntityTypeId == SelectedEntityType.Id) { FoundEntities.Add(new EntitySearchResultViewModel(_currentEntitySelectionRequest.SelectedEntity, SelectedEntityType)); } } RaisePropertyChanged(() => SelectedEntityType); RaisePropertyChanged(() => SelectedEntity); RaisePropertyChanged(() => EntityTypes); }
private void OnEditEntity(EventParameters<EntityOperationRequest<Entity>> obj) { if (obj.Topic == EventTopicNames.EditEntityDetails) { _operationRequest = obj.Value; var entityType = _cacheService.GetEntityTypeById(obj.Value.SelectedEntity.EntityTypeId); SelectedEntity = new EntitySearchResultViewModel(obj.Value.SelectedEntity, entityType); CustomDataViewModel = new EntityCustomDataViewModel(obj.Value.SelectedEntity, entityType); SelectedEntity.UpdateDetailedInfo(); RaisePropertyChanged(() => CustomDataViewModel); RaisePropertyChanged(() => IsEntitySelectorVisible); } }
private ResourceScreen UpdateResourceScreens(EntityOperationRequest<Resource> value) { if (_applicationState.CurrentDepartment.ResourceScreens.Count == 0) return null; _resourceScreens = _applicationState.CurrentDepartment.ResourceScreens.OrderBy(x => x.Order).ToList(); _resourceSwitcherButtons = null; var selectedScreen = _applicationState.SelectedResourceScreen; if (value != null && value.SelectedEntity != null && _applicationState.CurrentDepartment != null) { if (_applicationState.IsLocked) _resourceScreens = _resourceScreens.Where(x => x.ResourceTemplateId == value.SelectedEntity.ResourceTemplateId).OrderBy(x => x.Order); if (_resourceScreens.Count() == 0) return _applicationState.CurrentDepartment.ResourceScreens.ElementAt(0); if (selectedScreen == null || selectedScreen.ResourceTemplateId != value.SelectedEntity.ResourceTemplateId) selectedScreen = _resourceScreens.Where(x => x.ResourceTemplateId == value.SelectedEntity.ResourceTemplateId).First(); if (selectedScreen == null) selectedScreen = _resourceScreens.ElementAt(0); } return selectedScreen ?? ResourceScreens.ElementAt(0); }
public EntityPackTS ConstructFromEntity(EntityOperationRequest request) { var entity = OperationLogic.ServiceConstructFrom(request.entity, request.GetOperationSymbol(request.entity.GetType()), request.args); return(entity == null ? null: SignumServer.GetEntityPack(entity)); }
public void DeleteEntity([Required, FromBody] EntityOperationRequest request) { var op = request.GetOperationSymbol(request.entity.GetType()); OperationLogic.ServiceDelete(request.entity, op, request.ParseArgs(op)); }
public void RefreshSelectedResource(EntityOperationRequest<Resource> value) { if (value != null && value.SelectedEntity != null) { if (SelectedResourceTemplate == null || SelectedResourceTemplate.Id != value.SelectedEntity.ResourceTemplateId) SelectedResourceTemplate = _cacheService.GetResourceTemplateById(value.SelectedEntity.ResourceTemplateId); ClearSearchValues(); } else if (_applicationState.CurrentDepartment != null) { var tid = _applicationState.CurrentDepartment.TicketTemplate.SaleTransactionTemplate.TargetAccountTemplateId; SelectedResourceTemplate = _cacheService.GetResourceTemplateById(tid); } _currentResourceSelectionRequest = value; if (_currentResourceSelectionRequest != null && _currentResourceSelectionRequest.SelectedEntity != null && !string.IsNullOrEmpty(_currentResourceSelectionRequest.SelectedEntity.Name)) { ClearSearchValues(); FoundResources.Add(new ResourceSearchResultViewModel(_currentResourceSelectionRequest.SelectedEntity, SelectedResourceTemplate)); } RaisePropertyChanged(() => SelectedResourceTemplate); RaisePropertyChanged(() => SelectedResource); RaisePropertyChanged(() => IsCloseButtonVisible); RaisePropertyChanged(() => ResourceTemplates); }
public void Refresh(ResourceScreen resourceScreen, string stateFilter, EntityOperationRequest<Resource> currentOperationRequest) { StateFilter = stateFilter; _currentOperationRequest = currentOperationRequest; UpdateResourceScreenItems(resourceScreen); }
public static void Publish(T selectedEntity, string requestedEvent, string expectedEvent) { var request = new EntityOperationRequest <T>(selectedEntity, expectedEvent); request.PublishEvent(requestedEvent); }
private void ActivateResourceSearcher(EntityOperationRequest<Resource> value = null) { Activate(); ((ResourceSearchViewModel)_resourceSearchView.DataContext).RefreshSelectedResource(value); _regionManager.Regions[RegionNames.MainRegion].Activate(_resourceSearchView); }
public EntityPackTS ConstructFromEntity(EntityOperationRequest request) { var entity = OperationLogic.ServiceConstructFrom(request.entity, request.operarionSymbol, request.args); return(SignumServer.GetEntityPack(entity)); }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest <Resource> currentOperationRequest) { _currentOperationRequest = currentOperationRequest; UpdateResourceScreenItems(resourceScreen); }
public void DeleteEntity([Required, FromBody] EntityOperationRequest request) { OperationLogic.ServiceDelete(request.entity, request.GetOperationSymbol(request.entity.GetType()), request.args); }
private ResourceScreen UpdateResourceScreens(EntityOperationRequest<Resource> value) { var resourceScreens = _cacheService.GetResourceScreens().ToList(); if (!resourceScreens.Any()) return null; _resourceScreens = resourceScreens.OrderBy(x => x.Order).ToList(); _resourceSwitcherButtons = null; var selectedScreen = _applicationState.SelectedResourceScreen; if (value != null && value.SelectedEntity != null && _applicationState.CurrentDepartment != null) { if (_applicationState.IsLocked) _resourceScreens = _resourceScreens.Where(x => x.ResourceTypeId == value.SelectedEntity.ResourceTypeId).OrderBy(x => x.Order); if (!_resourceScreens.Any()) return resourceScreens.ElementAt(0); if (selectedScreen == null || selectedScreen.ResourceTypeId != value.SelectedEntity.ResourceTypeId) selectedScreen = _resourceScreens.First(x => x.ResourceTypeId == value.SelectedEntity.ResourceTypeId); if (selectedScreen == null) selectedScreen = _resourceScreens.ElementAt(0); } return selectedScreen ?? ResourceScreens.ElementAt(0); }
public void Refresh(ResourceScreen resourceScreen, EntityOperationRequest<Resource> currentOperationRequest) { _currentOperationRequest = currentOperationRequest; UpdateResourceScreenItems(resourceScreen); }
public void Refresh(EntityScreen entityScreen, string stateFilter, EntityOperationRequest <Entity> currentOperationRequest) { StateFilter = stateFilter; _currentOperationRequest = currentOperationRequest; UpdateEntityScreenItems(entityScreen); }