Esempio n. 1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (ValidateChildren(ValidationConstraints.Enabled))
     {
         _personDetails.name     = txtName.Text;
         _personDetails.address  = txtAddress.Text;
         _personDetails.rpid     = Convert.ToInt32(cmbPersons.SelectedIndex) + 1;
         _personDetails.mobile1  = txtMobile1.Text;
         _personDetails.mobile2  = txtMobile2.Text;
         _personDetails.email    = txtEmail.Text;
         _personDetails.comments = txtComments.Text;
         var result = _personBL.InsertPersonDetails(_personDetails);
         if (result > 0)
         {
             string            message     = string.Format("Person Details: {0} registered successfully!", txtName.Text);
             string            title       = "Registered Successfully";
             MessageBoxButtons buttons     = MessageBoxButtons.OK;
             DialogResult      _confirmBox = MessageBox.Show(message, title, buttons);
             if (_confirmBox == DialogResult.OK)
             {
                 txtName.Text             = string.Empty;
                 txtAddress.Text          = string.Empty;
                 txtMobile1.Text          = string.Empty;
                 txtMobile2.Text          = string.Empty;
                 cmbPersons.SelectedIndex = 0;
                 txtEmail.Text            = string.Empty;
                 txtComments.Text         = string.Empty;
             }
         }
     }
 }