示例#1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateChildren(ValidationConstraints.Enabled))
     {
         _person.name     = txtpname.Text;
         _person.comments = txtComments.Text;
         var result = _personBL.InsertPersons(_person);
         if (result > 0)
         {
             string            message     = string.Format("Person: {0} registered successfully!", txtpname.Text);
             string            title       = "Registered Successfully";
             MessageBoxButtons buttons     = MessageBoxButtons.OK;
             DialogResult      _confirmBox = MessageBox.Show(message, title, buttons);
             if (_confirmBox == DialogResult.OK)
             {
                 txtpname.Text    = string.Empty;
                 txtComments.Text = string.Empty;
             }
         }
     }
 }