Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Kick Start My Brain
Message
De
17/02/2011 07:01:26
 
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01500443
Message ID:
01500494
Vues:
52
>>Hi,
>>
>>using MM.NET 2.6, C#, ASP.NET, SSRS
>>
>>I have a Policy Business Object which has a method to calculate the Date the policy has been paid up to (this is done by totalling the number of premium payments that have been received). I need to display this date (as well as another calculated date: the date the next premium is/was due) on a report in SSRS.
>>
>>How should I approach this? Add Paid To Date and Next Premium Due date fields onto the Policy table? I don't like this way because of the possibility of things getting out of sync, but if there's no other way...
>
>There are a few possibilities.
>
>1. Create a view (or SP or table-valued inline function) that will get your dates.
>
>2. If these dates are used very often, add computed columns to your table.

Thanks Naomi,

this is my code in the BO:
        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);
        }
Is it easy to do this as a computed column?
Frank.

Frank Cazabon
Samaan Systems Ltd.
www.samaansystems.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform