private void btnSave_Click(object sender, EventArgs e) { Producty_type pt = new Producty_type(); Product p = new Product(); ViewItems vi = new ViewItems(); pt.loadProductType(cboType.Text); int temp = pt.getIdproductType(); vi.loadViewItems(txtProduct.Text); double temp2 = vi.ItemId; p.setProductType(temp); p.setDescription(txtDescription.Text); p.setQty(Convert.ToDouble(txtQuantity.Text)); p.setAmount(Convert.ToDouble(txtAmount.Text)); p.setItemId(temp2); p.setOutBy(GLOBAL_VARS.ActiveUser.Username); if (this.active_product_id != 0) { p.setIdproducts(active_product_id); p.edit(); } else { p.Save(); } //DB2 Transaction goes here... if (cboType.Text == "Egg") { TransactionForDB2 tdb2 = new TransactionForDB2(); //for StockInTransaction Class tdb2.St.FromSupplier = 6; tdb2.St.Remarks = "Stockin from Poultry"; tdb2.St.TotalNoOfItems = 1; tdb2.St.TotalQty = Convert.ToDouble(txtQuantity.Text); tdb2.St.PreparedBy = GLOBAL_VARS.ActiveUser.Username; tdb2.St.ApprovedBy = GLOBAL_VARS.ActiveUser.Username; tdb2.St.ReceivedBy = GLOBAL_VARS.ActiveUser.Username; //for StockIn Class tdb2.S.ItemId = IdOfSelectedItem; tdb2.S.QtyIn = Convert.ToDouble(txtQuantity.Text); tdb2.addToCollectionOfS(tdb2.S); //for Quick report tdb2.Q.ItemCode = txtProduct.Text; tdb2.Q.ItemQty = Convert.ToDouble(txtQuantity.Text); tdb2.Q.ItemQtyStanding = ((Convert.ToDouble(f.getAttribute("db2", "items", "item_qty", "item_code", txtProduct.Text))) + tdb2.Q.ItemQty); tdb2.Q.TransactionType = "stock_in"; tdb2.ExecuteDB2Transaction(); } //end of DB2 Transaction vp.loadListviewItem(); }
private void frmManageProduct_Load(object sender, EventArgs e) { //if (this.active_expenses_id != 0) //{ // Expenses ex = new Expenses(); // ex.loadExpenses(this.active_expenses_id); // this.cboType.Text = ex.getExpensesType(); // this.txtDescription.Text = ex.getDescription(); // this.txtAmount.Text = ex.getAmount().ToString(); // this.txtQuantity.Text = ex.getQuantity().ToString(); // this.txtRemarks.Text = ex.getRemarks(); // this.btnSave.Text = "UPDATE"; //} if(this.active_product_id !=0){ Product p = new Product(); ViewItems vi = new ViewItems(); Producty_type pt = new Producty_type(); p.loadProducts(this.active_product_id); pt.loadProductType(p.getIdProductType()); vi.loadViewItems(p.getItemId()); this.cboType.Text = pt.getDescription(); this.txtProduct.Text = vi.ItemCode; this.txtQuantity.Text = p.getQty().ToString(); this.txtAmount.Text = p.getAmount().ToString(); this.txtDescription.Text = p.getDescription(); this.btnSave.Text = "UPDATE"; } }