Exemple #1
0
        private Invoice DataRowToInvoice(DataRow dr)
        {
            Invoice result = new Invoice(
                Convert.ToInt16(dr.Field <decimal>("ID")),
                new EmployeeRepository().GetEmployeeByID(Convert.ToInt16(dr.Field <decimal>("EmployeeID"))),
                new CustomerRepository().GetCustomerByID(Convert.ToInt16(dr.Field <decimal>("CustomerID"))),
                dr.Field <decimal>("CashPayment"),
                dr.Field <DateTime>("MeetingDate"),
                dr.Field <string>("Status"),
                dr.Field <DateTime>("LastChangeDate"),
                new RentableRepository().GetRentablesForInvoice(Convert.ToInt16(dr.Field <decimal>("ID"))),
                dr.Field <string>("Type")
                );

            if (dr["SentDate"] != DBNull.Value)
            {
                result.AddSentDate(dr.Field <DateTime>("SentDate"));
            }
            return(result);
        }