示例#1
0
        public void fillItemList(object sender, EventArgs e)
        {
            _purchaseRecord.getPurchaseRecords().Rows.Clear();
            _purchaseRecord.getTotal().Text             = "$0";
            _purchaseRecord.getSupplier().DisplayMember = "name";
            _purchaseRecord.getSupplier().ValueMember   = "service_id";

            String supplier_id = _purchaseRecord.getSupplier().SelectedValue.ToString();
            //  MessageBox.Show(supplier_id);
            DataTable itemTable = franchisee_inventory.getProducts(user.getFranchiseeId(_purchaseRecord.getUser()), supplier_id);

            _purchaseRecord.fillItemList(itemTable);
        }
示例#2
0
 public void purchaseRecord_btn_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to save this purchase record?", "Save", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         inventory_transaction = new InventoryTransaction();
         item_transaction      = new ItemTransaction();
         _purchaseRecord       = (PurchaseRecord)((Button)sender).FindForm();
         String supplier_id = _purchaseRecord.getSupplier().SelectedValue.ToString();
         inventory_transaction.insertInventoryTransaction(user.getFranchiseeId(_purchaseRecord.getUser()), supplier_id, _purchaseRecord.getDate());
         DataGridView dgv = _purchaseRecord.getPurchaseRecords();
         for (int i = 0; i < dgv.Rows.Count - 1; i++)
         {
             franchisee_inventory.updateQuantity(dgv.Rows[i].Cells[1].Value.ToString(), dgv.Rows[i].Cells[4].Value.ToString());
             franchisee_inventory.updateCost(dgv.Rows[i].Cells[1].Value.ToString(), dgv.Rows[i].Cells[3].Value.ToString());
             item_transaction.insertItemTransaction(inventory_transaction.getTransactions(user.getFranchiseeId(_purchaseRecord.getUser())).Rows.Count.ToString(), dgv.Rows[i].Cells[1].Value.ToString(), dgv.Rows[i].Cells[3].Value.ToString(), dgv.Rows[i].Cells[4].Value.ToString());
         }
         _purchaseRecord.getPurchaseRecords().Rows.Clear();
         _purchaseRecord.getTotal().Text = "$0";
     }
 }
示例#3
0
 public void purchaseRecord_btn_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Do you want to save this purchase record?", "Save", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         inventory_transaction = new InventoryTransaction();
         item_transaction = new ItemTransaction();
         _purchaseRecord = (PurchaseRecord)((Button)sender).FindForm();
         String supplier_id = _purchaseRecord.getSupplier().SelectedValue.ToString();
         inventory_transaction.insertInventoryTransaction(user.getFranchiseeId(_purchaseRecord.getUser()), supplier_id, _purchaseRecord.getDate());
         DataGridView dgv = _purchaseRecord.getPurchaseRecords();
         for (int i = 0; i < dgv.Rows.Count - 1; i++)
         {
             franchisee_inventory.updateQuantity(dgv.Rows[i].Cells[1].Value.ToString(), dgv.Rows[i].Cells[4].Value.ToString());
             franchisee_inventory.updateCost(dgv.Rows[i].Cells[1].Value.ToString(), dgv.Rows[i].Cells[3].Value.ToString());
             item_transaction.insertItemTransaction(inventory_transaction.getTransactions(user.getFranchiseeId(_purchaseRecord.getUser())).Rows.Count.ToString(), dgv.Rows[i].Cells[1].Value.ToString(), dgv.Rows[i].Cells[3].Value.ToString(), dgv.Rows[i].Cells[4].Value.ToString());
         }
         _purchaseRecord.getPurchaseRecords().Rows.Clear();
         _purchaseRecord.getTotal().Text = "$0";
     }
 }