public EventPenjualan(StateWindow state, FSRESTAURANT.EVENT_PENJUALANRow epr) { dataep = new FSRESTAURANT.EVENT_PENJUALANDataTable(); InitializeComponent(); this.state = state; eprow = epr; data = new FSRESTAURANT.EVENT_PENJUALAN_DETAILDataTable(); temp = new FSRESTAURANT.EVENT_PENJUALAN_DETAILDataTable(); lblUp.Text = uppayment.ToString("N2"); }
public EventBook(FSRESTAURANT.EVENT_PENJUALANRow eprow) { if (eprow == null) { throw new ArgumentNullException(); } this.eprow = eprow; InitializeComponent(); //init value dttable = MainForm.FS.EVENT_TABLE; dtbook = MainForm.FS.EVENT_BOOKING; foreach (FSRESTAURANT.EVENT_TABLERow item in dttable) { source.Add(item.TABLE_NAME, item.TABLE_ID); } }
private void btnInsert_Click(object sender, EventArgs e) { MySqlTransaction trans = MainForm.c.BeginTransaction(); try { MainForm.adapterMgr.EVENT_PENJUALANTableAdapter.Transaction = trans; MainForm.adapterMgr.EVENT_PENJUALAN_DETAILTableAdapter.Transaction = trans; if (eprow == null) { eprow = dataep.NewEVENT_PENJUALANRow(); } eprow.EVENT_ID = Convert.ToInt64(cbEvent.SelectedValue.ToString()); eprow.TOTAL = Convert.ToDecimal(data.Compute("SUM(SUBTOTAL)", "")); eprow.EVENT_PENJUALAN_ID = MainForm.adapterMgr.EVENT_PENJUALANTableAdapter.autogen().ToString(); eprow.USER_ID = MainForm.peg.USER_ID; eprow.PELANGGAN_ID = cbCustomer.SelectedValue.ToString(); dataep.AddEVENT_PENJUALANRow(eprow); MainForm.adapterMgr.EVENT_PENJUALANTableAdapter.Update(dataep); //trans.Commit(); foreach (FSRESTAURANT.EVENT_PENJUALAN_DETAILRow item in data) { item.EVENT_PENJUALAN_ID = eprow.EVENT_PENJUALAN_ID; } MainForm.adapterMgr.EVENT_PENJUALAN_DETAILTableAdapter.Update(data); MessageBox.Show("insert sukses"); trans.Commit(); syncToDatabase(); Event.Report.EventJual p = new Report.EventJual(); Report.PrintPreview pp = new Report.PrintPreview(p, MainForm.FS); pp.setParam("PENJUALAN_ID", eprow.EVENT_PENJUALAN_ID); pp.setReport(); pp.ShowDialog(); reverseState(); } catch (Exception ex) { trans.Rollback(); dataep.Clear(); MessageBox.Show(ex.Message); } finally { trans.Dispose(); } }