protected void grdMain_RowCommand(object sender, GridViewCommandEventArgs e) { string strMsg = string.Empty; if (e.CommandName == "cmdedit") { Response.Redirect("MaterialIssue.aspx?MatIssue=" + e.CommandArgument, true); } if (e.CommandName == "cmddelete") { MaterialDAL obj = new MaterialDAL(); Int32 intValue = obj.Delete(Convert.ToInt32(e.CommandArgument)); obj = null; if (intValue > 0) { this.BindGrid(); strMsg = "Record deleted successfully."; //txtGRNo.Focus(); } else { if (intValue == -1) { strMsg = "Record can not be deleted. It is in use."; } else { strMsg = "Record not deleted."; } } ScriptManager.RegisterStartupScript(this, this.GetType(), "alertstrMsg", "PassMessage('" + strMsg + "')", true); } }
public int Delete(int Code, SqlTransaction Transaction) { MaterialDAL ldal = new MaterialDAL(Transaction); this.CheckBeforeDelete(Code, Transaction); return(ldal.Delete(Code)); }
public int Delete(int Id) { return(_materialDAL.Delete(Id)); }