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) { Products clsProduct = new Products(); clsProduct.Delete( stIDs.Substring(0,stIDs.Length-1), Convert.ToString(Session["Name"])); clsProduct.CommitAndDispose(); Security.AuditTrailDetails clsAuditDetails = new Security.AuditTrailDetails(); clsAuditDetails.ActivityDate = DateTime.Now; clsAuditDetails.User = Convert.ToString(Session["Name"]); clsAuditDetails.IPAddress = Request.UserHostAddress; clsAuditDetails.Activity = "Products"; clsAuditDetails.Remarks = "Delete Product(s). IDs:'" + stIDs + "'"; Security.AuditTrail clsAuditTrail = new Security.AuditTrail(); clsAuditTrail.Insert(clsAuditDetails); clsAuditTrail.CommitAndDispose(); } return boRetValue; }
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) { Products clsProduct = new Products(); clsProduct.Delete(stIDs.Substring(0, stIDs.Length - 1), Convert.ToString(Session["Name"])); clsProduct.CommitAndDispose(); } return boRetValue; }