private void frmChiTietKiemKe_Load(object sender, EventArgs e) { var dt = PhieuNhapService.LoadDataTable(); //dt.Columns.Add("Status"); grcPhieuNhap.DataSource = dt; }
private void btnTimKiem_Click(object sender, EventArgs e) { string key = null; Nullable <DateTime> dateStart = null, dateEnd = null; if (cedKey.Checked == true) { if (sctKey.Text != "") { key = sctKey.Text; } } if (cedDate.Checked == true) { if (dedDateStart.Text != "") { dateStart = dedDateStart.DateTime.Date; } if (dedDateEnd.Text != "") { dateEnd = dedDateEnd.DateTime.Date; } } if (key == null && dateStart == null && dateEnd == null) { grcPhieuNhap.DataSource = PhieuNhapService.LoadDataTable(); } else { grcPhieuNhap.DataSource = PhieuNhapService.Search(key, dateStart, dateEnd); } }
private void Reload(object sender, FormClosingEventArgs e) { frmPhieuNhapThemSua f = (frmPhieuNhapThemSua)sender; if (f.isDataChanged == true) { grcPhieuNhap.DataSource = PhieuNhapService.LoadDataTable(); } }
private void btnHuyPhieu_Click(object sender, EventArgs e) { string soPhieu = grvPhieuNhap.GetRowCellValue(grvPhieuNhap.FocusedRowHandle, "SoPhieuNhap").ToString(); if (MessageBox.Show("Hủy phiếu nhập " + soPhieu + " ?", "Xác Nhận", MessageBoxButtons.OKCancel) == DialogResult.OK) { if (ChiTietPhieuNhapService.Delete(soPhieu)) { if (PhieuNhapService.Delete(soPhieu)) { grcPhieuNhap.DataSource = PhieuNhapService.LoadDataTable(); MessageBox.Show("Hủy phiếu thành công!"); } else { MessageBox.Show("Không thể hủy phiếu!"); } } else { MessageBox.Show("Không thể hủy chi tiết phiếu!"); } } }
private void frmPhieuNhap_Load(object sender, EventArgs e) { grcPhieuNhap.DataSource = PhieuNhapService.LoadDataTable(); }