StrataFrame Forum
Back
Login
Login
Home
»
StrataFrame Application Framework - V1
»
Business Objects and Data Access (How do I?)
»
Custom Property Not Updating
Custom Property Not Updating
Post Reply
Like
0
Custom Property Not Updating
View
Flat Ascending
Flat Descending
Threaded
Options
Subscribe to topic
Print This Topic
RSS Feed
Goto Topics Forum
Author
Message
Bill Cunnien
Bill Cunnien
posted 17 Years Ago
ANSWER
Topic Details
Share Topic
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
Reply
Like
0
GO
Merge Selected
Merge into selected topic...
Merge into merge target...
Merge into a specific topic ID...
Open Merge
Threaded View
Threaded View
Custom Property Not Updating
Bill Cunnien
-
17 Years Ago
Hi Bill, I would put a breakpoint at the TotalPoints to see what are...
Edhy Rijo
-
17 Years Ago
Yes...the Rating is coming up as zero for anything less than 70 (70/70...
Bill Cunnien
-
17 Years Ago
This works: [codesnippet] public double Rating { get {...
Bill Cunnien
-
17 Years Ago
It looks like a type problem, I use VB instead of C#, but I guess this...
Edhy Rijo
-
17 Years Ago
Nope, it won't. In VB, the concept works (dividing two integers,...
Greg McGuffey
-
17 Years Ago
Post Reply
Like
0
Similar Topics
Post Quoted Reply
Reading This Topic
Login
Login
Remember Me
Reset Password
Resend Validation Email
Login
Explore
Messages
Mentions
Search