Exemplo n.º 1
0
        private void btnOrder_Click(object sender, EventArgs e)
        {
            DSPenjualan ds = new DSPenjualan();

            if (MessageBox.Show("Apakah anda yakin membeli barang ini ?", this.Text, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                foreach (Penjualan jual in listPenjualan)
                {
                    var row = ds.Penjualan.NewPenjualanRow();
                    row.NoOrder      = jual.NoOrder;
                    row.NamaBarang   = jual.DataBarang.Nama;
                    row.NamaCustomer = jual.DataAkun.Nama;
                    row.Quantity     = jual.Quantity.ToString();
                    row.Tanggal      = jual.Tanggal.ToShortDateString();
                    row.SubTotal     = jual.Total.ToString("n0");
                    row.Total        = $"Rp. {tempTotalHrg.ToString("n0")}";
                    ds.Penjualan.AddPenjualanRow(row);

                    _result = new PenjualanDAO(Setting.GetConnectionString()).AddPenjualan(jual) > 0;

                    using (var dao = new BarangDAO(Setting.GetConnectionString()))
                    {
                        dao.UpdateQuantity(jual.DataBarang, jual.Quantity);
                    }

                    using (var dao = new AkunDAO(Setting.GetConnectionString()))
                    {
                        dao.UpdateTotal(jual.DataAkun, jual.Total);
                    }
                }

                FrmReceipt frmReceipt = new FrmReceipt(ds);
                frmReceipt.ShowDialog();


                MessageBox.Show("Order telah diproses.", this.Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.Close();
            }
            else
            {
                this.Close();
            }
        }
Exemplo n.º 2
0
 public FrmReceipt(DSPenjualan ds)
 {
     InitializeComponent();
     _ds = ds;
 }