Exemple #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (CheckData() == true)
     {
         if (Check_CustomerIDtExist() == true)
         {
             DTO_Customer dto_cus = new DTO_Customer(txtCustomerID.Text, txtName.Text, Birthday.Value.ToShortDateString(), txtGender.Text, txtAddress.Text, txtEmail.Text, txtPhonenumber.Text);
             if (bus_cus.Add(dto_cus))
             {
                 MessageBox.Show("ADDING SUCCESS!", "ADD", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 LoadData();
                 ResetValues();
             }
             else
             {
                 MessageBox.Show("ADDING FAIL!", "ADD", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         else
         {
             MessageBox.Show("'    " + txtCustomerID.Text + "' already exists!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }