예제 #1
0
 private void btnAddOutput_Click(object sender, EventArgs e)
 {
     if (txtOutputName.Text != string.Empty && txtOutputPrice.Text != string.Empty && int.Parse(txtOutputPrice.Text) > 0)
     {
         bool isExist = productOBO.isExistName(txtOutputName.Text);
         if (!isExist)
         {
             productOP       = new Data.ProductOP();
             productOP.Name  = txtOutputName.Text;
             productOP.Price = int.Parse(txtOutputPrice.Text);
             bool check = productOBO.Add(productOP);
             if (check)
             {
                 MessageBox.Show("Thêm thành công ");
             }
             else
             {
                 MessageBox.Show("Thêm thất bại");
             }
             loadInformation();
             txtOutputName.Text  = string.Empty;
             txtOutputPrice.Text = string.Empty;
         }
         else
         {
             MessageBox.Show("Hàng này đã tồn tại");
         }
     }
     else
     {
         MessageBox.Show("Không hợp lệ");
     }
 }
예제 #2
0
 private void btnEditOutput_Click(object sender, EventArgs e)
 {
     if (txtAllProductOutputName.Text != string.Empty && txtAllOutputPrice.Text != string.Empty && txtAllOutputPrice.Text != "0")
     {
         productOP       = new Data.ProductOP();
         productOP.Name  = txtAllProductOutputName.Text;
         productOP.Price = int.Parse(txtAllOutputPrice.Text);
         productOP.ID    = productOBO.GetIDByName(txtAllProductOutputName.Text);
         productOBO.Update(productOP);
         MessageBox.Show("Hệ thống cập nhật thành công");
         loadInformation();
     }
     else
     {
         MessageBox.Show("Hệ thống cập nhật thất bại");
     }
 }