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); OperationRequest <Entity> .Publish(selectedEntity, EventTopicNames.SelectEntity, EventTopicNames.EntitySelected, ""); }
private void OnSelectEntityExecuted(EntityScreenItemViewModel obj) { if (!string.IsNullOrWhiteSpace(AutomationCommandName)) { var commandValue = obj.Model.EntityState; if (!string.IsNullOrWhiteSpace(AutomationCommandValue)) { commandValue = AutomationCommandValue; if (commandValue.Contains("{")) { var entity = _cacheService.GetEntityById(obj.Model.EntityId); commandValue = _printerService.ExecuteFunctions(commandValue, entity); } } _applicationState.NotifyEvent(RuleEventNames.AutomationCommandExecuted, new { Ticket = Ticket.Empty, EntityId = obj.Model.EntityId, EntityTypeId = SelectedEntityScreen.EntityTypeId, AutomationCommandName = AutomationCommandName, CommandValue = commandValue }); return; } if (obj.Model.EntityId > 0 && obj.Model.ItemId == 0) { _currentOperationRequest.Publish(_cacheService.GetEntityById(obj.Model.EntityId)); } else if (obj.Model.ItemId > 0) { ExtensionMethods.PublishIdEvent(obj.Model.ItemId, EventTopicNames.DisplayTicket); } }
public void AddOrder(ScreenMenuItemData data) { var ti = AddOrder(data.ScreenMenuItem.MenuItemId, data.Quantity, data.ScreenMenuItem.ItemPortion); if (ti != null) { UpdateOrderTags(SelectedTicket, ti.Model, data.ScreenMenuItem.OrderTags); UpdateOrderStates(SelectedTicket, ti.Model, data.ScreenMenuItem.OrderStates); ExecuteAutomationCommand(SelectedTicket, ti.Model, data.ScreenMenuItem.AutomationCommand, data.ScreenMenuItem.AutomationCommandValue); ti.UpdateItemColor(); if (data.ScreenMenuItem.AutoSelect) { ti.ToggleSelection(); if (!_applicationState.IsLandscape) { var so = new SelectedOrdersData { SelectedOrders = new List <Order> { ti.Model }, Ticket = SelectedTicket }; OperationRequest <SelectedOrdersData> .Publish(so, EventTopicNames.DisplayTicketOrderDetails, EventTopicNames.RefreshSelectedTicket, ""); } } } }
private void OnCloseAccountScreen(string obj) { AccountDetails.Clear(); if (_currentOperationRequest != null) { _currentOperationRequest.Publish(new AccountData(SelectedAccount)); } }
private void OnModifyOrder(string obj) { var so = new SelectedOrdersData { SelectedOrders = SelectedOrders, Ticket = SelectedTicket }; OperationRequest <SelectedOrdersData> .Publish(so, EventTopicNames.DisplayTicketOrderDetails, EventTopicNames.ActivatePosView, ""); }
private void OnClick(object phoneNumber) { var phone = phoneNumber.ToString(); if (string.IsNullOrEmpty(CustomerType.PrimaryFieldName) && CustomerType.EntityCustomFields.Any(x => x.Name == Resources.Phone)) phone = Resources.Phone + ":" + phone; OperationRequest<Entity>.Publish(Entity.GetNullEntity(CustomerType.Id), EventTopicNames.SelectEntity, EventTopicNames.EntitySelected, phone); }
private void OnSelectEntityExecuted(EntityScreenItemViewModel obj) { if (obj.Model.EntityId > 0 && obj.Model.ItemId == 0) { _currentOperationRequest.Publish(_cacheService.GetEntityById(obj.Model.EntityId)); } else if (obj.Model.ItemId > 0) { ExtensionMethods.PublishIdEvent(obj.Model.ItemId, EventTopicNames.DisplayTicket); } }
private void OnItemClickExecute(EntityButtonWidgetViewModel obj) { if (DesignMode) { return; } if (_applicationState.SelectedEntityScreen == null) { return; } var si = _applicationState.SelectedEntityScreen.ScreenItems.SingleOrDefault(x => x.Name == Settings.ResourceName); var resource = si != null?_cacheService.GetEntityById(si.EntityId) : Entity.GetNullEntity(_applicationState.SelectedEntityScreen.EntityTypeId); OperationRequest <Entity> .Publish(resource, EventTopicNames.EntitySelected, null, null); }
private void OnSelectedOrdersChanged(EventParameters <OrderViewModel> obj) { if (obj.Topic == EventTopicNames.SelectedOrdersChanged) { if (!obj.Value.Selected && !_ticketService.CanDeselectOrder(obj.Value.Model)) { obj.Value.ToggleSelection(); return; } if (ClearSelection) { ClearSelection = false; if (obj.Value != LastSelectedOrder) { ClearSelectedItems(); obj.Value.ToggleSelection(); return; } } LastSelectedOrder = obj.Value.Selected ? obj.Value : null; if (!SelectedOrders.Any()) { LastSelectedOrder = null; } _ticketOrdersViewModel.UpdateLastSelectedOrder(LastSelectedOrder); RefreshSelectedItems(); if (_applicationState.IsLandscape) { var so = new SelectedOrdersData { SelectedOrders = SelectedOrders, Ticket = SelectedTicket }; OperationRequest <SelectedOrdersData> .Publish(so, EventTopicNames.DisplayTicketOrderDetails, EventTopicNames.ActivatePosView, ""); } } }
private void OnClick(object phoneNumber) { string str = phoneNumber.ToString(); if (string.IsNullOrEmpty(this.CustomerType.PrimaryFieldName) && string.IsNullOrEmpty(this.SearchFormat)) { if (this.CustomerType.EntityCustomFields.Any <EntityCustomField>((EntityCustomField x) => x.Name == Resources.Phone)) { str = string.Concat(Resources.Phone, ":", str); } } if (!string.IsNullOrEmpty(this.SearchFormat)) { str = string.Format(this.SearchFormat, str); } if (!string.IsNullOrEmpty(this.DepartmentName)) { this._applicationStateSettter.SetCurrentDepartment(this.DepartmentName); } if (!string.IsNullOrEmpty(this.EntityScreenName)) { this._applicationStateSettter.SetSelectedEntityScreen(this.EntityScreenName); } if (string.IsNullOrEmpty(this.WidgetName)) { OperationRequest <Entity> .Publish(Entity.GetNullEntity(this.CustomerType.Id), EventTopicNames.SelectEntity, EventTopicNames.EntitySelected, str, false); return; } WidgetEventData widgetEventDatum = new WidgetEventData() { WidgetName = this.WidgetName, Value = str }; widgetEventDatum.PublishEvent <WidgetEventData>("SetWidgetValue"); }
private void OnRemoveEntity(string obj) { _currentEntitySelectionRequest.Publish(Entity.GetNullEntity(SelectedEntityType.Id)); }
public static void PublishEntityOperation <T>(T entity, string requestedEvent, string expectedEvent = "", string data = "") { OperationRequest <T> .Publish(entity, requestedEvent, expectedEvent, data); }