Ejemplo n.º 1
0
 private void btnAddProduct_Click(object sender, EventArgs e)
 {
     if (cbCategori.SelectedItem == null)
     {
         MessageBox.Show("chưa chọn danh mục");
         cbCategori.Focus();
     }
     else
     {
         int ID = categoryBLL.getID(cbCategori.Text);
         if (openFileDialog1.FileName == null)
         {
             MessageBox.Show("Chưa chọn ảnh");
         }
         else
         {
             try
             {
                 if (productbll.getcountitem(txtProduct.Text) == 0)
                 {
                     productbll.Insertproduct(txtProduct.Text, openFileDialog1.FileName, Int32.Parse(txtprice.Text), Int32.Parse(cbSize.Text), cbBrand.Text, colorpro, "nam", Int32.Parse(nudAmount.Text), txtDesc.Text, ID);
                     listProduct.hienthi();
                     this.Close();
                 }
                 else
                 {
                     MessageBox.Show("Trùng tên sản phẩm", "Thông báo");
                 }
             }
             catch (Exception)
             {
                 MessageBox.Show("sai kiểu dữ liệu", "lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void btnAddProduct_Click(object sender, EventArgs e)
        {
            int ID = categoryBLL.getID(cbCategori.Text);

            productbll.Insertproduct(txtProduct.Text, "a", Int32.Parse(txtprice.Text), Int32.Parse(cbSize.Text), cbBrand.Text, int.Parse(cbColor.Text), true, cbMaterial.Text, Int32.Parse(txtamount.Text), txtDesc.Text, txtDesc.Text, ID);
        }