187 lines
11 KiB
C#
187 lines
11 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Data;
|
|
namespace Mtxfw.shop
|
|
{
|
|
public partial class shop_index : System.Web.UI.Page
|
|
{
|
|
public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product();
|
|
public Mtxfw.DAL.P_Category daoCategory = new Mtxfw.DAL.P_Category();
|
|
public Mtxfw.DAL.Ads daoAds = new Mtxfw.DAL.Ads();
|
|
public Mtxfw.DAL.Article daoArt = new Mtxfw.DAL.Article();
|
|
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config("");
|
|
public String TitName;
|
|
public string strprovince = "", strprovincename = "", strproducts = "", strAds = "", strAdsa = "", strnews = "";
|
|
protected int MemberIFStores = 0;
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
if (Session["MemberId"] != null && Session["MemberIFStores"] != null)
|
|
{
|
|
MemberIFStores = int.Parse(Session["MemberIFStores"].ToString());
|
|
}
|
|
Page.Title = "华夏诚鑫商城";
|
|
Page.MetaDescription = "华夏诚鑫商城";
|
|
Page.MetaKeywords = "华夏诚鑫商城";
|
|
|
|
if (!IsPostBack)
|
|
{
|
|
DataSet Ds_Productlb = daoCategory.GetList("", "ttype=0 And C_Layer=1 And IfShow=0 Order By C_LinkID Asc");
|
|
if (Ds_Productlb.Tables[0].Rows.Count > 0)
|
|
{
|
|
foreach (System.Data.DataRow drv in Ds_Productlb.Tables[0].Rows)
|
|
{
|
|
|
|
DataSet Ds_Productlb2 = daoCategory.GetList("", "ttype=0 And IfShow=0 And C_PARENTID=" + drv["C_ID"].ToString() + " Order By C_LinkID Asc");
|
|
string strproducts2 = "";
|
|
if (Ds_Productlb2.Tables[0].Rows.Count > 0)
|
|
{
|
|
foreach (System.Data.DataRow drv2 in Ds_Productlb2.Tables[0].Rows)
|
|
{
|
|
if (drv2["C_NAME"].ToString().IndexOf("其它") == -1)
|
|
{
|
|
string strC_Name2 = drv2["C_Name"].ToString();
|
|
if (strC_Name2.IndexOf("收纳/ 居家日用/ 宠物/ 园艺") != -1)
|
|
{
|
|
strC_Name2 = strC_Name2.Replace("/ ", "/");
|
|
}
|
|
strproducts2 += "<a href=\"/shop/search-class-" + drv2["C_ID"].ToString() + ".html\">" + strC_Name2 + "</a>\n";
|
|
}
|
|
}
|
|
}
|
|
Ds_Productlb2.Clear();
|
|
|
|
string strproducts1 = "";
|
|
strproducts1 += "<div class=\"home-hot-goods\">\n";
|
|
strproducts1 += "<div class=\"xm-plain-box\">\n";
|
|
strproducts1 += "<div class=\"box-hd\">\n";
|
|
strproducts1 += "<h3 class=\"title\">" + drv["C_Name"].ToString() + "</h3>\n";
|
|
strproducts1 += "<h4 class=\"title2\">" + strproducts2 + "</h4>\n";
|
|
//strproducts1 += "<div class=\"more\">\n";
|
|
//strproducts1 += "<a class=\"more-link\" href=\"/shop/search-class-" + drv["C_ID"].ToString() + ".html\">更多<i class=\"iconfont\"></i></a>\n";
|
|
//strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "<div class=\"clearfix\"></div>\n";
|
|
strproducts1 += "<div class=\"box-bd\">\n";
|
|
strproducts1 += "<div class=\"row\">\n";
|
|
strproducts1 += "<div class=\"col col-15\">\n";
|
|
strproducts1 += "<div class=\"brick-list\">\n";
|
|
|
|
DataSet Ds_Product = daoProduct.GetList("top 12", "utype='0' and (P_CATEGORYs like '%," + drv["C_ID"].ToString() + ",%') Order By P_HITED Desc,P_ADDATE Desc");
|
|
if (Ds_Product.Tables[0].Rows.Count > 0)
|
|
{
|
|
for (int i = 0; i < 6 && i < Ds_Product.Tables[0].Rows.Count; i++)
|
|
{
|
|
strproducts1 += "<div class=\"brick-item brick-item-m\">\n";
|
|
strproducts1 += "<div class=\"item\">\n";
|
|
strproducts1 += "<div class=\"item-content\">\n";
|
|
|
|
strproducts1 += "<span class=\"item-thumb\">\n";
|
|
strproducts1 += "<a href=\"/shop/view-" + Ds_Product.Tables[0].Rows[i]["P_id"] + ".html\"><img src=\"" + Mtxfw.Utility.Common.GetCoverPic(Ds_Product.Tables[0].Rows[i]["P_images"].ToString().Split('|')[0].Split(',')[0], "220x220", "cut") + "\" alt=\"" + Ds_Product.Tables[0].Rows[i]["P_NAME"] + "\" srcset=\"" + Mtxfw.Utility.Common.GetCoverPic(Ds_Product.Tables[0].Rows[i]["P_images"].ToString().Split('|')[0].Split(',')[0], "440x440", "cut") + " 2x\" /></a>\n";
|
|
strproducts1 += "</span>\n";
|
|
strproducts1 += "<span class=\"item-info\">\n";
|
|
strproducts1 += "<span class=\"item-title\"><a href=\"/shop/view-" + Ds_Product.Tables[0].Rows[i]["P_id"] + ".html\">" + Ds_Product.Tables[0].Rows[i]["P_NAME"] + "</a></span>\n";
|
|
strproducts1 += "<span class=\"item-price\">市场价:<del>" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_Market_P"]).ToString("f2") + "元</del> </span><span class=\"item-price item-price-block\">会员价:<span>" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_VIP_P"]).ToString("f2") + "元</span> </span>\n";
|
|
strproducts1 += "</span>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
}
|
|
}
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += " </div>\n";
|
|
strproducts1 += "<div class=\"col col-5\">\n";
|
|
strproducts1 += "<div class=\"board-section\">\n";
|
|
strproducts1 += "<ul class=\"board-list\">\n";
|
|
if (Ds_Product.Tables[0].Rows.Count > 5)
|
|
{
|
|
for (int i = 6; i < Ds_Product.Tables[0].Rows.Count; i++)
|
|
{
|
|
strproducts1 += "<li " + (i < 9 ? "class=\"top\"" : "") + ">\n";
|
|
strproducts1 += "<span class=\"item-info\">\n";
|
|
strproducts1 += "<span class=\"item-title\"><a href=\"/shop/view-" + Ds_Product.Tables[0].Rows[i]["P_id"] + ".html\">" + Ds_Product.Tables[0].Rows[i]["P_NAME"] + "</a></span>\n";
|
|
strproducts1 += "<span class=\"item-price\">市场价:<del>" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_Market_P"]).ToString("f2") + "元</del> </span><br><span class=\"item-price\">会员价:<span>" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_VIP_P"]).ToString("f2") + "元</span> </span>\n";
|
|
strproducts1 += "</span>\n";
|
|
strproducts1 += "<span class=\"item-thumb\">\n";
|
|
strproducts1 += "<a href=\"/shop/view-" + Ds_Product.Tables[0].Rows[i]["P_id"] + ".html\"><img src=\"" + Mtxfw.Utility.Common.GetCoverPic(Ds_Product.Tables[0].Rows[i]["P_images"].ToString().Split('|')[0].Split(',')[0], "70x70", "cut") + "\" alt=\"" + Ds_Product.Tables[0].Rows[i]["P_NAME"] + "\" srcset=\"" + Mtxfw.Utility.Common.GetCoverPic(Ds_Product.Tables[0].Rows[i]["P_images"].ToString().Split('|')[0].Split(',')[0], "140x140", "cut") + " 2x\" /></a>\n";
|
|
strproducts1 += "</span>\n";
|
|
strproducts1 += "<span class=\"item-num\">" + (i - 5) + "</span>\n";
|
|
strproducts1 += "</li>\n";
|
|
}
|
|
}
|
|
strproducts1 += "</ul>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
strproducts1 += "</div>\n";
|
|
|
|
strproducts += strproducts1;
|
|
|
|
}
|
|
}
|
|
Ds_Productlb.Clear();
|
|
DataSet Ds_Gong = daoArt.GetList("top 10", "ParentID=9 and Seef=0 Order By ID desc");
|
|
int ii = 0;
|
|
foreach (System.Data.DataRow Dr in Ds_Gong.Tables[0].Rows)
|
|
{
|
|
strnews += "<li" + (ii == 0 ? " class=\"first\"" : "") + "><a href=\"/article-" + Dr["ID"] + ".html\"><span class=\"dot\">·</span>" + Dr["Title"] + "<i class=\"iconfont\"></i></a></li>\n";
|
|
ii += 1;
|
|
}
|
|
Ds_Gong.Clear();
|
|
DataSet Ds_Ads = daoAds.GetList("", "utype=N'首页流量' Order By AdsSort asc");
|
|
|
|
int j = 1;
|
|
if (Ds_Ads.Tables[0].Rows.Count > 0)
|
|
{
|
|
foreach (System.Data.DataRow Dr in Ds_Ads.Tables[0].Rows)
|
|
{
|
|
if (j < 20)
|
|
{
|
|
strAds += "<a href=\"" + Dr["AdsUrl"].ToString() + "\" target=\"_blank\"><img src=\"" + Mtxfw.Utility.Common.GetCoverPic(Dr["AdsPic"].ToString(), "680x357", "cut") + "\" alt=\"" + Dr["AdsName"].ToString() + "\" width=\"680\" height=\"357\"/></a>\n";
|
|
strAdsa += "<a href=\"javascript:void(0);\" class=\"hover\">" + j + "</a>";
|
|
}
|
|
j += 1;
|
|
}
|
|
}
|
|
Ds_Ads.Clear();
|
|
}
|
|
}
|
|
|
|
public bool IsMoblie()
|
|
{
|
|
string agent = (Request.UserAgent + "").ToLower().Trim();
|
|
|
|
if (agent == "" ||
|
|
agent.IndexOf("mobile") != -1 ||
|
|
agent.IndexOf("mobi") != -1 ||
|
|
agent.IndexOf("nokia") != -1 ||
|
|
agent.IndexOf("samsung") != -1 ||
|
|
agent.IndexOf("sonyericsson") != -1 ||
|
|
agent.IndexOf("mot") != -1 ||
|
|
agent.IndexOf("blackberry") != -1 ||
|
|
agent.IndexOf("lg") != -1 ||
|
|
agent.IndexOf("htc") != -1 ||
|
|
agent.IndexOf("j2me") != -1 ||
|
|
agent.IndexOf("ucweb") != -1 ||
|
|
agent.IndexOf("opera mini") != -1 ||
|
|
agent.IndexOf("mobi") != -1 ||
|
|
agent.IndexOf("android") != -1 ||
|
|
agent.IndexOf("iphone") != -1 ||
|
|
agent.IndexOf("micromessenger") != -1)
|
|
{
|
|
//终端可能是手机
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
}
|
|
} |