Ejemplo n.º 1
0
 protected int GetLastTicketId()
 {
     if (Tickets.Any())
     {
         return(Tickets.Last().TicketId);
     }
     return(0);
 }
Ejemplo n.º 2
0
 private string GetTicketIds()
 {
     if (Tickets.Any(x => x.IsSelected))
     {
         return(string.Join(",", Tickets.Where(x => x.IsSelected).Select(x => x.TicketId)));
     }
     return(string.Join(",", Tickets.Select(x => x.TicketId)));
 }
Ejemplo n.º 3
0
        public double CalculateTotal()
        {
            double total = 0.0;

            if (Tickets != null && Tickets.Any())
            {
                Tickets.ForEach(t => {
                    total += (double)(t.Quantity * t.PricingType.Value);
                });
            }
            return(total);
        }
Ejemplo n.º 4
0
        public void OpenPaiementDialog()
        {
            try
            {
                var Client = PosSettings.getInstance().DefaultClient.GetObject("Client");
                var paye   = new PayeTicketViewModel(CurrentTicket, Client);
                //var view = DataHelpers.container.Get<ViewManager>().CreateAndBindViewForModelIfNecessary(paye);
                var doDelete = DataHelpers.windowManager.ShowDialog(paye);



                if (doDelete == true)
                {
                    CurrentTicket.isHandled = 1;
                    CurrentTicket.Save();
                    var index = Tickets.IndexOf(CurrentTicket); // * * * *
                    Tickets.Remove(CurrentTicket);              //  * * |*| *

                    if (Tickets.Count > index)                  // 3
                    {
                        CurrentTicket = Tickets[index];
                    }
                    else if (Tickets.Count > 0)
                    {
                        CurrentTicket = Tickets[--index];
                    }
                    else
                    {
                        CurrentTicket = null;
                    }



                    // Automatic create new ticket
                    if (!Tickets.Any())
                    {
                        var ticket = new PosTicket()
                        {
                            Date       = DateTime.Now,
                            ticketType = TicketType.PREPAYE,
                            Numero     = SesssionIndex++
                        };
                        Tickets.Add(ticket);
                        CurrentTicket = ticket;
                    }

                    NotifyOfPropertyChange("Tickets");
                    NotifyOfPropertyChange("CurrentTicket");
                    //CurrentTicket?.Refresh();
                    //Tickets?.Refresh();
                    CreateCartLines();
                    MessageQueue.Enqueue("Vente terminé");
                }
                //else if (paye.MontantRecu < CurrentTicket.Total)
                //{
                //    CurrentTicket.MontantPaye += paye.MontantRecu;
                //    MessageQueue.Enqueue("PAIEMENT PARTIEL ENREGISTRÉ");

                //}

                CreateCartLines();
                if (ShowTicketsVisible)
                {
                    ShowTickets();
                }
            }
            catch (Exception s)
            {
                MessageBox.Show(s.Message);
            }
        }
Ejemplo n.º 5
0
 private bool AnyCommandExecutingOrWaiting()
 {
     return(Tickets.Any(ticketThreadObject => ticketThreadObject.Ticket.CommandTickets.Any(command =>
                                                                                           command.Status == Status.Executing || command.Status == Status.Waiting)));
 }