private void btOK_Click(object sender, EventArgs e) { NVKhoHang kh = new NVKhoHang(); kh.ThemKho(txbThemMaHH.Text, txbThemTenMH.Text, dateTimePicker1.Text, int.Parse(txbSLThung.Text), int.Parse(txbSp1Thung.Text), int.Parse(txbTongSLSPthung.Text), int.Parse(txbGiaDon.Text), int.Parse(txbGiaTong.Text), ref err); NVLSNhapHang ls = new NVLSNhapHang(); ls.ThemLSS(dateTimePicker1.Text, txbThemMaHH.Text, int.Parse(txbNhapSL.Text), int.Parse(txbSp1Thung.Text), int.Parse(txbGiaTong.Text), ref err); this.Hide(); }
private void button1_Click(object sender, EventArgs e) { int x = dgvKhoHang.CurrentCell.RowIndex; { if (Them) { try { int r = dgvKhoHang.CurrentCell.RowIndex; string strLH = dgvKhoHang.Rows[r].Cells[0].Value.ToString(); NVKhoHang nvlh = new NVKhoHang(); nvlh.ThemKho1(strLH, BienToanCuc.ProName, BienToanCuc.NgapNhap, BienToanCuc.Thung, BienToanCuc.SP1Thung, BienToanCuc.Don, BienToanCuc.GiaDon, BienToanCuc.GiaTong, BienToanCuc.GiaSi, BienToanCuc.GiaLe, BienToanCuc.DVT, BienToanCuc.DVT2, BienToanCuc.TongNhap, ref err); Loaddata(); MessageBox.Show("Đã Thêm Xong"); } catch { MessageBox.Show("Không Thêm Được"); } } if (float.Parse(dgvKhoHang.Rows[x].Cells[3].Value.ToString()) == 0 || float.Parse(dgvKhoHang.Rows[x].Cells[3].Value.ToString()) < 0) { try { int r = dgvKhoHang.CurrentCell.RowIndex; string strLH = dgvKhoHang.Rows[r].Cells[0].Value.ToString(); NVKhoHang nvlh = new NVKhoHang(); nvlh.xoaSPKho(ref err, strLH); Loaddata(); MessageBox.Show("Đã Xóa Xong"); } catch { MessageBox.Show("Đã Xóa Xong"); } } else { try { } catch { MessageBox.Show("Không Thêm Được"); } } } }
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!"); } } }