/// <summary> /// Parses a typed data set of plan payments into a <see cref="PlanPaymentHistory"/> 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 PlanPaymentHistory ParsePlanPaymentHistory(PaymentPlanTds ds) { PlanPaymentHistory history = new PlanPaymentHistory(ds.PlanPayments.Count); foreach (PaymentPlanTds.PlanPaymentsRow row in ds.PlanPayments.Rows) { ushort checkNumber; if (ushort.TryParse(row.CheckNumber, out checkNumber)) { history.Add(new PlanPayment() { Amount = Convert.ToUInt32(row.Amount), CheckNumber = checkNumber, Date = row.Date, Type = CPConvert.ToPaymentType(row.TransactionCode.Trim()) }); } } return(history); }