private void btSave_Click(object sender, EventArgs e) { if (!String.IsNullOrEmpty(txPayer.Text)) { ReceiptVoucherService.Save(); // Lưu tất cả thay đổi vào database } else { MessageBox.Show("Bạn phải nhập thông tin người nộp"); } }
// Show form chi tiết phiếu thu private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { // Lấy ra 1 phiếu thu tương ứng khi double click vào gridview var rv = ReceiptVoucherService.FindOne(Convert.ToInt16(dataGridView1.CurrentRow.Cells[2].Value)); frmDetailReceipt frm = new frmDetailReceipt(rv); // Chuyền phiếu thu vào Form chi tiết phiếu if (frm.ShowDialog(this) == DialogResult.OK) { LoadData(); // Load lại dữ liệu } }
public frmDetailReceipt(ReceiptVoucher rVoucher) { InitializeComponent(); topBt = btCustomers.Top; if (rVoucher != null) { // Ràng buộc với 1 phiếu thu được chuyền vào this.receiptVoucherBS.DataSource = rVoucher; // Load chi tiết phiếu thu this.rVoucherDetBS.DataSource = ReceiptVoucherService.GetRVoucherDet(rVoucher.VoucherID); ReceiptVoucherService.Update(this.receiptVoucherBS.Current as ReceiptVoucher); // Attach phiếu thu hiện tại để update // Format text -> money txTotal.Text = String.Format("{0:#,##0}", getCurrent().TotalAmt); } }
void LoadData() { //Load tất cả phiếu thu if (state == ViewState.ShowAll) { this.showReceiptBS.DataSource = ReceiptVoucherService.ShowOnGrid(); } // Load dữ liệu theo mã người nộp đã Tag ở node if (state == ViewState.ShowBySaler) { this.showReceiptBS.DataSource = ReceiptVoucherService.FindBySaleser(treeSlsPer.SelectedNode.Tag.ToString()); } // Load dữ liệu theo thời gian đã Tag ở node if (state == ViewState.ShowByTime) { this.showReceiptBS.DataSource = ReceiptVoucherService.FindByTime((DateTime)treeTime.SelectedNode.Tag); } }
private void frmDetailReceipt_Load(object sender, EventArgs e) { setCombox(); // Combo box trạng thái FormClosed += (obj, ev) => { ReceiptVoucherService.Reset(); }; // Reset kết nối }