K
Ken
Hello All,
If this post is in the wrong place please advise.
I am following the book by Rockford Lhotka Visual Basic.Net business
objects. You would have to be familiar with this book to understand the
following. We have a windows forms application using these methods outline
in the book written in C# not VB.NET.
I have sucessfully added Broken Rules to the Broken Rules collection, but
when checking the IsValid property in the collection where the rules where
broken it always returns true, or there are no broken rules.
Can anyone please explain how to get the broken rules? or just verifiy that
the rules have been aded to the collection? I think I am missing something,
but I can't seem to figure it out. Below are excerpts of code where all of
this takes place.
This is the property that sets the Broken Rule when no Pay Statues have been
selected, tracing through this code reveals that the Broken Rule is added to
the collection:
public PayStatus PayStatus
{
get
{
return moPayStat;
}
set
{
moPayStat = value;
MarkDirty();
BrokenRules.Assert("PayStatus","At least one Payment Status
Code",this.PayStatus.ToString()=="");
}
}
Next we check the IsValid property for Broken rules in the collection: (This
always return true, even if the rule was broken)
public override bool IsValid
{
get
{
return base.BrokenRules.IsValid;
}
}
Broken Rules Collection:
private RulesCollection mRules = new RulesCollection();
public void Assert(string Rule,
string Description,
bool IsBroken)
{
if (IsBroken == true)
{
mRules.Add(Rule,Description);
}
else
{
mRules.Remove(Rule);
}
}
public bool IsValid
{
get
{
return (mRules.Count == 0);
}
}
Thank you in advance!
If this post is in the wrong place please advise.
I am following the book by Rockford Lhotka Visual Basic.Net business
objects. You would have to be familiar with this book to understand the
following. We have a windows forms application using these methods outline
in the book written in C# not VB.NET.
I have sucessfully added Broken Rules to the Broken Rules collection, but
when checking the IsValid property in the collection where the rules where
broken it always returns true, or there are no broken rules.
Can anyone please explain how to get the broken rules? or just verifiy that
the rules have been aded to the collection? I think I am missing something,
but I can't seem to figure it out. Below are excerpts of code where all of
this takes place.
This is the property that sets the Broken Rule when no Pay Statues have been
selected, tracing through this code reveals that the Broken Rule is added to
the collection:
public PayStatus PayStatus
{
get
{
return moPayStat;
}
set
{
moPayStat = value;
MarkDirty();
BrokenRules.Assert("PayStatus","At least one Payment Status
Code",this.PayStatus.ToString()=="");
}
}
Next we check the IsValid property for Broken rules in the collection: (This
always return true, even if the rule was broken)
public override bool IsValid
{
get
{
return base.BrokenRules.IsValid;
}
}
Broken Rules Collection:
private RulesCollection mRules = new RulesCollection();
public void Assert(string Rule,
string Description,
bool IsBroken)
{
if (IsBroken == true)
{
mRules.Add(Rule,Description);
}
else
{
mRules.Remove(Rule);
}
}
public bool IsValid
{
get
{
return (mRules.Count == 0);
}
}
Thank you in advance!