Пример #1
0
        private void LoadActiveReservations()
        {
            activeReservationsTable.Rows.Clear();
            RentalManager manager = new RentalManager(new UnitOfWork(new RentalContext()));

            foreach (Reservation reservation in manager.GetActiveReservations())
            {
                DomainLayer.Domain.Invoice invoice = manager.GetInvoice(reservation.InvoiceID);
                Client client    = manager.GetClient(reservation.ClientID);
                string clientStr = client.FirstName + " " + client.LastName;
                if (!string.IsNullOrWhiteSpace(client.CompanyName))
                {
                    clientStr = "(" + client.CompanyName + ") " + clientStr;
                }
                AddActiveReservationsRow(reservation.ID, clientStr, reservation.ReservationDate, reservation.ReservedUntil, char.ToUpper(reservation.Arrangement.ToString().ToLower()[0]) + reservation.Arrangement.ToString().ToLower().Substring(1), reservation.StartLocation, reservation.EndLocation, string.Format("€{0:0.00}", invoice.TotalInc), (invoice.PaymentDue == 0) ? "Paid" : "Unpaid");
            }
        }