Messaging and Adding Broken Rules


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I have decided to put my duplicate part number checking in the business object.  Well, that's where it belongs, anyway, right?

Here is my code:

private void PartsBO_CheckRulesOnCurrentRow(CheckRulesEventArgs e)
{
   
if (IsDuplicatePartNumber())
    {
       
this.AddBrokenRuleByKey(this.partnum, "DuplicatePartNumber");
    }
}

private Boolean IsDuplicatePartNumber()
{
   
SqlCommand mCommand = new SqlCommand();
    mCommand.CommandText =
"SELECT COUNT(*) FROM PartsMaster WHERE partnum = @partnum AND partindex != @partindex";
    mCommand.Parameters.Add(
new SqlParameter("@partnum", SqlDbType.VarChar));
    mCommand.Parameters.Add(
new SqlParameter("@partindex", SqlDbType.Int));
    mCommand.Parameters[
"@partnum"].Value = this.partnum;
    mCommand.Parameters[
"@partindex"].Value = this.partindex;
   
return ((int)ExecuteScalar(mCommand) > 0);
}

The window will let me know that a rule is broken.  But it does not say which rule, which field, nor does my beautifully crafted message pop up.  How do I get the window to do two things:  1)  Mark the field that is having the problem; and 2)  show my message.

Thanks!
Bill


Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Bill.

On this line:

        this.AddBrokenRuleByKey(this.partnum, "DuplicatePartNumber");

try this:

        this.AddBrokenRuleByKey(PartsBOFieldNames.partnum, "DuplicatePartNumber");

Hope it helps.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Great!  That helps for part one.  Now, how do I get the window to recognize the localization message involved?  It has the alert icon next to the field now, which alerts the user.  The tooltip looks like it is trying to present my custom message, but it is filled with some coding that will scare the average user.

Thanks, again, Ivan!  You are a big help!
Bill

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Bill.

I'm glad it is working, you are welcome. Cool

Regarding the message, I think you should be passing a "Text values" key, not a
"Messages key" from your Messaging Project. Is that the case?

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Uh...that was it...Blush

Embarassing.

Hey...at least, I am learning!  w00t w00t w00t

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Nothing to feel embarassed at all. I'm really glad it worked for you.

Trent once almost made me wear a chicken suit on one of his classes. How is that for an embarassing situation? BigGrin

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Trent once almost made me wear a chicken suit on one of his classes. How is that for an embarassing situation?

Yeah...but let's lay the foundation as of why...Ivan had offered to all attendees that I buy the beer...or something along those lines...isn't that right, Ivan? Wink

Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.5K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Trent once...made me wear a chicken suit on one of his classes.




Oh? And how is this is different from your normal dress? Blink w00t Wink
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Trent L. Taylor (01/22/2008)
Yeah...but let's lay the foundation as of why...Ivan had offered to all attendees that I buy the beer...or something along those lines...isn't that right, Ivan? Wink

Hum... I was tempted to say that I didn't know what you were talking about, but then I realized I don't have administrative priviledges to delete posts on the forum. Tongue

Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Greg McGuffey (01/22/2008)
Oh? And how is this is different from your normal dress? Blink w00t Wink

Well, usually I don't wear any... Tongue

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