protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); HtmlInputCheckBox chkMatrixID = (HtmlInputCheckBox)e.Item.FindControl("chkMatrixID"); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(chkList.Value, Session.SessionID); switch (e.CommandName) { case "imgSaveOrderSlipPrinter": { TextBox txtActualQuantity = (TextBox)e.Item.FindControl("txtActualQuantity"); try { decimal.Parse(txtActualQuantity.Text); } catch { string stScript = "<Script>"; stScript += "window.alert('Please enter a VALID actual quantity.')"; stScript += "</Script>"; Response.Write(stScript); break; } ProductInventories clsProductInventories = new ProductInventories(); clsProductInventories.UpdateActualQuantity(int.Parse(cboBranch.SelectedItem.Value), long.Parse(chkList.Value), long.Parse(chkMatrixID.Value), decimal.Parse(txtActualQuantity.Text)); clsProductInventories.CommitAndDispose(); } break; } }
protected void lstItem_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { HtmlInputCheckBox chkList = (HtmlInputCheckBox)e.Item.FindControl("chkList"); HtmlInputCheckBox chkMatrixID = (HtmlInputCheckBox)e.Item.FindControl("chkMatrixID"); string stParam = "?task=" + Common.Encrypt("list", Session.SessionID) + "&prodid=" + Common.Encrypt(chkList.Value, Session.SessionID); switch (e.CommandName) { case "imgProductTag": { ImageButton imgProductTag = (ImageButton)e.Item.FindControl("imgProductTag"); Products clsProduct = new Products(); if (imgProductTag.ToolTip == "Tag this product as INACTIVE.") { clsProduct.TagInactive(long.Parse(chkList.Value)); imgProductTag.ImageUrl = Constants.ROOT_DIRECTORY + "/_layouts/images/prodtaginact.gif"; imgProductTag.ToolTip = "Tag this product as ACTIVE."; } else { clsProduct.TagActive(long.Parse(chkList.Value)); imgProductTag.ImageUrl = Constants.ROOT_DIRECTORY + "/_layouts/images/prodtagact.gif"; imgProductTag.ToolTip = "Tag this product as INACTIVE."; } clsProduct.CommitAndDispose(); } break; case "imgSaveActualQuantity": { TextBox txtActualQuantity = (TextBox)e.Item.FindControl("txtActualQuantity"); try { decimal.Parse(txtActualQuantity.Text); } catch { string stScript = "<Script>"; stScript += "window.alert('Please enter a VALID actual quantity.')"; stScript += "</Script>"; Response.Write(stScript); break; } ProductInventories clsProductInventories = new ProductInventories(); clsProductInventories.UpdateActualQuantity(int.Parse(cboBranch.SelectedItem.Value), long.Parse(chkList.Value), long.Parse(chkMatrixID.Value), decimal.Parse(txtActualQuantity.Text)); clsProductInventories.CommitAndDispose(); } break; } }
private void SaveAllActualQuantity() { HtmlInputCheckBox chkMatrixID = null; HtmlInputCheckBox chkList = null; TextBox txtActualQuantity = null; int intBranchID = int.Parse(cboBranch.SelectedItem.Value); ProductInventories clsProductInventories = new ProductInventories(); foreach (DataListItem item in lstItem.Items) { txtActualQuantity = (TextBox)item.FindControl("txtActualQuantity"); chkList = (HtmlInputCheckBox)item.FindControl("chkList"); chkMatrixID = (HtmlInputCheckBox)item.FindControl("chkMatrixID"); try { decimal decActualQuantity = decimal.Parse(txtActualQuantity.Text); clsProductInventories.UpdateActualQuantity(intBranchID, long.Parse(chkList.Value), long.Parse(chkMatrixID.Value), decActualQuantity); txtActualQuantity.Text = Server.HtmlEncode(decActualQuantity.ToString("#,##0.#0")); } catch { } } clsProductInventories.CommitAndDispose(); LoadList(); }