412 lines
22 KiB
C#
412 lines
22 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using System.Data;
|
||
using System.Text;
|
||
namespace Mtxfw.shop
|
||
{
|
||
public partial class shop_view : 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.Guest daoGuest = new DAL.Guest();
|
||
public Mtxfw.DAL.user_info daoUser = new DAL.user_info();
|
||
public Mtxfw.Utility.Config config = new Mtxfw.Utility.Config();
|
||
public String TitName = "", Gname = "", strCATEGORY = "", strposition = "", strimages = "", strlistimages = "", strlistimages2 = "", P_VIP_P = "", P_VIP_P0 = "", P_VIP_P1 = "", P_VIP_P2 = "", P_VIP_CP = "", strP_VIP_P = "", P_Market_P = "", P_M_P = "", P_Inventory = "", P_Orders = "", P_Orders0 = "", P_Orders1 = "", P_Orders2 = "", P_PJOrders = "", P_SCOrders = "", P_DESCRIPTION = "", P_DESCRIPTION1 = "", P_DESCRIPTION2="",P_EDESCRIPTION = "", P_ADDATE = "", P_HITED = "", P_ID = "", P_JiangLi = "0", P_JiangLi3 = "0", P_utype = "", strColors = "";
|
||
public string strprovince = "", strprovincename = "", pinglun_pages = "", pinglun_content = "", wenda_pages = "", wenda_content = "", MemberNCName = "必须填写", yunfei = "", strdisplay = "", stryhtit = "积分价";
|
||
|
||
protected string AdsName01, AdsName02;
|
||
protected string indexTP01, indexTP02;
|
||
protected string indexTPLink01, indexTPLink02;
|
||
protected int MemberIFStores = 0;
|
||
protected bool P_ppproduct = false;
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
//Response.Write(Convert.ToInt32((265 / int.Parse(config.webMan))).ToString());
|
||
/*String PID = "";
|
||
if (Request.QueryString["PID"] != null)
|
||
{
|
||
PID = Request.QueryString["PID"].ToString();
|
||
Session["province"] = PID;
|
||
}
|
||
else
|
||
{
|
||
if (Session["province"] != null)
|
||
{
|
||
PID = Session["province"].ToString();
|
||
}
|
||
else
|
||
{
|
||
Mtxfw.Utility.IPScanner IPScanner = new Mtxfw.Utility.IPScanner(Mtxfw.Utility.IPScanner.GetIP);
|
||
IPScanner.IPLocation();
|
||
PID = Mtxfw.Utility.province.GetprovinceID2(IPScanner.ProvinceCode);
|
||
}
|
||
}
|
||
strprovince = PID;*/
|
||
if (Session["MemberId"] != null && Session["MemberIFStores"] != null && Session["MemberNCName"] != null)
|
||
{
|
||
MemberIFStores = int.Parse(Session["MemberIFStores"].ToString());
|
||
MemberNCName = Session["MemberNCName"].ToString();
|
||
}
|
||
System.Data.DataSet Ds_Ads = daoAds.GetCacheList("top 50", "utype=N'首页广告' Order By AdsSort asc", "shop_Ads");
|
||
System.Data.DataTable Dt_Ads = Ds_Ads != null && Ds_Ads.Tables[0] != null ? Ds_Ads.Tables[0] : null;
|
||
int i = 1;
|
||
foreach (System.Data.DataRow Dr in Dt_Ads.Rows)
|
||
{
|
||
if (i == Dt_Ads.Rows.Count)
|
||
{
|
||
indexTP01 = Dr["AdsPic"].ToString();
|
||
indexTPLink01 = Dr["AdsUrl"].ToString();
|
||
AdsName01 = Dr["AdsName"].ToString();
|
||
}
|
||
|
||
i += 1;
|
||
}
|
||
if (!IsPostBack)
|
||
{
|
||
try
|
||
{
|
||
if (!String.IsNullOrEmpty(Request.QueryString["id"]) && Mtxfw.Utility.Tools.HasInt(Request.QueryString["id"]))
|
||
{
|
||
Data_Bind(Int32.Parse(Request.QueryString["id"]));
|
||
if (Session["MemberId"] != null)
|
||
{
|
||
Mtxfw.Model.user_info user = daoUser.GetModel(int.Parse(Session["MemberId"].ToString()));
|
||
Gname = user.RealName;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
Response.StatusCode = 404;
|
||
Response.End();
|
||
}
|
||
}
|
||
catch
|
||
{
|
||
}
|
||
}
|
||
}
|
||
protected void Data_Bind(Int32 ID)
|
||
{
|
||
Mtxfw.Model.P_Product model = daoProduct.GetModel(ID);
|
||
if (model != null)
|
||
{
|
||
string P_M_Web = model.P_M_Web;
|
||
P_EDESCRIPTION = model.P_EDESCRIPTION;
|
||
if (P_M_Web != "")
|
||
{
|
||
if (P_M_Web.IndexOf("http") != -1)
|
||
{
|
||
Response.Redirect(P_M_Web);
|
||
}
|
||
}
|
||
|
||
string strCookie = "";
|
||
if (Request.Cookies["view_id"] != null)
|
||
{
|
||
|
||
HttpCookie myCookie = Request.Cookies["view_id"];
|
||
strCookie = myCookie.Value;
|
||
if (strCookie.IndexOf("," + model.P_ID + ",") == -1)
|
||
{
|
||
strCookie += model.P_ID + ",";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
strCookie = "," + model.P_ID + ",";
|
||
}
|
||
HttpCookie myviewCookie = new HttpCookie("view_id");
|
||
myviewCookie.Value = strCookie;
|
||
myviewCookie.Expires = DateTime.Now.AddYears(1);
|
||
Response.Cookies.Add(myviewCookie);
|
||
|
||
if (Session["MemberId"] != null)
|
||
{
|
||
int MemberId = Convert.ToInt32(Session["MemberId"].ToString());
|
||
if (Request.Cookies["province"] == null)
|
||
{
|
||
Mtxfw.Model.user_info umodel = daoUser.GetModel(MemberId);
|
||
if (umodel != null)
|
||
{
|
||
HttpCookie myCookie = new HttpCookie("province");
|
||
myCookie.Value = umodel.Province + "|" + new Mtxfw.DAL.province().GetProvince(umodel.Province) + "|0";
|
||
myCookie.Expires = DateTime.Now.AddYears(1);
|
||
Response.Cookies.Add(myCookie);
|
||
myCookie = new HttpCookie("city");
|
||
myCookie.Value = umodel.City + "|" + new Mtxfw.DAL.city().GetCity(umodel.City) + "";
|
||
myCookie.Expires = DateTime.Now.AddYears(1);
|
||
Response.Cookies.Add(myCookie);
|
||
myCookie = new HttpCookie("county");
|
||
myCookie.Value = umodel.County + "|" + new Mtxfw.DAL.county().GetCounty(umodel.County) + "";
|
||
myCookie.Expires = DateTime.Now.AddYears(1);
|
||
Response.Cookies.Add(myCookie);
|
||
}
|
||
}
|
||
if (new Mtxfw.DAL.user_favorite().GetCount("ttype=2 and ProductID=" + model.P_ID + " And MemberId=" + MemberId) == 0)
|
||
{
|
||
Mtxfw.Model.user_favorite modelfav = new Model.user_favorite();
|
||
modelfav.ProductID = model.P_ID;
|
||
modelfav.MemberId = MemberId;
|
||
modelfav.ttype = 2;
|
||
new Mtxfw.DAL.user_favorite().Add(modelfav);
|
||
|
||
}
|
||
}
|
||
TitName = model.P_NAME;
|
||
//P_ppproduct = model.P_ppproduct;
|
||
strimages = model.P_images.Split('|')[0].Split(',')[0];
|
||
string[] aimgs = model.P_images.Split('|');
|
||
string strayanse = "";
|
||
if (model.P_yanse != "")
|
||
{
|
||
string[] ayanse = model.P_yanse.Split('|');
|
||
for (int j = 0; j < ayanse.Length; j++)
|
||
{
|
||
|
||
if (strlistimages2 == "" && ayanse[j] != "")
|
||
{
|
||
for (int i = 0; i < aimgs.Length; i++)
|
||
{
|
||
if (aimgs[i] != "")
|
||
{
|
||
string[] imgs = aimgs[i].Split(',');
|
||
if (model.P_yanse != "")
|
||
{
|
||
|
||
if (aimgs[i].IndexOf(ayanse[j]) != -1)
|
||
{
|
||
strayanse = ayanse[j];
|
||
strlistimages2 += "<li onmouseover='showmaxpic(this)'" + (i == 0 ? " class='select'" : "") + ">" + (i == 0 ? "<em></em>" : "") + "\n";
|
||
strlistimages2 += "<img title='" + TitName + "' src='" + Mtxfw.Utility.Common.GetCoverPic(imgs[0], "94x94", "cut") + "' simg='" + Mtxfw.Utility.Common.GetCoverPic(imgs[0], "458x458", "cut") + "' ssimg='/image/" + imgs[0] + "'/>\n";
|
||
strlistimages2 += "</li>\n";
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
if (strlistimages2 == "")
|
||
{
|
||
for (int i = 0; i < aimgs.Length; i++)
|
||
{
|
||
if (aimgs[i] != "")
|
||
{
|
||
string[] imgs = aimgs[i].Split(',');
|
||
strlistimages2 += "<li onmouseover='showmaxpic(this)'" + (i == 0 ? " class='select'" : "") + ">" + (i == 0 ? "<em></em>" : "") + "\n";
|
||
strlistimages2 += "<img title='" + TitName + "' src='" + Mtxfw.Utility.Common.GetCoverPic(imgs[0], "94x94", "cut") + "' simg='" + Mtxfw.Utility.Common.GetCoverPic(imgs[0], "458x458", "cut") + "' ssimg='/image/" + imgs[0] + "'/>\n";
|
||
strlistimages2 += "</li>\n";
|
||
}
|
||
}
|
||
}
|
||
for (int i = 0; i < aimgs.Length; i++)
|
||
{
|
||
if (aimgs[i] != "")
|
||
{
|
||
string[] imgs = aimgs[i].Split(',');
|
||
strlistimages += Mtxfw.Utility.Common.GetCoverPic(imgs[0], "94x94", "cut") + "," + Mtxfw.Utility.Common.GetCoverPic(imgs[0], "458x458", "cut") + ",/image/" + imgs[0];
|
||
if (imgs.Length == 2)
|
||
{
|
||
if (imgs[1] != "")
|
||
{
|
||
strlistimages += "," + imgs[1];
|
||
}
|
||
}
|
||
strlistimages += "|";
|
||
}
|
||
}
|
||
P_VIP_P0 = model.P_VIP_P.ToString("f2");
|
||
P_VIP_P1 = model.P_VIP_P1.ToString("f2");
|
||
P_VIP_P2 = model.P_VIP_P2.ToString("f2");
|
||
P_Market_P = model.P_Market_P.ToString("f2");
|
||
P_M_P = model.P_M_P.ToString();
|
||
P_VIP_P = model.P_VIP_P.ToString("f2");
|
||
P_VIP_CP = (model.P_Market_P - model.P_VIP_P).ToString("f2");
|
||
/*if (MemberIFStores == 0)
|
||
{
|
||
strP_VIP_P = "初级会员价格";
|
||
P_VIP_P = model.P_VIP_P.ToString("f2");
|
||
P_VIP_CP = (model.P_Market_P - model.P_VIP_P).ToString("f2");
|
||
}
|
||
else if (MemberIFStores == 1)
|
||
{
|
||
strP_VIP_P = "中级会员价格";
|
||
P_VIP_P = model.P_VIP_P1.ToString("f2");
|
||
P_VIP_CP = (model.P_Market_P - model.P_VIP_P1).ToString("f2");
|
||
}
|
||
else if (MemberIFStores == 2)
|
||
{
|
||
strP_VIP_P = "高级会员价格";
|
||
P_VIP_P = model.P_VIP_P2.ToString("f2");
|
||
P_VIP_CP = (model.P_Market_P - model.P_VIP_P2).ToString("f2");
|
||
}
|
||
else if (MemberIFStores == 3)
|
||
{
|
||
strP_VIP_P = "特级会员价格";
|
||
P_VIP_P = model.P_VIP_P3.ToString("f2");
|
||
P_VIP_CP = (model.P_Market_P - model.P_VIP_P3).ToString("f2");
|
||
}*/
|
||
yunfei = "运费:" + model.P_YH_P.ToString("f2");
|
||
/*if (Convert.ToDouble(P_VIP_P)>=150.00)
|
||
{
|
||
yunfei = "免运费";
|
||
}*/
|
||
P_Inventory = model.P_Inventory.ToString();
|
||
P_Orders = model.P_Orders.ToString();
|
||
P_Orders0 = model.P_Orders0.ToString();
|
||
P_Orders1 = model.P_Orders1.ToString();
|
||
P_Orders2 = model.P_Orders2.ToString();
|
||
int P_CATEGORY = model.P_CATEGORY;
|
||
string PNAME = model.PNAME;
|
||
P_PJOrders = model.P_PJOrders.ToString();
|
||
P_SCOrders = model.P_SCOrders.ToString();
|
||
P_DESCRIPTION = model.P_DESCRIPTION;
|
||
P_DESCRIPTION1 = model.P_DESCRIPTION1;
|
||
P_DESCRIPTION2 = model.P_DESCRIPTION2;
|
||
P_ADDATE = model.P_ADDATE.ToString();
|
||
P_HITED = model.P_HITED.ToString();
|
||
P_ID = model.P_ID.ToString();
|
||
P_JiangLi = model.P_JiangLi.ToString();
|
||
P_JiangLi3 = model.P_JiangLi3.ToString();
|
||
P_utype = model.utype.ToString();
|
||
if (model.utype == "1")
|
||
{
|
||
strdisplay = "display:none;";
|
||
//stryhtit = "优惠价格";
|
||
|
||
}
|
||
else
|
||
{
|
||
P_JiangLi = "" + P_JiangLi + "";
|
||
}
|
||
Page.Title = TitName + "-" + config.webName;
|
||
strCATEGORY = PNAME;
|
||
if (model.P_yanse.Trim() != "")
|
||
{
|
||
strColors += "<span>选择颜色:</span>";
|
||
string[] straColor = model.P_yanse.Split('|');
|
||
int j = 0;
|
||
string strselcolor = "";
|
||
foreach (string str in straColor)
|
||
{
|
||
if (str.Trim() != "")
|
||
{
|
||
string[] stra = str.Split('#');
|
||
if (strselcolor == "")
|
||
{
|
||
strselcolor = (strayanse == "" ? (j == 0 ? str : "") : (strayanse == str ? str : ""));
|
||
}
|
||
strColors += "<span class=\"colorbox" + (strayanse == "" ? (j == 0 ? " selected" : "") : (strayanse == str ? " selected" : "")) + "\" id=\"colorbox" + j + "\" onclick=\"selcolor('" + str.Trim() + "'," + j + ")\">" + (strayanse == "" ? (j == 0 ? "<em></em>" : "") : (strayanse == str ? "<em></em>" : "")) + "<span class=\"colortit\">" + stra[0] + "</span></span>";
|
||
j += 1;
|
||
}
|
||
}
|
||
strColors += "<input id=\"IFSelColor\" value=\"" + strselcolor + "\" type=\"hidden\" />";
|
||
}
|
||
Mtxfw.Model.P_Category daoModel = daoCategory.GetModel(P_CATEGORY);
|
||
if (daoModel != null)
|
||
{
|
||
if (daoModel.C_Layer == 3)
|
||
{
|
||
Mtxfw.Model.P_Category daoModel2 = daoCategory.GetModel(daoModel.C_PARENTID);
|
||
if (daoModel2 != null)
|
||
{
|
||
if (daoModel2.C_Layer == 2)
|
||
{
|
||
strposition = "<a href=\"/search-" + daoModel2.C_PARENTID + "\">" + daoModel2.CNAME + "</a> > <a href=\"/search-" + daoModel.C_PARENTID + ".html\">" + daoModel2.C_NAME + "</a> > <a href=\"/search-" + P_CATEGORY + ".html\">" + PNAME + "</a> > ";
|
||
}
|
||
}
|
||
}
|
||
else if (daoModel.C_Layer == 2)
|
||
{
|
||
strposition = "<a href=\"/search-" + daoModel.C_PARENTID + ".html\">" + daoModel.CNAME + "</a> > <a href=\"/search-" + P_CATEGORY + ".html\">" + PNAME + "</a> > ";
|
||
}
|
||
else
|
||
{
|
||
strposition = "<a href=\"/search-" + P_CATEGORY + ".html\">" + PNAME + "</a> > ";
|
||
}
|
||
}
|
||
strposition += "商品详情";
|
||
Page.MetaDescription = TitName + "-" + config.webDescription;
|
||
Page.MetaKeywords = TitName + "," + config.webKeywords.Replace("广西", strprovincename);
|
||
daoProduct.Update(ID, "P_Orders2", "1");
|
||
int Recount = 0;
|
||
int Start = 0;
|
||
int Limit = 10;
|
||
int intPage = 1;
|
||
if (!String.IsNullOrEmpty(Request.QueryString["pingxlunpage"]))
|
||
{
|
||
intPage = int.Parse(Request.QueryString["pingxlunpage"].ToString());
|
||
}
|
||
Start = Limit * (intPage - 1);
|
||
DataSet pds = daoGuest.GetDataSet("createtime Desc", "ID,GuestName,GuestContact,Message,CreateTime,BusinessID,IsShow,IsShow2,starlevel,zannum", "ttype=0 And IsShow=1 And businessid=" + ID, Start, Limit, out Recount);
|
||
if (pds.Tables[1].Rows.Count > 0)
|
||
{
|
||
foreach (DataRow pdrv in pds.Tables[1].Rows)
|
||
{
|
||
pinglun_content += "<ul class=\"detail_pinglun_listbox\">";
|
||
pinglun_content += " <li class=\"pinglun_listbox_top\"><span class=\"name\"><img src=\"/images/peopleicon_05.gif\" width=\"20\"/> " + pdrv["GuestName"].ToString() + "</span><span class=\"time\">" + pdrv["createtime"].ToString() + "</span></li>";
|
||
pinglun_content += "<li class=\"pinglun_listbox_content\">";
|
||
pinglun_content += "<span class=\"pingfen\"><label>评分:</label>" + Mtxfw.Utility.Common.cstarlevel(pdrv["starlevel"].ToString()) + "</span>";
|
||
pinglun_content += "<span class=\"content\">内容:<font color=\"#333\">" + pdrv["message"].ToString() + "</font></span>";
|
||
pinglun_content += "<span class=\"zan\" id=\"zan" + pdrv["id"].ToString() + "\" onclick=\"zanpinglun(" + pdrv["id"].ToString() + ")\">赞(<label>" + pdrv["zannum"].ToString() + "</label>)</span>";
|
||
pinglun_content += "</li>";
|
||
pinglun_content += "</ul><div class=\"clear\"></div>";
|
||
}
|
||
}
|
||
pds.Tables.Clear();
|
||
|
||
pinglun_pages = Mtxfw.Utility.PageStatic.GetPages2(Recount, Limit, intPage, 0, ID);
|
||
Recount = 0;
|
||
Start = 0;
|
||
Limit = 10;
|
||
intPage = 1;
|
||
if (!String.IsNullOrEmpty(Request.QueryString["wendapage"]))
|
||
{
|
||
intPage = int.Parse(Request.QueryString["wendapage"].ToString());
|
||
}
|
||
Start = Limit * (intPage - 1);
|
||
pds = daoGuest.GetDataSet("createtime Desc", "ID,GuestName,GuestContact,Message,Message2,CreateTime,BusinessID,IsShow,IsShow2,starlevel,zannum", "ttype=1 And IsShow=1 And businessid=" + ID, Start, Limit, out Recount);
|
||
if (pds.Tables[1].Rows.Count > 0)
|
||
{
|
||
foreach (DataRow pdrv in pds.Tables[1].Rows)
|
||
{
|
||
wenda_content += "<ul class=\"detail_pinglun_listbox\">";
|
||
wenda_content += " <li class=\"pinglun_listbox_top\"><span class=\"name\">" + pdrv["GuestName"].ToString() + "</span><span class=\"time\">" + pdrv["createtime"].ToString() + "</span></li>";
|
||
wenda_content += "<li class=\"pinglun_listbox_content\">"; ;
|
||
wenda_content += "<span class=\"content\">问题:<font color=\"#333\">" + pdrv["message"].ToString() + "</font></span>";
|
||
wenda_content += "<span class='content'>回答:<font color='#333'>" + (pdrv["message2"].ToString() == "" ? "<span id=\"wyhd" + pdrv["id"].ToString() + "\" class=\"wyhd\" onclick=\"wyhd(" + pdrv["id"].ToString() + ",'@" + pdrv["GuestName"].ToString() + ":')\">我要回答</span>" : (pdrv["IsShow2"].ToString() == "0" ? "等待审核中..." : pdrv["message2"].ToString())) + "</font></span>";
|
||
wenda_content += "<span class=\"zan\" id=\"zan" + pdrv["id"].ToString() + "\" onclick=\"zanpinglun(" + pdrv["id"].ToString() + ")\">赞(<label>" + pdrv["zannum"].ToString() + "</label>)</span>";
|
||
wenda_content += "</li>";
|
||
wenda_content += "</ul><div class=\"clear\"></div>";
|
||
}
|
||
}
|
||
pds.Tables.Clear();
|
||
|
||
wenda_pages = Mtxfw.Utility.PageStatic.GetPages2(Recount, Limit, intPage, 1, ID);
|
||
}
|
||
}
|
||
protected String GetProvince()
|
||
{
|
||
StringBuilder sb = new StringBuilder();
|
||
Mtxfw.DAL.province daoPro = new Mtxfw.DAL.province();
|
||
System.Data.DataSet Ds = daoPro.GetCacheList("", "1=1 Order by ProvinceID Asc", "Province");
|
||
System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null;
|
||
foreach (System.Data.DataRow Dr in Dt.Rows)
|
||
{
|
||
string strProvinceName = Dr["ProvinceName"].ToString().Replace("省", "").Replace("市", "");
|
||
sb.Append("<li id=\"P_" + Dr["ProvinceID"] + "\" onclick='onprovince(\"" + Dr["ProvinceID"] + "\",\"" + strProvinceName + "\",\"" + Convert.ToDouble(Dr["YFmoney"]).ToString("f2") + "\")'>" + strProvinceName + "</li>\n");
|
||
}
|
||
return sb.ToString();
|
||
}
|
||
|
||
|
||
}
|
||
} |