private void barButtonItem3_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { BUS_MATHANG.Xoa_MatHang(txtMaMH.Text); DialogResult dr = MessageBox.Show("Xoa thành công"); if (dr == DialogResult.OK) { LoadData(); } } catch (Exception ex) { MessageBox.Show("Lỗi" + ex.ToString()); } }
private void barButtonItem2_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { MatHangInfo mh = new MatHangInfo(txtMaMH.Text, txtTenMH.Text, float.Parse(txtSoLuong.Text), float.Parse(txtDonGia.Text), float.Parse(txtGiaBan.Text), txtTenNCC.Text, dtpNgayNhap.Value, txtMaLoaiTien.Text); BUS_MATHANG.Sua_MatHang(mh); DialogResult dr = MessageBox.Show("Sua thành công"); if (dr == DialogResult.OK) { LoadData(); } } catch (Exception ex) { MessageBox.Show("Lỗi" + ex.ToString()); } }
private void LoadData() { grcMatHang.DataSource = BUS_MATHANG.HienThi_All(); }