Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
        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 PaymentButtonView(PaymentButtonViewModel viewModel)
 {
     DataContext = viewModel;
     InitializeComponent();
 }
Exemplo n.º 4
0
 public PaymentButtonView(PaymentButtonViewModel viewModel)
 {
     DataContext = viewModel;
     InitializeComponent();
 }