Exemple #1
0
        private void ListByEarnings()
        {
            LaundryDb db;

            using (db = new LaundryDb())
            {
                string deliveryDate      = DeliveryDate.Substring(0, 10);
                var    dailyEarningsList = db.Tickets.Where(t => t.DeliveryDate == deliveryDate)
                                           .Select(t => new
                {
                    TicketPhone = t.Phone,
                    Income      = t.PaidAmount
                });

                DailyEarnings = new List <string>();
                foreach (var e in dailyEarningsList)
                {
                    string s = string.Format("Earnings for ticket with Phone {0}: {1}", e.TicketPhone, e.Income);
                    DailyEarnings.Add(s);
                }
                RaisePropertyChanged("DailyEarnings");
            }
        }
        private void ListTicketsNotRetrieved()
        {
            LaundryDb db;

            using (db = new LaundryDb())
            {
                string deliveryDate        = DeliveryDate.Substring(0, 10);
                var    ticketsNotRetrieved = db.Tickets.Select(t => new
                {
                    TicketPhone        = t.Phone,
                    TicketDeliveryDate = t.DeliveryDate
                })
                                             .AsEnumerable()
                                             .Where(t => HasExpired(t.TicketDeliveryDate, deliveryDate));

                TicketsNotRetrieved = new List <string>();
                foreach (var t in ticketsNotRetrieved)
                {
                    string s = string.Format("Ticket with Phone {0} should have been retrieved on {1}", t.TicketPhone, t.TicketDeliveryDate);
                    TicketsNotRetrieved.Add(s);
                }
                RaisePropertyChanged("TicketsNotRetrieved");
            }
        }