Example #1
0
        private void ptbOK_Click(object sender, EventArgs e)
        {
            if (!CheckOK())
            {
                MessageBox.Show("Vui lòng điền đủ thông tin!");
                return;
            }
            // tinh tong
            long sum = SumPrice(); // du thua`

            //create new shipment
            BLL.BLLImportGoods.Instance.insertShipment(new DTO.Shipment(dtpDateTrading.Value, cbbCensor.Text, cbbSupplier.Text, rtbRating.Text));
            //Lay shid cuoi cung
            int shid = BLL.BLLImportGoods.Instance.getIDLastShipment();

            //import detail shipment and update
            foreach (ListViewItem lvi in lstProduct.Items)
            {
                DTO.DetailShipment ds = new DTO.DetailShipment(shid, Convert.ToInt16(lvi.SubItems[0].Text), Convert.ToInt16(lvi.SubItems[2].Text));
                BLL.BLLImportGoods.Instance.insertDetailShipment(ds);
                BLL.BLLImportGoods.Instance.updateItem(ds);
            }
            ResetForm();
        }
Example #2
0
 public void updateItem(DTO.DetailShipment ds)
 {
     DAL.DALConnect.Instance.MyExecuteNonQuery("update items set amount = amount + " + ds.Amount + " where iid = " + ds.Iid, CommandType.Text);
 }
Example #3
0
 public void insertDetailShipment(DTO.DetailShipment ds)
 {
     DAL.DALConnect.Instance.MyExecuteNonQuery("insert into detail_shipments(shid,iid,amount) values (" + ds.Shipment + "," + ds.Iid + "," + ds.Amount + ")", CommandType.Text);
 }