public DataTable GetWRestraurantOrderDetailList(Contract.Pager pager, Hashtable hs)
{
string sql = @"select * from dbo.b where 1=1";
IDbParameters param = AdoTemplate.CreateDbParameters();
if (hs.Contains("Id"))
{
sql += " and OrderId=@Id ";
param.AddWithValue("Id", hs["Id"]);
}
sql = PagerSql(sql, pager);
DataSet ds = AdoTemplate.DataSetCreateWithParams(CommandType.Text, sql, param);
if (ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0)
{
if (ds.Tables[0].Rows[0]["TypeId"].ToString() == "1")
{
string sql2 = @"select * from dbo.a where 1=1";
IDbParameters param2= AdoTemplate.CreateDbParameters();
sql2 += " and OrderId=@OrderId ";
param2.AddWithValue("OrderId", hs["Id"]);
pager.OrderKey = "OrderDetailId ASC";
sql2 = PagerSql(sql2, pager);
DataSet ds2 = AdoTemplate.DataSetCreateWithParams(CommandType.Text, sql2, param2);
if (ds2.Tables[0] != null && ds2.Tables[0].Rows.Count > 0) {
//将套餐订单的详细菜品放到套餐订单中
DataTable dt = new DataTable();
dt = ds.Tables[0];
foreach(DataRow dr2 in ds2.Tables[0].Rows){
DataRow dr = dt.NewRow();
dr["OrderId"] = dr2["OrderId"];
dr["ProductId"] = dr2["DishesId"];
dr["ProductName"] = dr2["DishesName"];
dr["Thumb"] = dr2["Thumb"];
dr["Price"] = dr2["DishesPrice"];
dr["Number"] = dr2["Number"];
dt.Rows.Add(dr);
}
}
}
}
pager.DataSource = ds.Tables[0];
pager.ItemCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
return ds.Tables[0];
}