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 += "" + strC_Name2 + "\n"; } } } Ds_Productlb2.Clear(); string strproducts1 = ""; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "

" + drv["C_Name"].ToString() + "

\n"; strproducts1 += "

" + strproducts2 + "

\n"; //strproducts1 += "
\n"; //strproducts1 += "更多\n"; //strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\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 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "\n"; strproducts1 += "\""\n"; strproducts1 += "\n"; strproducts1 += "\n"; strproducts1 += "" + Ds_Product.Tables[0].Rows[i]["P_NAME"] + "\n"; strproducts1 += "市场价:" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_Market_P"]).ToString("f2") + "元 会员价:" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_VIP_P"]).ToString("f2") + "元 \n"; strproducts1 += "\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; } } strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
    \n"; if (Ds_Product.Tables[0].Rows.Count > 5) { for (int i = 6; i < Ds_Product.Tables[0].Rows.Count; i++) { strproducts1 += "
  • \n"; strproducts1 += "\n"; strproducts1 += "" + Ds_Product.Tables[0].Rows[i]["P_NAME"] + "\n"; strproducts1 += "市场价:" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_Market_P"]).ToString("f2") + "元
    会员价:" + Convert.ToDouble(Ds_Product.Tables[0].Rows[i]["P_VIP_P"]).ToString("f2") + "元 \n"; strproducts1 += "
    \n"; strproducts1 += "\n"; strproducts1 += "\""\n"; strproducts1 += "\n"; strproducts1 += "" + (i - 5) + "\n"; strproducts1 += "
  • \n"; } } strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\n"; strproducts1 += "
\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 += "·" + Dr["Title"] + "\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 += "\""\n"; strAdsa += "" + j + ""; } 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; } } }