Messaging and Adding Broken Rules


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 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...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search