public PaymentEditorViewModel(IApplicationState applicationState, ITicketService ticketService, IPrinterService printerService, IUserService userService, IAutomationService automationService, TicketTotalsViewModel totals) { _applicationState = applicationState; _ticketService = ticketService; _printerService = printerService; _userService = userService; _automationService = automationService; _manualPrintCommand = new CaptionCommand<PrintJob>(Resources.Print, OnManualPrint, CanManualPrint); _makePaymentCommand = new CaptionCommand<PaymentTemplate>("", OnMakePayment, CanMakePayment); _serviceSelectedCommand = new CaptionCommand<CalculationTemplate>("", OnSelectCalculationTemplate); SubmitAccountPaymentCommand = new CaptionCommand<string>(Resources.AccountBalance_r, OnSubmitAccountPayment, CanSubmitAccountPayment); ClosePaymentScreenCommand = new CaptionCommand<string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen); TenderAllCommand = new CaptionCommand<string>(Resources.All, OnTenderAllCommand); TypeValueCommand = new DelegateCommand<string>(OnTypeValueExecuted); SetValueCommand = new DelegateCommand<string>(OnSetValue); DivideValueCommand = new DelegateCommand<string>(OnDivideValue); SelectMergedItemCommand = new DelegateCommand<MergedItem>(OnMergedItemSelected); SetDiscountAmountCommand = new CaptionCommand<string>(Resources.Round, OnSetDiscountAmountCommand, CanSetDiscount); AutoSetDiscountAmountCommand = new CaptionCommand<string>(Resources.Flat, OnAutoSetDiscount, CanAutoSetDiscount); SetDiscountRateCommand = new CaptionCommand<string>(Resources.DiscountPercentSign, OnSetDiscountRateCommand, CanSetDiscountRate); MergedItems = new ObservableCollection<MergedItem>(); ReturningAmountVisibility = Visibility.Collapsed; Totals = totals; PaymentButtonGroup = new PaymentButtonGroupViewModel(_makePaymentCommand, null, ClosePaymentScreenCommand); LastTenderedAmount = "1"; }
public PaymentEditorViewModel(IApplicationState applicationState, ICacheService cacheService, IExpressionService expressionService, TicketTotalsViewModel paymentTotals, PaymentEditor paymentEditor, NumberPadViewModel numberPadViewModel, OrderSelectorViewModel orderSelectorViewModel, ITicketService ticketService, ForeignCurrencyButtonsViewModel foreignCurrencyButtonsViewModel, PaymentButtonsViewModel paymentButtonsViewModel, CommandButtonsViewModel commandButtonsViewModel, TenderedValueViewModel tenderedValueViewModel, ReturningAmountViewModel returningAmountViewModel, ChangeTemplatesViewModel changeTemplatesViewModel, AccountBalances accountBalances) { _applicationState = applicationState; _cacheService = cacheService; _expressionService = expressionService; _paymentTotals = paymentTotals; _paymentEditor = paymentEditor; _numberPadViewModel = numberPadViewModel; _orderSelectorViewModel = orderSelectorViewModel; _ticketService = ticketService; _foreignCurrencyButtonsViewModel = foreignCurrencyButtonsViewModel; _commandButtonsViewModel = commandButtonsViewModel; _tenderedValueViewModel = tenderedValueViewModel; _returningAmountViewModel = returningAmountViewModel; _changeTemplatesViewModel = changeTemplatesViewModel; _accountBalances = accountBalances; _makePaymentCommand = new CaptionCommand<PaymentType>("", OnMakePayment, CanMakePayment); _selectChangePaymentTypeCommand = new CaptionCommand<PaymentData>("", OnSelectChangePaymentType); ClosePaymentScreenCommand = new CaptionCommand<string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen); paymentButtonsViewModel.SetButtonCommands(_makePaymentCommand, null, ClosePaymentScreenCommand); }
public TicketListViewModel(IApplicationState applicationState, IApplicationStateSetter applicationStateSetter, ITicketService ticketService, IAccountService accountService, IPrinterService printerService, IResourceService locationService, IUserService userService, IAutomationService automationService, ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel, TicketTotalsViewModel totals) { _printerService = printerService; _ticketService = ticketService; _accountService = accountService; _locationService = locationService; _userService = userService; _applicationState = applicationState; _applicationStateSetter = applicationStateSetter; _automationService = automationService; _cacheService = cacheService; _ticketOrdersViewModel = ticketOrdersViewModel; _totals = totals; _selectedOrders = new ObservableCollection<Order>(); PrintJobCommand = new CaptionCommand<PrintJob>(Resources.Print, OnPrintJobExecute, CanExecutePrintJob); SelectResourceCommand = new DelegateCommand<ResourceTemplate>(OnSelectResource); AddMenuItemCommand = new DelegateCommand<ScreenMenuItemData>(OnAddMenuItemCommandExecute); CloseTicketCommand = new CaptionCommand<string>(Resources.CloseTicket_r, OnCloseTicketExecute, CanCloseTicket); MakePaymentCommand = new CaptionCommand<string>(Resources.Settle, OnMakePaymentExecute, CanMakePayment); MakeFastPaymentCommand = new CaptionCommand<PaymentTemplate>("[FastPayment]", OnMakeFastPaymentExecute, CanMakeFastPayment); ShowAllOpenTickets = new CaptionCommand<string>(Resources.AllTickets_r, OnShowAllOpenTickets); IncQuantityCommand = new CaptionCommand<string>("+", OnIncQuantityCommand, CanIncQuantity); DecQuantityCommand = new CaptionCommand<string>("-", OnDecQuantityCommand, CanDecQuantity); IncSelectionQuantityCommand = new CaptionCommand<string>("(+)", OnIncSelectionQuantityCommand, CanIncSelectionQuantity); DecSelectionQuantityCommand = new CaptionCommand<string>("(-)", OnDecSelectionQuantityCommand, CanDecSelectionQuantity); ShowTicketTagsCommand = new CaptionCommand<TicketTagGroup>(Resources.Tag, OnShowTicketsTagExecute, CanExecuteShowTicketTags); ShowOrderTagsCommand = new CaptionCommand<OrderTagGroup>(Resources.Tag, OnShowOrderTagsExecute, CanShowOrderTagsExecute); CancelItemCommand = new CaptionCommand<string>(Resources.Cancel, OnCancelItemCommand, CanCancelSelectedItems); MoveOrdersCommand = new CaptionCommand<string>(Resources.MoveTicketLine, OnMoveOrders, CanMoveOrders); EditTicketNoteCommand = new CaptionCommand<string>(Resources.TicketNote, OnEditTicketNote, CanEditTicketNote); RemoveTicketLockCommand = new CaptionCommand<string>(Resources.ReleaseLock, OnRemoveTicketLock, CanRemoveTicketLock); ChangePriceCommand = new CaptionCommand<string>(Resources.ChangePrice, OnChangePrice, CanChangePrice); PaymentButtonGroup = new PaymentButtonGroupViewModel(MakeFastPaymentCommand, MakePaymentCommand, CloseTicketCommand); EventServiceFactory.EventService.GetEvent<GenericEvent<ScreenMenuItemData>>().Subscribe(OnMenuItemSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderViewModel>>().Subscribe(OnSelectedOrdersChanged); EventServiceFactory.EventService.GetEvent<GenericEvent<TicketTagData>>().Subscribe(OnTagSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<Resource>>>().Subscribe(OnAccountSelectedForTicket); EventServiceFactory.EventService.GetEvent<GenericEvent<EntityOperationRequest<ResourceScreenItem>>>().Subscribe(OnResourceScreenItemSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnRefreshTicket); EventServiceFactory.EventService.GetEvent<GenericEvent<Message>>().Subscribe(OnMessageReceived); EventServiceFactory.EventService.GetEvent<GenericEvent<PopupData>>().Subscribe(OnAccountSelectedFromPopup); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderTagData>>().Subscribe(OnOrderTagEvent); EventServiceFactory.EventService.GetEvent<GenericEvent<MenuItemPortion>>().Subscribe(OnPortionSelected); EventServiceFactory.EventService.GetEvent<GenericIdEvent>().Subscribe(OnTicketIdPublished); }
public NumberPadViewModel(ISettingService settingService, PaymentEditor paymentEditor, TenderedValueViewModel tenderedValueViewModel, OrderSelectorViewModel orderSelectorViewModel, AccountBalances accountBalances, ForeignCurrencyButtonsViewModel foreignCurrencyButtonsViewModel, TicketTotalsViewModel paymentTotals) { _settingService = settingService; _paymentEditor = paymentEditor; _tenderedValueViewModel = tenderedValueViewModel; _orderSelectorViewModel = orderSelectorViewModel; _accountBalances = accountBalances; _foreignCurrencyButtonsViewModel = foreignCurrencyButtonsViewModel; _paymentTotals = paymentTotals; TenderAllCommand = new CaptionCommand<string>(Resources.All, OnTenderAllCommand); ChangeBalanceModeCommand = new DelegateCommand<string>(OnChangeBalanceMode); TypeValueCommand = new DelegateCommand<string>(OnTypeValueExecuted); SetValueCommand = new DelegateCommand<string>(OnSetValue); DivideValueCommand = new DelegateCommand<string>(OnDivideValue); }
public TicketViewModel(IApplicationState applicationState, ITicketService ticketService, IAccountService accountService, IResourceService locationService, IUserService userService, IAutomationService automationService, ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel, TicketTotalsViewModel totals, TicketInfoViewModel ticketInfoViewModel, PaymentButtonViewModel paymentButtonViewModel) { _ticketService = ticketService; _userService = userService; _applicationState = applicationState; _automationService = automationService; _cacheService = cacheService; _ticketOrdersViewModel = ticketOrdersViewModel; _totals = totals; _ticketInfo = ticketInfoViewModel; _paymentButtonViewModel = paymentButtonViewModel; SelectResourceCommand = new DelegateCommand<ResourceType>(OnSelectResource, CanSelectResource); ExecuteAutomationCommnand = new DelegateCommand<CommandContainerButton>(OnExecuteAutomationCommand, CanExecuteAutomationCommand); IncQuantityCommand = new CaptionCommand<string>("+", OnIncQuantityCommand, CanIncQuantity); DecQuantityCommand = new CaptionCommand<string>("-", OnDecQuantityCommand, CanDecQuantity); IncSelectionQuantityCommand = new CaptionCommand<string>("(+)", OnIncSelectionQuantityCommand, CanIncSelectionQuantity); DecSelectionQuantityCommand = new CaptionCommand<string>("(-)", OnDecSelectionQuantityCommand, CanDecSelectionQuantity); ShowTicketTagsCommand = new CaptionCommand<TicketTagGroup>(Resources.Tag, OnShowTicketsTagExecute, CanExecuteShowTicketTags); ShowOrderStatesCommand = new CaptionCommand<OrderStateGroup>(Resources.Tag, OnShowOrderStatesExecute, CanShowOrderStatesExecute); ShowOrderTagsCommand = new CaptionCommand<OrderTagGroup>(Resources.Tag, OnShowOrderTagsExecute, CanShowOrderTagsExecute); CancelItemCommand = new CaptionCommand<string>(Resources.Cancel, OnCancelItemCommand); MoveOrdersCommand = new CaptionCommand<string>(Resources.MoveTicketLine, OnMoveOrders, CanMoveOrders); EditTicketNoteCommand = new CaptionCommand<string>(Resources.TicketNote, OnEditTicketNote, CanEditTicketNote); RemoveTicketLockCommand = new CaptionCommand<string>(Resources.ReleaseLock, OnRemoveTicketLock, CanRemoveTicketLock); ChangePriceCommand = new CaptionCommand<string>(Resources.ChangePrice, OnChangePrice, CanChangePrice); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderViewModel>>().Subscribe(OnSelectedOrdersChanged); EventServiceFactory.EventService.GetEvent<GenericEvent<TicketTagData>>().Subscribe(OnTagSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnRefreshTicket); EventServiceFactory.EventService.GetEvent<GenericEvent<PopupData>>().Subscribe(OnAccountSelectedFromPopup); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderTagData>>().Subscribe(OnOrderTagEvent); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderStateData>>().Subscribe(OnOrderStateEvent); EventServiceFactory.EventService.GetEvent<GenericEvent<MenuItemPortion>>().Subscribe(OnPortionSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<Department>>().Subscribe(OnDepartmentChanged); SelectedTicket = Ticket.Empty; }
public PaymentEditorViewModel(ITicketService ticketService, ICacheService cacheService, IAccountService accountService, IUserService userService, IAutomationService automationService, TicketTotalsViewModel totals) { _ticketService = ticketService; _cacheService = cacheService; _accountService = accountService; _userService = userService; _automationService = automationService; _executeAutomationCommand = new CaptionCommand<AutomationCommandData>("", OnExecuteAutomationCommand, CanExecuteAutomationCommand); _makePaymentCommand = new CaptionCommand<PaymentTemplate>("", OnMakePayment, CanMakePayment); _serviceSelectedCommand = new CaptionCommand<CalculationSelector>("", OnSelectCalculationSelector, CanSelectCalculationSelector); ClosePaymentScreenCommand = new CaptionCommand<string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen); TenderAllCommand = new CaptionCommand<string>(Resources.All, OnTenderAllCommand); TypeValueCommand = new DelegateCommand<string>(OnTypeValueExecuted); SetValueCommand = new DelegateCommand<string>(OnSetValue); DivideValueCommand = new DelegateCommand<string>(OnDivideValue); SelectMergedItemCommand = new DelegateCommand<MergedItem>(OnMergedItemSelected); SetDiscountAmountCommand = new CaptionCommand<string>(Resources.Round, OnSetDiscountAmountCommand, CanSetDiscount); AutoSetDiscountAmountCommand = new CaptionCommand<string>(Resources.Flat, OnAutoSetDiscount, CanAutoSetDiscount); SetDiscountRateCommand = new CaptionCommand<string>(Resources.DiscountPercentSign, OnSetDiscountRateCommand, CanSetDiscountRate); MergedItems = new ObservableCollection<MergedItem>(); ReturningAmountVisibility = Visibility.Collapsed; Totals = totals; PaymentButtonGroup = new PaymentButtonGroupViewModel(_makePaymentCommand, null, ClosePaymentScreenCommand); LastTenderedAmount = "1"; EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(x => { if (SelectedTicket != null && x.Topic == EventTopicNames.CloseTicketRequested) { SelectedTicket = null; } }); }
public TicketViewModel(IApplicationState applicationState, IExpressionService expressionService, ITicketService ticketService, IAccountService accountService, IEntityServiceClient locationService, IUserService userService, ICacheService cacheService, TicketOrdersViewModel ticketOrdersViewModel, TicketTotalsViewModel totals, TicketInfoViewModel ticketInfoViewModel) { _ticketService = ticketService; _userService = userService; _cacheService = cacheService; _applicationState = applicationState; _expressionService = expressionService; _ticketOrdersViewModel = ticketOrdersViewModel; _totals = totals; _ticketInfo = ticketInfoViewModel; SelectEntityCommand = new DelegateCommand<EntityType>(OnSelectEntity, CanSelectEntity); ExecuteAutomationCommnand = new DelegateCommand<CommandContainerButton>(OnExecuteAutomationCommand, CanExecuteAutomationCommand); IncQuantityCommand = new CaptionCommand<string>("+", OnIncQuantityCommand, CanIncQuantity); DecQuantityCommand = new CaptionCommand<string>("-", OnDecQuantityCommand, CanDecQuantity); IncSelectionQuantityCommand = new CaptionCommand<string>("(+)", OnIncSelectionQuantityCommand, CanIncSelectionQuantity); DecSelectionQuantityCommand = new CaptionCommand<string>("(-)", OnDecSelectionQuantityCommand, CanDecSelectionQuantity); ShowTicketTagsCommand = new CaptionCommand<TicketTagGroup>(Resources.Tag, OnShowTicketsTagExecute, CanExecuteShowTicketTags); CancelItemCommand = new CaptionCommand<string>(Resources.Cancel, OnCancelItemCommand); MoveOrdersCommand = new CaptionCommand<string>(Resources.MoveTicketLine, OnMoveOrders, CanMoveOrders); EditTicketNoteCommand = new CaptionCommand<string>(Resources.TicketNote.Replace(" ", Environment.NewLine), OnEditTicketNote, CanEditTicketNote); RemoveTicketLockCommand = new CaptionCommand<string>(Resources.ReleaseLock, OnRemoveTicketLock, CanRemoveTicketLock); ChangePriceCommand = new CaptionCommand<string>(Resources.ChangePrice, OnChangePrice, CanChangePrice); AddOrderCommand = new CaptionCommand<string>(Resources.AddOrder.Replace(" ", Environment.NewLine), OnAddOrder, CanAddOrder); ModifyOrderCommand = new CaptionCommand<string>(Resources.ModifyOrder.Replace(" ", Environment.NewLine), OnModifyOrder, CanModifyOrder); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderViewModel>>().Subscribe(OnSelectedOrdersChanged); EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(OnRefreshTicket); EventServiceFactory.EventService.GetEvent<GenericEvent<OrderTagData>>().Subscribe(OnOrderTagEvent); EventServiceFactory.EventService.GetEvent<GenericEvent<MenuItemPortion>>().Subscribe(OnPortionSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<Department>>().Subscribe(OnDepartmentChanged); EventServiceFactory.EventService.GetEvent<GenericEvent<AutomationCommandValueData>>().Subscribe(OnAutomationCommandValueSelected); EventServiceFactory.EventService.GetEvent<GenericEvent<AutomationCommandData>>().Subscribe(OnAutomationCommandSelected); SelectedTicket = Ticket.Empty; }
public PaymentEditorViewModel(ITicketService ticketService, ICacheService cacheService, IAccountService accountService, ISettingService settingService, IAutomationService automationService, TicketTotalsViewModel totals, IApplicationStateSetter applicationStateSetter) { _ticketService = ticketService; _cacheService = cacheService; _accountService = accountService; _settingService = settingService; _automationService = automationService; _applicationStateSetter = applicationStateSetter; _executeAutomationCommand = new CaptionCommand<AutomationCommandData>("", OnExecuteAutomationCommand, CanExecuteAutomationCommand); _makePaymentCommand = new CaptionCommand<PaymentType>("", OnMakePayment, CanMakePayment); _selectChangePaymentTypeCommand = new CaptionCommand<PaymentData>("", OnSelectChangePaymentType); _serviceSelectedCommand = new CaptionCommand<CalculationSelector>("", OnSelectCalculationSelector, CanSelectCalculationSelector); _foreignCurrencySelectedCommand = new CaptionCommand<ForeignCurrency>("", OnForeignCurrencySelected); ClosePaymentScreenCommand = new CaptionCommand<string>(Resources.Close, OnClosePaymentScreen, CanClosePaymentScreen); ChangeTemplates = new ObservableCollection<CommandButtonViewModel<PaymentData>>(); ReturningAmountVisibility = Visibility.Collapsed; Totals = totals; PaymentButtonGroup = new PaymentButtonGroupViewModel(_makePaymentCommand, null, ClosePaymentScreenCommand); ForeignCurrencyButtons = new List<CommandButtonViewModel<ForeignCurrency>>(); NumberPadViewModel = new NumberPadViewModel(); NumberPadViewModel.TypedValueChanged += NumberPadViewModelTypedValueChanged; NumberPadViewModel.ResetValue += NumberPadViewModelResetValue; NumberPadViewModel.PaymentDueChanged += NumberPadViewModelPaymentDueChanged; OrderSelector = new OrderSelectorViewModel(new OrderSelector(), NumberPadViewModel); EventServiceFactory.EventService.GetEvent<GenericEvent<EventAggregator>>().Subscribe(x => { if (SelectedTicket != null && x.Topic == EventTopicNames.CloseTicketRequested) { SelectedTicket = null; } }); }
public PaymentTotalsView(TicketTotalsViewModel viewModel) { DataContext = viewModel; InitializeComponent(); }