Exemplo n.º 1
0
        public void TransfertTicket()
        {
            if (CurrentTicket == null)
            {
                return;
            }
            var ticketType = new PosSelectViewModel(CurrentTicket, Tickets);

            var view = DataHelpers.container.Get <ViewManager>().CreateAndBindViewForModelIfNecessary(ticketType);

            DataHelpers.windowManager.ShowDialog(ticketType);

            CurrentTicket = ticketType.currentTicket;
            //CurrentTicket?.Refresh();
            //Tickets?.Refresh();
            NotifyOfPropertyChange("CurrentTicket");
            NotifyOfPropertyChange("Tickets");
            NotifyOfPropertyChange("CurrentTicket");

            NotifyOfPropertyChange("CmdStatus");
            NotifyOfPropertyChange("CmdColor");
            if (ShowTicketsVisible)
            {
                ShowTickets();
            }
        }
Exemplo n.º 2
0
        //public PosSettings settings { get; set; } = PosSettings.getInstance();
        public void AddTicket()
        {
            if (CurrentTicket != null && settings.PrintCuisineAlways && CmdStatus == "")
            {
                MessageBox.Show("ENVOYER/IMPRIMER TICKET CUISINE");
                return;
            }


            if (_EstPrepayeOnly)
            {
                CurrentTicket          = new PosTicket();
                CurrentTicket.Position = this.Position;
                this.Position++;
                CurrentTicket.ticketType = TicketType.PREPAYE;
                CurrentTicket.Numero     = SesssionIndex++;
                CurrentTicket.Date       = DateTime.Now;

                Tickets.Add(CurrentTicket);
                CreateCartLines();
                NotifyOfPropertyChange("Tickets");
                NotifyOfPropertyChange("CurrentTicket");
                NotifyOfPropertyChange("Total");

                MessageQueue.Enqueue("NOUVEAU TICKET");
                return;
            }



            var ticketType = new PosSelectViewModel();

            var view = DataHelpers.container.Get <ViewManager>().CreateAndBindViewForModelIfNecessary(ticketType);

            DataHelpers.windowManager.ShowDialog(ticketType);
            bool IsJumler = false;

            if (ticketType.ticketType == TicketType.TABLE)
            {
                if (Tickets.Where(a => a.ticketType == TicketType.TABLE && a.Numero == ticketType.Numero).Count() > 0)
                {
                    MessageBox.Show($"Mode jumeler\nUne table avec le méme numéro <TABLE-{ticketType.Numero}> existe/ouverte! ");


                    var existedTicket = Tickets.First(a => a.ticketType == TicketType.TABLE && a.Numero == ticketType.Numero);
                    CurrentTicket = existedTicket;
                    //CurrentTicket?.Refresh();
                    //Tickets?.Refresh();
                    NotifyOfPropertyChange("CurrentTicket");
                    NotifyOfPropertyChange("Tickets");

                    IsJumler = true;
                }
                else
                {
                    CurrentTicket          = new PosTicket();
                    CurrentTicket.Position = this.Position;
                    this.Position++;

                    CurrentTicket.ticketType = ticketType.ticketType;
                    CurrentTicket.Numero     = ticketType.Numero;
                }
            }
            else
            {
                CurrentTicket          = new PosTicket();
                CurrentTicket.Position = this.Position;
                this.Position++;
                CurrentTicket.ticketType = ticketType.ticketType;
                CurrentTicket.Numero     = SesssionIndex++;
            }
            CartData.Add(view);
            //CartData.Refresh();
            NotifyOfPropertyChange("CartData");

            if (settings.ListPrixParDefault != ObjectId.Empty && settings.ListPrixParDefault != null)
            {
                CurrentTicket.ListePrix = settings.ListPrixParDefault;
            }

            CurrentTicket.Date = DateTime.Now;
            if (!IsJumler)
            {
                Tickets.Add(CurrentTicket);
            }

            CreateCartLines();
            NotifyOfPropertyChange("Tickets");
            NotifyOfPropertyChange("CurrentTicket");
            NotifyOfPropertyChange("Total");
            if (ShowTicketsVisible)
            {
                ShowTickets();
            }
        }