protected void InventoryGridView_SelectedIndexChanged(object sender, EventArgs e) { //show stock cards for selected item string itemCode = InventoryGridView.DataKeys[InventoryGridView.SelectedRow.RowIndex].Values[0].ToString(); ViewState["itemcode"] = itemCode; StockCardsGridView.DataSource = InventoryBizLogic.GetCatalogueItem(itemCode); StockCardsGridView.DataBind(); }
protected void StockCardsGridView_PageIndexChanging(object sender, GridViewPageEventArgs e) { string itemCode = (string)ViewState["itemcode"]; StockCardsGridView.DataSource = InventoryBizLogic.GetCatalogueItem(itemCode); StockCardsGridView.PageIndex = e.NewPageIndex; StockCardsGridView.DataBind(); //BindGrid1(); }
protected void AddVouButton1_Click(object sender, EventArgs e) { if (Page.IsValid) // CustomValidator1.IsValid { // add voucher detail and retrieve list of voucher details not yet raised itemId = ItemCodeTextBox.Text; int adjustedQty = Convert.ToInt32(AdjQtyTextBox.Text); string Remarks = ReasonTextBox.Text; if (adjustedQty < 0) { if (Math.Abs(adjustedQty) > Convert.ToInt32(InventoryBizLogic.GetInventoryItemQty(itemId))) { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Please input a valid adjusted qty');", true); this.Page_Load(null, null); // need this or else page won't add item the second time around } else { VoucherBizLogic.CreateVoucherDetail(itemId, adjustedQty, Remarks, (int)HttpContext.Current.Session["EmpID"]);// previously hardcoded employeeid as 1005; to retrieve employeeID from login later BindGrid(); /* Change: 6-2-19 */ ChangeControlsVisibility("Raise"); } } else { VoucherBizLogic.CreateVoucherDetail(itemId, adjustedQty, Remarks, (int)HttpContext.Current.Session["EmpID"]);// previously hardcoded employeeid as 1005; to retrieve employeeID from login later BindGrid(); /* Change 6/2/19 */ ChangeControlsVisibility("Raise"); } } }
private void BindGrid() { InventoryGridView.DataSource = InventoryBizLogic.ListInventoryItem(); InventoryGridView.DataBind(); }