public BidTender QueryLowestAndHighestBidTender(string BidDetailNo) { SqlParameter[] sqlparams = new SqlParameter[1]; sqlparams[0] = new SqlParameter("@bidDetailNo", SqlDbType.Int); sqlparams[0].Value = Int32.Parse(BidDetailNo); DataSet bidData = SqlHelper.ExecuteDataset(connstring, CommandType.StoredProcedure, "s3p_EBid_GetOrderOfBidTenderAmounts", sqlparams); DataTable dtMin = new DataTable(); DataTable dtMax = new DataTable(); BidTender bt = new BidTender(); //initial amount in case no vendor is returned bt.VendorWithLowestAmt = "-1"; bt.VendorWithHighestAmt = "-1"; if (bidData.Tables.Count > 0) { dtMin = bidData.Tables[0]; if (dtMin.Rows.Count > 0) { bt.VendorWithLowestAmt = dtMin.Rows[0]["VendorId"].ToString().Trim(); } if (bidData.Tables.Count > 1) { dtMax = bidData.Tables[1]; if (dtMax.Rows.Count > 0) { bt.VendorWithHighestAmt = dtMax.Rows[0]["VendorId"].ToString().Trim(); } } } return(bt); }
public ArrayList GetBidItemTenders(string refNo, int userId) { ArrayList arrBidItemTenders = new ArrayList(); SqlParameter[] sqlparams = new SqlParameter[2]; sqlparams[0] = new SqlParameter("@refNo", SqlDbType.Int); sqlparams[0].Value = Int32.Parse(refNo); sqlparams[1] = new SqlParameter("@userId", SqlDbType.Int); sqlparams[1].Value = userId; DataSet bidData = SqlHelper.ExecuteDataset(connstring, CommandType.StoredProcedure, "s3p_EBid_GetBidTendersNos", sqlparams); if (bidData.Tables[0].Rows.Count > 0) { BidTender bidTender = new BidTender(); foreach (DataTable table in bidData.Tables) { foreach (DataRow row in table.Rows) { arrBidItemTenders.Add(GetBidTender(Int32.Parse(row["BidTenderNo"].ToString()))); } } } return(arrBidItemTenders); }
public BidTender GetBidTender(int bidTenderNo) { BidTender bidTender = new BidTender(); SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@BidTenderNo", SqlDbType.Int); sqlParams[0].Value = bidTenderNo; DataSet ds = SqlHelper.ExecuteDataset(connstring, CommandType.StoredProcedure, "[s3p_EBid_GetBidTender]", sqlParams); DataTable dt = new DataTable(); if (ds.Tables.Count > 0) { dt = ds.Tables[0]; if (dt.Rows.Count > 0) { DataRow row = dt.Rows[0]; bidTender.Amount = Double.Parse(row["Amount"].ToString()); bidTender.BidDetailNo = Int32.Parse(row["BidDetailNo"].ToString()); bidTender.BidItem = row["Item"].ToString(); bidTender.BidTenderNo = Int32.Parse(row["BidTenderNo"].ToString()); bidTender.DetailDesc = row["DetailDesc"].ToString(); bidTender.Status = Int32.Parse(row["Status"].ToString()); bidTender.TenderDate = row["TenderDate"].ToString(); bidTender.VendorID = Int32.Parse(row["VendorID"].ToString()); } else { bidTender.Amount = 0; bidTender.BidDetailNo = -1; bidTender.BidItem = ""; bidTender.BidTenderNo = -1; bidTender.DetailDesc = ""; bidTender.Status = -1; bidTender.TenderDate = ""; bidTender.VendorID = -1; } } else { bidTender.Amount = 0; bidTender.BidDetailNo = -1; bidTender.BidItem = ""; bidTender.BidTenderNo = -1; bidTender.DetailDesc = ""; bidTender.Status = -1; bidTender.TenderDate = ""; bidTender.VendorID = -1; } return(bidTender); }
public void SaveBidTender(BidTender bidTender) { SqlParameter[] sqlparams = new SqlParameter[5]; sqlparams[0] = new SqlParameter("@BidDetailNo", SqlDbType.Int); sqlparams[0].Value = bidTender.BidDetailNo; sqlparams[1] = new SqlParameter("@Amount", SqlDbType.Float); sqlparams[1].Value = bidTender.Amount; sqlparams[2] = new SqlParameter("@TenderDate", SqlDbType.DateTime); sqlparams[2].Value = bidTender.TenderDate; sqlparams[3] = new SqlParameter("@VendorID", SqlDbType.Int); sqlparams[3].Value = bidTender.VendorID; sqlparams[4] = new SqlParameter("@Status", SqlDbType.Int); sqlparams[4].Value = bidTender.Status; SqlHelper.ExecuteNonQuery(connstring, CommandType.StoredProcedure, "[s3p_EBid_SaveBidTender]", sqlparams); }
public BidTender QueryBidTenderAmount(string BidDetailNo, string VendorId) { SqlParameter[] sqlparams = new SqlParameter[2]; sqlparams[0] = new SqlParameter("@bidDetailNo", SqlDbType.Int); sqlparams[0].Value = Int32.Parse(BidDetailNo); sqlparams[1] = new SqlParameter("@vendorId", SqlDbType.Int); sqlparams[1].Value = Int32.Parse(VendorId); DataSet bidData = SqlHelper.ExecuteDataset(connstring, CommandType.StoredProcedure, "s3p_EBid_QueryBidTenderAmount", sqlparams); BidTender bt = new BidTender(); if (bidData.Tables[0].Rows.Count > 0) { bt.Amount = Convert.ToDouble(bidData.Tables[0].Rows[0]["TotalItemCost"].ToString().Trim()); bt.BidTenderNo = Int32.Parse(bidData.Tables[0].Rows[0]["BidTenderNo"].ToString().Trim()); } else { bt.Amount = 0; bt.BidTenderNo = 0; } return(bt); }