Custom Property Not Updating


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I have seven integer fields from my table represented in a business object.  One custom property adds the values and returns the total (int).  A second custom property determines the percentage (total points / total available) -- called rating.  A third custom property references the percentage and presents a letter grade (A, B, C, or D).  Rather simple.  If I click new on the form, the defaults work fine (all int fields maxed at 10, total points is 70, the rating is 100% and the grade is 'A').  The moment I change a value in any one of the seven integer fields, the total points and the rating are zeroed out.  The grade always reverts to the lowest possible choice.  What are the possible reasons that my custom fields are not updating properly?


[Browsable(false),
BusinessFieldDisplayInEditor(),
Description("Total Points"),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int TotalPoints
{
   
get
   
{
       
int mTotalPoints = ontimedelivery + complaints + returns + scrap + profitability + convenience + growthpotential;
       
return mTotalPoints;
    }
}

[
Browsable(false),
BusinessFieldDisplayInEditor(),
Description("Rating"),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public double Rating
{
   
get
   
{
       
double mRating = (double)(TotalPoints / 70);
       
return mRating;
    }
}

[
Browsable(false),
BusinessFieldDisplayInEditor(),
Description("Grade"),
DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public String Grade
{
   
get
   
{
       
if (Rating >= 0.91) { return "A"; }
       
if (Rating >= 0.81) { return "B"; }
       
if (Rating >= 0.71) { return "C"; }
       
return "D";
    }
}

Thanks!
Bill

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search