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


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Bill Cunnien - 16 Years Ago
Ivan George Borges - 16 Years Ago
Bill Cunnien - 16 Years Ago
Ivan George Borges - 16 Years Ago
                     Uh...that was it...:blush: Embarassing. Hey...at least, I am...
Bill Cunnien - 16 Years Ago
                         Nothing to feel embarassed at all. I'm really glad it worked for you....
Ivan George Borges - 16 Years Ago
                             [quote]Trent once almost made me wear a chicken suit on one of his...
Trent L. Taylor - 16 Years Ago
                                 [quote][b]Trent L. Taylor (01/22/2008)[/b][hr]Yeah...but let's lay the...
Ivan George Borges - 16 Years Ago
                             [quote]Trent once...made me wear a chicken suit on one of his...
Greg McGuffey - 16 Years Ago
                                 [quote][b]Greg McGuffey (01/22/2008)[/b][hr]Oh? And how is this is...
Ivan George Borges - 16 Years Ago
                                     [quote]I was tempted to say that I didn't know what you were talking...
Trent L. Taylor - 16 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search