public DateTime CalculatePaidToDate() >> { >> // get all premiums paid >> DataSet dsPremiumsPaid = this.GetPremiumsPaid(this.Entity.PolicyHeaderFK); >> >> // work out paid to date based on issued date and premium mode >> // Monthly, Quarterly, Semi-Annually, Annually >> DateTime dt = DateTime.MinValue; >> int monthsToAdd = 0; >> if (this.Entity.IssueDate != null && dsPremiumsPaid.Tables["PremiumsPaidList"].Rows.Count > 0) >> { >> dt = (DateTime)this.Entity.IssueDate; >> >> for (int i = 0; i < dsPremiumsPaid.Tables["PremiumsPaidList"].Rows.Count; i++) >> { >> Int16 numberOfPremiums = Int16.Parse(dsPremiumsPaid.Tables["PremiumsPaidList"].Rows[i]["NumberOfPremiums"].ToString()); >> if (this.Entity.PremiumMode == "Monthly") >> monthsToAdd += 1 * numberOfPremiums; >> if (this.Entity.PremiumMode == "Quarterly") >> monthsToAdd += 3 * numberOfPremiums; >> if (this.Entity.PremiumMode == "Semi-Annually") >> monthsToAdd += 6 * numberOfPremiums; >> if (this.Entity.PremiumMode == "Annually") >> monthsToAdd += 12 * numberOfPremiums; >> } >> } >> return dt.AddMonths(monthsToAdd); >> } >>>>