private void btnDeleteBillExport_Click(object sender, EventArgs e) { try { if (txtIDBillExport.Text == "" || txtIDCustomer.Text == "" || cmbIDCustomer.Text == "") { XtraMessageBox.Show("You have to choose at least one invoice to delete", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); ClearDisplay(); return; } SaleInvoice_DTO invoice = new SaleInvoice_DTO(); invoice.TransID = Convert.ToInt32(dtgvInfoListOfBillExport.CurrentRow.Cells["TransID"].Value); if (SaleInvoice_BUS.DeleteSaleInvoice(invoice)) { LoadSaleInvoice(); uctCustomer.uctCustomerInfo.LoadCustomer(); ClearDisplay(); XtraMessageBox.Show("Delete Post Invoice Successfully", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch (Exception ex) { XtraMessageBox.Show(ex.Message, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void btnAddBillExport_Click(object sender, EventArgs e) { try { if (txtIDBillExport.Text == "" || txtIDCustomer.Text == "" || cmbIDCustomer.Text == "") { XtraMessageBox.Show("Missing Information!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } SaleInvoice_DTO invoice = new SaleInvoice_DTO(); invoice.TransID = Convert.ToInt32(txtIDBillExport.Text); invoice.CustomerId = Convert.ToInt32(txtIDCustomer.Text.ToString()); invoice.CreateDate = Convert.ToDateTime(dtpkDateTimeExport.Text.ToString()); invoice.CustomerName = cmbIDCustomer.Text.ToString(); invoice.TotalPrice = 0; if (SaleInvoice_BUS.InsertSaleInvoice(invoice)) { LoadSaleInvoice(); cmbIDBillExportDetail.Text = txtIDBillExport.Text; ClearDisplay(); uctCustomer.uctCustomerInfo.LoadCustomer(); XtraMessageBox.Show("Insert Sale Invoice Successfully!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } catch { XtraMessageBox.Show("Insert Post Invoice Failed!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void LoadSaleInvoice() { List <SaleInvoice_DTO> saleInvoiceList = SaleInvoice_BUS.LoadSaleInvoice(); dtgvInfoListOfBillExport.DataSource = saleInvoiceList; }