protected void btnSearch_Click(object sender, EventArgs e) { try { GRNSearchParameters grnsp = new GRNSearchParameters(); grnsp.POCode = txtPOCode.Text.Trim(); grnsp.FromDate = dtpFromDate.Value == null ? String.Empty : DateTime.Parse(dtpFromDate.Value.ToString()).ToShortDateString(); grnsp.ToDate = dtpToDate.Value == null ? String.Empty : DateTime.Parse(dtpToDate.Value.ToString()).ToShortDateString(); if (txtSalesReturnID.Text.Trim() == String.Empty) { grnsp.SalesReturnID = null; } else { grnsp.SalesReturnID = Int32.Parse(txtSalesReturnID.Text.Trim()); } grnsp.SuplierInvNo = txtSupInvNumber.Text.Trim(); DataSet dsGRN = (new GRNDAO()).GRNSearch(grnsp); Session["GRNSearchResults"] = dsGRN; if (dsGRN != null && dsGRN.Tables[0].Rows.Count > 0) { //gvGRN.DataSource = dsGRN; dxgvGRNDetails.DataSource = dsGRN; } else { //gvGRN.DataSource = null; } //gvGRN.DataBind(); dxgvGRNDetails.DataBind(); this.ShowHideGrid(); } 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 GRNSearch(GRNSearchParameters grnSearchParameters) { try { Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name); DbCommand cmd = db.GetStoredProcCommand(Constant.SP_GRN_Search); db.AddInParameter(cmd, "@sPOCode", DbType.String, grnSearchParameters.POCode); db.AddInParameter(cmd, "@iSalesReturnID", DbType.Int32, grnSearchParameters.SalesReturnID.HasValue ? grnSearchParameters.SalesReturnID : 0); db.AddInParameter(cmd, "@sSuplierInvNo", DbType.String, grnSearchParameters.SuplierInvNo); db.AddInParameter(cmd, "@sFromDate", DbType.String, grnSearchParameters.FromDate); db.AddInParameter(cmd, "@sToDate", DbType.String, grnSearchParameters.ToDate); return(db.ExecuteDataSet(cmd)); } catch (System.Exception ex) { ex.Data.Add("BusinessLayerException", GetType().ToString() + Constant.Error_Seperator + "public DataSet GRNSearch(GRNSearchParameters grnSearchParameters)"); throw ex; return(null); } }
public DataSet GRNSearch(GRNSearchParameters grnSearchParameters) { try { Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name); DbCommand cmd = db.GetStoredProcCommand(Constant.SP_GRN_Search); db.AddInParameter(cmd, "@sPOCode", DbType.String, grnSearchParameters.POCode); db.AddInParameter(cmd, "@iSalesReturnID", DbType.Int32, grnSearchParameters.SalesReturnID.HasValue ? grnSearchParameters.SalesReturnID : 0); db.AddInParameter(cmd, "@sSuplierInvNo", DbType.String, grnSearchParameters.SuplierInvNo); db.AddInParameter(cmd, "@sFromDate", DbType.String, grnSearchParameters.FromDate); db.AddInParameter(cmd, "@sToDate", DbType.String, grnSearchParameters.ToDate); return db.ExecuteDataSet(cmd); } catch (System.Exception ex) { ex.Data.Add("BusinessLayerException", GetType().ToString() + Constant.Error_Seperator + "public DataSet GRNSearch(GRNSearchParameters grnSearchParameters)"); throw ex; return null; } }