Esempio n. 1
0
 private void btnAddInput_Click(object sender, EventArgs e)
 {
     if (txtInputName.Text != string.Empty && txtInputPrice.Text != string.Empty && int.Parse(txtInputPrice.Text) > 0)
     {
         bool isExist = productIBO.isExistName(txtInputName.Text);
         if (!isExist)
         {
             productIP       = new Data.ProductIP();
             productIP.Name  = txtInputName.Text;
             productIP.Price = int.Parse(txtInputPrice.Text);
             bool check = productIBO.Add(productIP);
             if (check)
             {
                 MessageBox.Show("Thêm thành công ");
             }
             else
             {
                 MessageBox.Show("Thêm thất bại");
             }
             loadInformation();
             txtInputName.Text  = string.Empty;
             txtInputPrice.Text = string.Empty;
         }
         else
         {
             MessageBox.Show("Hàng này đã tồn tại");
         }
     }
     else
     {
         MessageBox.Show("Không hợp lệ");
     }
 }