protected void btnSearch_Click(object sender, EventArgs e) { try { GetPassSearch gps = new GetPassSearch(); if (dtpFromDate.Text == String.Empty) { gps.CreatedDateFrom = String.Empty; } else { gps.CreatedDateFrom = dtpFromDate.Date.ToShortDateString(); } if (dtpToDate.Text == String.Empty) { gps.CreatedDateTo = String.Empty; } else { gps.CreatedDateTo = dtpToDate.Date.ToShortDateString(); } gps.GPCode = txtGPCode.Text.Trim(); GetPassDAO gpsearch = new GetPassDAO(); DataSet ds = new DataSet(); ds = gpsearch.GetPassSearch(gps); dxgvGPSearch.DataSource = ds; dxgvGPSearch.DataBind(); Session["SearchGatePass"] = ds; } catch (Exception ex) { ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnSearch_Click(object sender, EventArgs e)"); if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty) Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false); else Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false); } }
public DataSet GetPassSearch(GetPassSearch getPassSearch) { DataSet ds = null; try { Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name); DbCommand cmd = db.GetStoredProcCommand(Constant.SP_GetPass_Search); db.AddInParameter(cmd, "@sGPCode", DbType.String, getPassSearch.GPCode); db.AddInParameter(cmd, "@iInvoiceId", DbType.Int32, getPassSearch.InvoiceId); db.AddInParameter(cmd, "@iCreatedBy", DbType.Int32, getPassSearch.CreatedBy); db.AddInParameter(cmd, "@sCreatedDateFrom", DbType.String, getPassSearch.CreatedDateFrom); db.AddInParameter(cmd, "@sCreatedDateTo", DbType.String, getPassSearch.CreatedDateTo); ds = db.ExecuteDataSet(cmd); } catch (System.Exception ex) { ds = null; throw ex; } return(ds); }
public DataSet GetPassSearch(GetPassSearch getPassSearch) { DataSet ds = null; try { Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name); DbCommand cmd = db.GetStoredProcCommand(Constant.SP_GetPass_Search); db.AddInParameter(cmd, "@sGPCode", DbType.String, getPassSearch.GPCode); db.AddInParameter(cmd, "@iInvoiceId", DbType.Int32, getPassSearch.InvoiceId); db.AddInParameter(cmd, "@iCreatedBy", DbType.Int32, getPassSearch.CreatedBy); db.AddInParameter(cmd, "@sCreatedDateFrom", DbType.String, getPassSearch.CreatedDateFrom); db.AddInParameter(cmd, "@sCreatedDateTo", DbType.String, getPassSearch.CreatedDateTo); ds = db.ExecuteDataSet(cmd); } catch (System.Exception ex) { ds = null; throw ex; } return ds; }