Пример #1
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (Them)
     {
         try
         {
             NVHangHoa nvlh = new NVHangHoa();
             nvlh.ThemHangHoa(BienToanCuc.ProID, BienToanCuc.ProName, BienToanCuc.SupID, BienToanCuc.DVT, BienToanCuc.GiaSi, BienToanCuc.GiaLe, BienToanCuc.Loai, ref err);
             Loaddata();
             MessageBox.Show("Đã Thêm Xong");
         }
         catch
         {
             MessageBox.Show("Không Thêm Được");
         }
     }
     else
     {
         try
         {
             int       r     = dgvHangHoa.CurrentCell.RowIndex;
             string    strLH = dgvHangHoa.Rows[r].Cells[0].Value.ToString();
             NVHangHoa nvlh  = new NVHangHoa();
             nvlh.SuaHangHoa(strLH, BienToanCuc.ProName, BienToanCuc.SupID, BienToanCuc.DVT, BienToanCuc.GiaSi, BienToanCuc.GiaLe, BienToanCuc.GiaMua, BienToanCuc.Loai, ref err);
             Loaddata();
             MessageBox.Show("Đã Sửa Xong");
         }
         catch
         {
             MessageBox.Show("Không Sửa Được");
         }
     }
 }
Пример #2
0
 private void btOK_Click(object sender, EventArgs e)
 {
     if (txbThemMaHH.Text == "" || txbThemTenMH.Text == "" || cbNCC.Text == "" || txbDVTle.Text == "" || txbSLThung.Text == "" || txbSLHangTrong1Thung.Text == "" || cbLoaiSP.Text == "" || txbSLThung.Text == "" || txbSLHangTrong1Thung.Text == "" || txbGiaCho1SP.Text == "")
     {
         MessageBox.Show("Không được để trống nội dung nào!");
     }
     else
     {
         try
         {
             NVHangHoa nvhh = new NVHangHoa();
             nvhh.ThemHangHoa(txbThemMaHH.Text, txbThemTenMH.Text, cbNCC.Text, txbDVTle.Text, float.Parse(txbGiabansi.Text), float.Parse(txbGiabanle.Text), cbLoaiSP.Text, ref err);
             NVKhoHang kh = new NVKhoHang();
             kh.ThemKho1(txbThemMaHH.Text, txbThemTenMH.Text, dateTimePicker1.Text, int.Parse(txbSLThung.Text), int.Parse(txbSLHangTrong1Thung.Text), int.Parse(txbTongSPDon.Text), int.Parse(txbGiaCho1SP.Text), int.Parse(txbGiaBanHangSi.Text), int.Parse(txbGiabansi.Text), int.Parse(txbGiabanle.Text), txbDVTle.Text, txbDVTsi.Text, int.Parse(txbTongTien.Text), ref err);
             NVLSNhapHang ls = new NVLSNhapHang();
             ls.ThemLSS(dateTimePicker1.Text, txbThemMaHH.Text, int.Parse(txbSLThung.Text), int.Parse(txbTongSPDon.Text), int.Parse(txbTongTien.Text), ref err);
             this.Hide();
         }
         catch (SqlException)
         {
             MessageBox.Show("Lỗi rồi!");
         }
     }
 }