Пример #1
0
 private void btnAddBr_Click(object sender, EventArgs e)
 {
     try
     {
         dataLayer = new DataLayer();
         if (txtAddress.Text.Trim() != string.Empty && txtFname.Text.Trim() != string.Empty && txtLname.Text.Trim() != string.Empty)
         {
             #region verify same Borrower in DB
             // If it is not Duplicate Entry , Add it to DB
             if (!(dataLayer.IsDuplicateBorrower(txtFname.Text.Trim(), txtLname.Text.Trim(), txtAddress.Text.Trim())))
             {
                 int cardNumber = dataLayer.AddNewBorrwoer(txtFname.Text.Trim(), txtLname.Text.Trim(), txtAddress.Text.Trim(), txtPhone.Text.Trim(), txtCity.Text.Trim(), txtState.Text.Trim());
                 txtPhone.Text      = string.Empty;
                 txtAddress.Text    = string.Empty;
                 txtFname.Text      = string.Empty;
                 txtLname.Text      = string.Empty;
                 txtState.Text      = string.Empty;
                 txtCity.Text       = string.Empty;
                 errorBorrower.Text = Constants.NewBRAdded + cardNumber;
                 errorBorrower.Show();
             }
             else
             {
                 errorBorrower.Text = Constants.DuplicateBR;
                 errorBorrower.Show();
             }
             #endregion
         }
         else
         {
             errorBorrower.Text = Constants.RequiredFields;
             errorBorrower.Show();
         }
     }
     catch (Exception ex)
     {
         errorBorrower.Text = Constants.Error + ex.Message;
     }
 }