Beispiel #1
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     if (CheckData() == true)
     {
         DTO_Pet dto_pet = new DTO_Pet(txtPetID.Text, cboCustomerID.Text, txtName.Text, txtAge.Text, txtGender.Text, txtPettype.Text, txtBreed.Text, txtColor.Text, float.Parse(txtWeight.Text), txtDistinction.Text);
         if (bus_pet.Edit(dto_pet))
         {
             MessageBox.Show("EDITING SUCCESS!", "EDIT", MessageBoxButtons.OK, MessageBoxIcon.Information);
             dgvPet.DataSource = bus_pet.Display(cboCustomerID.Text);
             ResetValue();
         }
         else
         {
             MessageBox.Show("EDITING FAIL!", "EDIT", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
 }
Beispiel #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (CheckData() == true)
     {
         if (Check_PetIDtExist() == true)
         {
             DTO_Pet dto_pet = new DTO_Pet(txtPetID.Text, cboCustomerID.Text, txtName.Text, txtAge.Text, txtGender.Text, txtPettype.Text, txtBreed.Text, txtColor.Text, float.Parse(txtWeight.Text), txtDistinction.Text);
             if (bus_pet.Add(dto_pet))
             {
                 MessageBox.Show("ADDING SUCCESS!", "ADD", MessageBoxButtons.OK, MessageBoxIcon.Information);
                 dgvPet.DataSource = bus_pet.Display(cboCustomerID.Text);
                 ResetValue();
             }
             else
             {
                 MessageBox.Show("ADDING FAIL!", "ADD", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             MessageBox.Show("'    " + txtPetID.Text + "' already exists!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Beispiel #3
0
 public bool Edit(DTO_Pet dto_pet)
 {
     return(dto_pet.Edit());
 }
Beispiel #4
0
 public bool Add(DTO_Pet dto_pet)
 {
     return(dto_pet.Add());
 }