protected void lstProductPackages_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e) { TextBox txtSellingPrice = (TextBox)e.Item.FindControl("txtSellingPrice"); TextBox txtBarCode1 = (TextBox)e.Item.FindControl("txtBarCode1"); TextBox txtBarCode2 = (TextBox)e.Item.FindControl("txtBarCode2"); TextBox txtBarCode3 = (TextBox)e.Item.FindControl("txtBarCode3"); switch (e.CommandName) { case "cmdDelProductPackage": Label lblProductPackageID = (Label)e.Item.FindControl("lblProductPackageID"); ProductPackage clsProductPackage = new ProductPackage(); clsProductPackage.Delete(lblProductPackageID.Text); clsProductPackage.CommitAndDispose(); cboProductCode_SelectedIndexChanged(null, null); break; case "cmdPrintShelvesBarCode1": AceSoft.ThermalBarCodePrinter clsThermalBarCodePrinter1 = new ThermalBarCodePrinter(); clsThermalBarCodePrinter1.PrintShelvesTag(cboProductCode.SelectedItem.Text, txtBarCode1.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0")); break; case "cmdPrintShelvesBarCode2": AceSoft.ThermalBarCodePrinter clsThermalBarCodePrinter2 = new ThermalBarCodePrinter(); clsThermalBarCodePrinter2.PrintShelvesTag(cboProductCode.SelectedItem.Text, txtBarCode2.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0")); break; case "cmdPrintShelvesBarCode3": AceSoft.ThermalBarCodePrinter clsThermalBarCodePrinter3 = new ThermalBarCodePrinter(); clsThermalBarCodePrinter3.PrintShelvesTag(cboProductCode.SelectedItem.Text, txtBarCode3.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0")); break; case "cmdPrintTagPriceBarCode1": AceSoft.ThermalBarCodePrinter clsThermalBarCodeTagPrice1 = new ThermalBarCodePrinter(); clsThermalBarCodeTagPrice1.PrintTagPrice(cboProductCode.SelectedItem.Text, txtBarCode1.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0")); break; case "cmdPrintTagPriceBarCode2": AceSoft.ThermalBarCodePrinter clsThermalBarCodeTagPrice2 = new ThermalBarCodePrinter(); clsThermalBarCodeTagPrice2.PrintTagPrice(cboProductCode.SelectedItem.Text, txtBarCode2.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0")); break; case "cmdPrintTagPriceBarCode3": AceSoft.ThermalBarCodePrinter clsThermalBarCodeTagPrice3 = new ThermalBarCodePrinter(); clsThermalBarCodeTagPrice3.PrintTagPrice(cboProductCode.SelectedItem.Text, txtBarCode3.Text, Convert.ToDecimal(txtSellingPrice.Text).ToString("#,##0.#0")); break; // 02Mar2015 : Added to automatically generate Barcode case "imgCreateBarCode1_Click": txtBarCode1.Text = CreateBarCode(); break; case "imgCreateBarCode2_Click": txtBarCode2.Text = CreateBarCode(); break; case "imgCreateBarCode3_Click": txtBarCode3.Text = CreateBarCode(); break; } }
private bool Delete() { bool boRetValue = false; string stIDs = ""; foreach(DataListItem item in lstItem.Items) { HtmlInputCheckBox chkList = (HtmlInputCheckBox) item.FindControl("chkList"); if (chkList!=null) { if (chkList.Checked == true) { stIDs += chkList.Value + ","; boRetValue = true; } } } if (boRetValue) { ProductPackage clsProductPackage = new ProductPackage(); clsProductPackage.Delete(stIDs.Substring(0,stIDs.Length-1)); clsProductPackage.CommitAndDispose(); Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails(); clsAuditDetails.ActivityDate = DateTime.Now; clsAuditDetails.User = Convert.ToString(Session["Name"]); clsAuditDetails.IPAddress = Request.UserHostAddress; clsAuditDetails.Activity = "Product Package"; clsAuditDetails.Remarks = "Delete Product Package(s). ProductID:'" + lblProductID.Text + "' IDs:'" + stIDs + "'"; Security.AuditTrail clsAuditTrail = new Security.AuditTrail(); clsAuditTrail.Insert(clsAuditDetails); clsAuditTrail.CommitAndDispose(); } return boRetValue; }