private void get_good_info(HttpContext context) { int good_id = DTRequest.GetQueryInt("good_id"); BLL.article bll_article = new BLL.article(); Model.article model_article = bll_article.GetModel(good_id); if (model_article == null) { context.Response.Write("NotFind"); return; } string str_header = ""; string str_body = ""; //会员组 BLL.user_groups bll_groups = new BLL.user_groups(); DataTable dt_groups = bll_groups.GetList(0, "", "grade asc,id desc").Tables[0]; string str_groups_header = ""; string str_groups_body = ""; BLL.standard_price bll_standard_price = new BLL.standard_price(); DataTable dt_standard_price = bll_standard_price.GetList("good_id=" + good_id).Tables[0]; if (dt_standard_price != null && dt_standard_price.Rows.Count > 0) { //有规格价格 foreach (DataRow dr in dt_standard_price.Rows) { decimal sell_price = Convert.ToDecimal(model_article.fields["sell_price"]); string str_standard = ""; string str_standard_value = ""; sell_price = Convert.ToDecimal(dr["sell_price"]); if (dr["standards"] != null && !string.IsNullOrEmpty(dr["standards"].ToString())) { string[] standard_arr = dr["standards"].ToString().Split(',');//规格名 string[] standard_value_arr = dr["standard_values"].ToString().Split(',');//规格值 string[] standard_value_id_arr = dr["standard_value_ids"].ToString().Split(',');//规格值ID for (int i = 0; i < standard_arr.Length; i++) { str_standard += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + standard_arr[i] + "</td>"; if (i < standard_value_arr.Length) { str_standard_value += "<td style='padding-right: 20px;'>" + standard_value_arr[i] + "</td>"; foreach (DataRow dr_group in dt_groups.Rows) { BLL.standard_group_price bll_standard_group_price = new BLL.standard_group_price(); DataTable dt_standard_group_price = bll_standard_group_price.GetList("good_id=" + model_article.id + " and group_id=" + Convert.ToInt32(dr_group["id"]) + " and standard_price_id=" + standard_value_id_arr[i]).Tables[0]; if (dt_standard_group_price != null && dt_standard_group_price.Rows.Count > 0) { str_groups_body += "<td style='padding-right: 20px;'>" + Convert.ToDecimal(dt_standard_group_price.Rows[0]["group_price"]) + "</td>"; } } } else { str_standard_value += "<td style='padding-right: 20px;'> </td>"; } } } str_header = "<table>" + "<thead><tr>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>名称</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>售价</td>" + str_standard + str_groups_header + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>数量</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>操作</td>" + "</tr></thead>"; str_body += "<tbody><tr>" + "<td style='padding-right: 20px;'>" + model_article.title + "</td>" + "<td style='padding-right: 20px;'>" + sell_price + "</td>" + str_groups_body + str_standard_value + "<td style='padding-right: 20px;'><input type='text' class='input small' id='quantity_" + model_article.id + "_" + dr["id"].ToString() + "'></td>" + "<td style='padding-right: 20px;'><a href='javascript:;' onclick='into_meal(" + model_article.id + "," + dr["id"].ToString() + ",this)'>选择</a></td>" + "</tr></tbody>" + "<table>"; } } else { //无规格价格 if (dt_groups != null && dt_groups.Rows.Count > 0) { for (int i = 0; i < dt_groups.Rows.Count; i++) { str_groups_header += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + dt_groups.Rows[i]["title"].ToString() + "</td>"; str_groups_body += "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>" + bll_article.GetGroupPrice(model_article.id, Convert.ToInt32(dt_groups.Rows[i]["id"])) + "</td>"; } } str_header = "<table>" + "<thead><tr>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>名称</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>售价</td>" + str_groups_header + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>数量</td>" + "<td style='font-weight:bold;color:#33B5E5;padding-right:10px;'>操作</td>" + "</tr></thead>"; str_body += "<tbody><tr>" + "<td style='padding-right: 20px;'>" + model_article.title + "</td>" + "<td style='padding-right: 20px;'>" + model_article.fields["sell_price"] + "</td>" + str_groups_body + "<td style='padding-right: 20px;'><input type='text' class='input small' id='quantity_" + model_article.id + "_0'></td>" + "<td style='padding-right: 20px;'><a href='javascript:;' onclick='into_meal(" + model_article.id + ",0,this)'>选择</a></td>" + "</tr></tbody>" + "<table>"; } context.Response.Write(str_header + str_body); return; }