public QBuyGoods GetQbuyGoodsByQBuyIdAndQBuyGoodsId(string qBuyCode, string qBuyGoodsId) { QBuyGoods qBuyGoods = new QBuyGoods(); StringBuilder builder = new StringBuilder(); builder.AppendFormat(OrderSqls.SELECT_QBUYGOODS_BY_QBUY_CODE_AND_QBUY_GOODS_ID, qBuyCode, qBuyGoodsId); string sql = builder.ToString(); DataTable dt = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0]; if (dt != null && dt.Rows.Count == 1) { qBuyGoods = new QBuyGoods { qBuyGoodsId = dt.Rows[0]["QBUY_GOODS_ID"].ToString(), qBuyCode = dt.Rows[0]["QBUY_CODE"].ToString(), goodsId = dt.Rows[0]["GOODS_ID"].ToString(), goodsName = dt.Rows[0]["GOODS_NAME"].ToString(), price = dt.Rows[0]["Q_PRICE"].ToString(), num = dt.Rows[0]["Q_NUM"].ToString(), slt = dt.Rows[0]["GOODS_IMG"].ToString(), }; } return(qBuyGoods); }
public List <QBuyGoods> GetQbuyGoodsListByQbuyId(string qbuyCode) { List <QBuyGoods> list = new List <QBuyGoods>(); StringBuilder builder = new StringBuilder(); builder.AppendFormat(OrderSqls.SELECT_QBUYGOODS_BY_QBUY_CODE, qbuyCode); string sql = builder.ToString(); DataTable dt = DatabaseOperationWeb.ExecuteSelectDS(sql, "T").Tables[0]; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { bool ifUse = false; if (dr["IF_USE"].ToString() == "1") { int stock = 0; int.TryParse(dr["GOODS_STOCK"].ToString(), out stock); if (stock > 0) { ifUse = true; } } QBuyGoods qBuyGoods = new QBuyGoods { qBuyGoodsId = dr["QBUY_GOODS_ID"].ToString(), qBuyCode = dr["QBUY_CODE"].ToString(), goodsId = dr["GOODS_ID"].ToString(), goodsName = dr["GOODS_NAME"].ToString(), price = dr["Q_PRICE"].ToString(), num = dr["Q_NUM"].ToString(), slt = dr["GOODS_IMG"].ToString(), ifUse = ifUse, }; list.Add(qBuyGoods); } } return(list); }