public List<CommodityPrice> SearchComdPriceList(string strComdID) { List<CommodityPrice> commodityPriceList = new List<CommodityPrice>(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_Price_SearchAll"); SqlParameter[] sqlParms = { new SqlParameter("@ComdID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strComdID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); foreach (DataTable dt in searchResult.Tables) { foreach (DataRow dr in dt.Rows) { CommodityPrice commodityPrice = new CommodityPrice(); commodityPrice.ComdID = dr["ComdID"].ToString(); commodityPrice.PriceTypeID = dr["PriceTypeID"].ToString(); commodityPrice.PriceTypeName = dr["PriceTypeName"].ToString(); commodityPrice.Price = Convert.ToSingle(dr["Price"]); commodityPrice.PriceType_KBN = Convert.ToInt32(dr["PriceTypeKBN"]); commodityPriceList.Add(commodityPrice); } } } catch (Exception ex) { throw new DAOException("E0001"); } return commodityPriceList; }
public CommodityPrice SearchComdPriceBySaleEmpID(string strComdID, string strSaleEmpID) { CommodityPrice commodityPrice = new CommodityPrice(); string sqlStr = dbUtil.getSqlStatement("SQL_Comd_Price_SearchBySaleEmpID"); SqlParameter[] sqlParms = { new SqlParameter("@ComdID",SqlDbType.VarChar,20), new SqlParameter("@EmpID",SqlDbType.VarChar,20) }; sqlParms[0].Value = strComdID; sqlParms[1].Value = strSaleEmpID; DataSet searchResult = null; try { searchResult = DAO.DBAccess.ExecuteAdapter(DAO.DBAccess.SQLConnectionString, CommandType.Text, sqlStr, sqlParms); UtilService utilService = new UtilService(); if (!utilService.isNullDataset(searchResult)) { commodityPrice.ComdID = searchResult.Tables[0].Rows[0]["ComdID"].ToString(); commodityPrice.PriceTypeID = searchResult.Tables[0].Rows[0]["PriceTypeID"].ToString(); commodityPrice.PriceTypeName = searchResult.Tables[0].Rows[0]["PriceTypeName"].ToString(); commodityPrice.Price = Convert.ToSingle(searchResult.Tables[0].Rows[0]["Price"]); commodityPrice.PriceType_KBN = Convert.ToInt32(searchResult.Tables[0].Rows[0]["PriceTypeKBN"]); } } catch (Exception ex) { throw new DAOException("E0001"); } return commodityPrice; }