Esempio n. 1
0
        /// <summary>
        /// Parses a typed data set of payment installments into a <see cref="PaymentSchedule"/> collection.
        /// </summary>
        /// <param name="ds">The typed data set to parse.</param>
        /// <returns>A collection representing the data contained in the data set.</returns>
        private PaymentSchedule ParsePaymentSchedule(PaymentPlanTds ds)
        {
            PaymentSchedule schedule = new PaymentSchedule(ds.PaymentSchedule.Count);

            foreach (PaymentPlanTds.PaymentScheduleRow row in ds.PaymentSchedule.Rows)
            {
                schedule.Add(new PaymentInstallment(Convert.ToUInt16(row.Number))
                {
                    AmountDue  = Convert.ToUInt32(row.Amount),
                    DueDate    = row.DueDate.Date,
                    AmountPaid = null,
                });
            }
            // TODO: what the heck is up with start date?
            DateTime startDate = DateTime.MinValue.Date;

            foreach (PaymentInstallment installment in schedule.Values)
            {
                installment.StartDate = startDate;
                startDate             = installment.DueDate.AddDays(1);
            }
            return(schedule);
        }