using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Data.SqlClient; using System.Drawing; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Text; namespace Mtxfw.shop { /// /// myShoppingCart 的摘要说明。 /// public partial class UserQRGM : Mtxfw.Utility.MemberBase { protected string UserID = "", ShowConent = "", OrdersID=""; protected String pid = "", cid = "", qid = "", strName = "", strPhone = "", strMailingAddress = "", strPostalCode = "", addresslist = "", yunfei = "0.00", YHJlist = "", strZE = "", XFBYE = "0", JFYE = "0", hidTotal="0"; public Mtxfw.DAL.user_info daoUser = new Mtxfw.DAL.user_info(); public Mtxfw.DAL.P_Product daoProduct = new Mtxfw.DAL.P_Product(); protected int IFaddress = 0; protected Double umoney19 = 0; protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!Page.IsPostBack) { DataSet ds = new DAL.user_address().GetList("", "UserID=" + Card); if (ds.Tables[0].Rows.Count > 0) { int i = 0; foreach (DataRow dr in ds.Tables[0].Rows) { addresslist += "
  • 编辑 删除"; if (dr["IFIndex"].ToString() == "1") { addresslist += " 默认地址"; //yunfei = new DAL.province().GetYFmoney(dr["Province"].ToString()).ToString("f2"); } else { addresslist += " 设为默认地址"; } addresslist += "
  • "; i += 1; } addresslist += "
  •  使用新地址
  • "; } else { addresslist += "
  •  使用新地址
  • "; IFaddress = 1; } ds.Clear(); if (Request.QueryString["CartID"] != null) { OrdersID = Mtxfw.Utility.Tools.SafeSQL(Request.QueryString["CartID"].ToString()); /*ds = new DAL.order_info().GetList("(Select P_NAME from P_Product b where b.P_ID=a.pid) as prodName,(Select P_images from P_Product b where b.P_ID=a.pid) as prodimg,(select P_JiangLi from P_Product c where c.P_ID=a.pid) as P_JiangLi,", "utype='2' And UserID=" + Card + " And IFDelete=0 And O_received=0"); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { YHJlist += "
  •  " + dr["prodName"].ToString() + " ¥" + Convert.ToDouble(dr["P_JiangLi"]).ToString("f2") + "
  • "; } } else { YHJlist += "
  • 您还没有优惠卷,进入 积分专区 兑换优惠卷
  • "; } ds.Clear();*/ myDataBind(0); } else { if (!String.IsNullOrEmpty(Request.QueryString["id"])) { OrdersID = Request.QueryString["id"].ToString(); myDataBind(Convert.ToInt32(OrdersID)); } } } } private void myDataBind(int id) { Mtxfw.Model.user_info model = daoUser.GetModel(Card); if (model != null) { IFStores = model.IFStores; umoney19 = model.umoney19; if (model.RealName == "") { if (model.NCName == "") { strName = model.UserName; } else { strName = model.NCName; } } else { strName = model.RealName; } strPhone = model.Phone; strMailingAddress = model.MailingAddress; strPostalCode = model.PostalCode; pid = model.Province; cid = model.City; qid = model.County; JFYE = (model.umoney30 - model.umoney31).ToString("f0"); string strprovince = "", strcity = "", strcounty=""; if (Request.Cookies["province"] != null) { HttpCookie myCookie = Request.Cookies["province"]; strprovince = HttpUtility.UrlDecode(myCookie.Value); } if (Request.Cookies["city"] != null) { HttpCookie myCookie = Request.Cookies["city"]; strcity = HttpUtility.UrlDecode(myCookie.Value); } if (Request.Cookies["county"] != null) { HttpCookie myCookie = Request.Cookies["county"]; strcounty = HttpUtility.UrlDecode(myCookie.Value); } if (strprovince != "" && strcity != "" && strcounty != "") { if (strprovince.IndexOf(pid) == -1 && strcity.IndexOf(cid) == -1 && strcounty.IndexOf(qid) == -1) { pid = strprovince.Split('|')[0]; cid = strcity.Split('|')[0]; qid = strcounty.Split('|')[0]; strMailingAddress = ""; } } if (yunfei == "0.00" && pid != "-1") { //yunfei = new DAL.province().GetYFmoney(pid).ToString("f2"); } } if (id > 0) { //ShowConent += "商家名称:"; //ShowConent += "荞宝"; Double YFmoney = 0.00; Mtxfw.Model.P_Product pmodel = daoProduct.GetModel(id); if (pmodel != null) { YFmoney = pmodel.P_YH_P; Double ZSubTotal = pmodel.P_VIP_P + YFmoney; string selcolor = ""; //ShowConent += "  运费:¥" + YFmoney.ToString("f2") + ""; ShowConent += ""; ShowConent += "
    " + pmodel.P_NAME + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "
    "; ShowConent += ""; ShowConent += "¥" + YFmoney.ToString("f2") + ""; ShowConent += "1¥" + (pmodel.P_VIP_P + YFmoney).ToString("f2") + ""; ShowConent += ""; ShowConent += "
    商品总价(包含运费):¥" + ZSubTotal.ToString("f2").Replace(",", "") + "元"; hidTotal = ZSubTotal.ToString("f2").Replace(",", ""); ShowConent += " 
    "; } } else { DataView dv = Mtxfw.DAL.ShoppingCart.Getprod(IFStores); if (dv.Count > 0) { string CFOIDs = ","; for (int j = 0; j <= dv.Count - 1; j++) { string prodid = dv.Table.Rows[j]["prodid"].ToString(); if (OrdersID.IndexOf("," + prodid + ",") != -1) { string SUserID = dv.Table.Rows[j]["SUserID"].ToString(); if (CFOIDs == "") { CFOIDs = "," + SUserID + ","; } else { if (CFOIDs.IndexOf("," + SUserID + ",") == -1) { CFOIDs += SUserID + ","; } } } } string[] ACFOIDs = CFOIDs.Split(','); Double ZSubTotal = 0.00; Double ZYFmoney = 0.00; foreach (string stra in ACFOIDs) { if (stra != "") { ShowConent += "商家名称:"; if (stra != "0") { string strUserName = daoUser.Getzd("UserName", "ID=" + stra).ToString(); ShowConent += strUserName; } else { ShowConent += "荞宝"; } Double YFmoney = 0.00; for (int j = 0; j <= dv.Count - 1; j++) { string prodid = dv.Table.Rows[j]["prodid"].ToString(); string SUserID = dv.Table.Rows[j]["SUserID"].ToString(); if (Request.QueryString["CartID"].ToString().IndexOf("," + prodid + ",") != -1 && stra == SUserID) { Double SPYH = Convert.ToDouble(dv.Table.Rows[j]["SPYH1"].ToString()); if (Convert.ToDouble(YFmoney.ToString("f2")) == 0.00 && Convert.ToDouble(SPYH.ToString("f2")) > 0.00) { YFmoney = SPYH; } } } ShowConent += "  运费:¥" + YFmoney.ToString("f2") + ""; ZYFmoney += YFmoney; for (int j = 0; j <= dv.Count - 1; j++) { string prodid = dv.Table.Rows[j]["prodid"].ToString(); string SUserID = dv.Table.Rows[j]["SUserID"].ToString(); if (Request.QueryString["CartID"].ToString().IndexOf("," + prodid + ",") != -1 && stra == SUserID) { string utype = dv.Table.Rows[j]["utype"].ToString(); string strid = dv.Table.Rows[j]["id"].ToString(); string prodName = dv.Table.Rows[j]["prodName"].ToString(); string P_CATEGORYs = dv.Table.Rows[j]["P_CATEGORYs"].ToString(); string selcolor = HttpUtility.UrlDecode(dv.Table.Rows[j]["selcolor"].ToString()); string prodimg = dv.Table.Rows[j]["prodimg"].ToString().Split('|')[0].Split(',')[0]; if (prodimg == "") { prodimg = "/Images/no_photo_s.png"; } string prodPrice = Convert.ToDouble(dv.Table.Rows[j]["prodPrice"].ToString()).ToString("f2").Replace(",", ""); string prodNum = dv.Table.Rows[j]["prodNum"].ToString(); string TotalNum = dv.Table.Rows[j]["TotalNum"].ToString(); string SubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString()).ToString("f2").Replace(",", ""); string IFMJCDYH = dv.Table.Rows[j]["IFMJCDYH"].ToString(); Double XSubTotal = Convert.ToDouble(dv.Table.Rows[j]["SubTotal"].ToString()); ZSubTotal = ZSubTotal + XSubTotal; ShowConent += ""; if (utype == "3") { ShowConent += "" + prodName + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + ""; } else { ShowConent += "
    " + prodName + (selcolor.Split('#')[0] != "" ? "[" + selcolor.Split('#')[0] + "]" : "") + "
    "; } ShowConent += ""; ShowConent += "¥" + prodPrice + ""; ShowConent += "" + prodNum + "¥" + SubTotal + ""; /*if (IFMJCDYH == "1") { ShowConent += ""; } else { ShowConent += ""; }*/ ShowConent += ""; if (utype == "3") { ShowConent += "
    "; } } } } } ZSubTotal += ZYFmoney; strZE = ZSubTotal.ToString("f0"); ShowConent += "
    商品总价(包含运费):¥" + ZSubTotal.ToString("f2").Replace(",", "") + "元"; hidTotal = ZSubTotal.ToString("f2").Replace(",", ""); ShowConent += " 
    "; } dv.Table.Clear(); } } 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 Id Asc", "Province"); System.Data.DataTable Dt = (Ds != null && Ds.Tables[0] != null) ? Ds.Tables[0] : null; foreach (System.Data.DataRow Dr in Dt.Rows) { sb.Append("\r\n"); } return sb.ToString(); } } }