private void btnThanhToan_Click(object sender, EventArgs e) { try { if (ValidData()) { if (HoaDon == null) { HoaDon = new SuDungHoaDonInfor(); HoaDon.KyHieu = txtKyHieu.Text.Trim().ToUpper(); HoaDon.SoBatDau = Common.IntValue(txtSoBatDau.Text); HoaDon.SoKetThuc = Common.IntValue(txtSoKetThuc.Text); HoaDon.SoHienTai = Common.IntValue(txtSoHienTai.Text); HoaDon.SoConLai = Common.IntValue(txtSoConLai.Text); } KyHieu = txtKyHieu.Text.Trim().ToUpper(); SoBatDau = Common.IntValue(txtSoBatDau.Text); SoKetThuc = Common.IntValue(txtSoKetThuc.Text); SoHienTai = Common.IntValue(txtSoHienTai.Text); SoConLai = Common.IntValue(txtSoConLai.Text); this.DialogResult = DialogResult.OK; } } catch (Exception) { MessageBox.Show("Thông tin thanh toán không hợp lệ. Xin mời nhập lại!"); } }
public int Insert(SuDungHoaDonInfor hoaDon) { ExecuteCommand(Declare.StoreProcedureNamespace.spSuDungHoaDonInSert, hoaDon.IdQuyen, hoaDon.IdNhanVien, hoaDon.KyHieu, hoaDon.SoBatDau, hoaDon.SoKetThuc, hoaDon.SoHienTai, hoaDon.SoConLai); return(Common.IntValue(Parameters["p_IdQuyen"].Value)); }
private void EditObject(SuDungHoaDonInfor hoadon) { frmCS_KhaiBaoHoaDonByUser frm = new frmCS_KhaiBaoHoaDonByUser(hoadon); frm.ShowDialog(); LoadAllHoaDon(); }
private void cmdXoaChiTiet_Click(object sender, EventArgs e) { try { if (gvHoaDon.FocusedRowHandle < 0) { return; } if (MessageBox.Show("Bạn có chắc chắn xóa mục này không ?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (gvHoaDon.GetSelectedRows().Length == 0 && gvHoaDon.FocusedRowHandle >= 0) { SuDungHoaDonInfor hd = (SuDungHoaDonInfor)gvHoaDon.GetRow(gvHoaDon.FocusedRowHandle); if (hd != null && hd.SoConLai <= 0) { liHoaDonDeleted.Add(hd); } } else { foreach (int t in gvHoaDon.GetSelectedRows()) { SuDungHoaDonInfor hd = (SuDungHoaDonInfor)gvHoaDon.GetRow(t); if (hd != null) { liHoaDonDeleted.Add(hd); } } } gvHoaDon.DeleteSelectedRows(); } } catch { } }
private void EditObject(int rowHandle) { if (rowHandle < 0) { return; } SuDungHoaDonInfor hoadon = (SuDungHoaDonInfor)gvHoaDon.GetRow(rowHandle); EditObject(hoadon); }
private void cmdXoaChiTiet_Click(object sender, EventArgs e) { try { if (gvHoaDon.FocusedRowHandle < 0) { return; } if (MessageBox.Show("Bạn có chắc chắn xóa mục này không ?", "Thông Báo", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (selector.SelectedCount > 0) { foreach (SuDungHoaDonInfor hd in selector.selection) { if (!SuDungHoaDonDataProvider.Instance.IsInUsed(hd)) { SuDungHoaDonDataProvider.Instance.Delete(hd); ((BindingList <SuDungHoaDonInfor>)gHoaDon.DataSource).Remove(hd); } } } else { if (gvHoaDon.FocusedRowHandle >= 0) { SuDungHoaDonInfor hd = (SuDungHoaDonInfor)gvHoaDon.GetRow(gvHoaDon.FocusedRowHandle); if (!SuDungHoaDonDataProvider.Instance.IsInUsed(hd)) { SuDungHoaDonDataProvider.Instance.Delete(hd); ((BindingList <SuDungHoaDonInfor>)gHoaDon.DataSource).Remove(hd); } } } //int[] indx = gvHoaDon.GetSelectedRows(); //for (int i = indx.Length-1; i>=0; i--) //{ // SuDungHoaDonInfor hd = (SuDungHoaDonInfor) gvHoaDon.GetRow(indx[i]); // if (!SuDungHoaDonDataProvider.Instance.IsInUsed(hd)) // { // SuDungHoaDonDataProvider.Instance.Delete(hd); // gvHoaDon.DeleteRow(indx[i]); // } //} } } catch { } }
private void EditObject(SuDungHoaDonInfor hoadon) { frmCS_KhaiBaoHoaDon frm = new frmCS_KhaiBaoHoaDon(hoadon); if (frm.ShowDialog() == DialogResult.OK) { if (ValidHoaDon(hoadon.IdNhanVien, hoadon.IdQuyen, frm.KyHieu, frm.SoBatDau, frm.SoKetThuc)) { hoadon.KyHieu = frm.KyHieu; hoadon.SoBatDau = frm.SoBatDau; hoadon.SoKetThuc = frm.SoKetThuc; hoadon.SoHienTai = frm.SoHienTai; hoadon.SoConLai = frm.SoConLai; hoadon.Modified = true; } } }
private void EditObject(int rowHandle) { if (rowHandle < 0) { return; } SuDungHoaDonInfor hoadon = (SuDungHoaDonInfor)gvHoaDon.GetRow(rowHandle); if (hoadon.SoConLai > 0) { EditObject(hoadon); } else { MessageBox.Show("Số hóa đơn này đã được dùng, không thể sửa lại"); } }
private void btnThemCT_Click(object sender, EventArgs e) { frmCS_KhaiBaoHoaDon frm = new frmCS_KhaiBaoHoaDon(); if (frm.ShowDialog() == DialogResult.OK) { if (ValidHoaDon(nguoiDung.IdNhanVien, 0, frm.KyHieu, frm.SoBatDau, frm.SoKetThuc)) { SuDungHoaDonInfor hoadon = new SuDungHoaDonInfor(); hoadon.IdNhanVien = nguoiDung.IdNhanVien; hoadon.KyHieu = frm.KyHieu; hoadon.SoBatDau = frm.SoBatDau; hoadon.SoKetThuc = frm.SoKetThuc; hoadon.SoHienTai = frm.SoHienTai; hoadon.SoConLai = frm.SoConLai; hoadon.Modified = true; ((BindingList <SuDungHoaDonInfor>)gHoaDon.DataSource).Add(hoadon); ((BindingList <SuDungHoaDonInfor>)gHoaDon.DataSource).ResetBindings(); } } }
public frmCS_KhaiBaoHoaDon(SuDungHoaDonInfor hd) { InitializeComponent(); Common.LoadStyle(this); this.HoaDon = hd; }
public void Delete(SuDungHoaDonInfor hoaDon) { ExecuteCommand(Declare.StoreProcedureNamespace.spSuDungHoaDonDelte, hoaDon.IdQuyen); }
public void Update(SuDungHoaDonInfor hoaDon) { ExecuteCommand(Declare.StoreProcedureNamespace.spSuDungHoaDonUpdate, hoaDon.IdQuyen, hoaDon.SoHienTai, hoaDon.SoKetThuc, hoaDon.SoConLai); }