/// <summary> /// 获取地址详细 /// </summary> void GetUserAddress() { string daid = string.Empty; if (Request["daid"] != null && Request["daid"] != "") { daid = Common.Common.NoHtml(Request["daid"]); } if (daid != null && daid != "") { MSDeliveryAddressDAL adressDal = new MSDeliveryAddressDAL(); DataSet ds = new DataSet(); ds = adressDal.GetDADetail(daid); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { Response.Write(Dataset2Json(ds)); } else { Response.Write("{\"error\":true}"); } } else { Response.Write("{\"error\":true}"); } Response.End(); }
/// <summary> /// 设置收货地址 /// </summary> void setUserAddress() { string uname = string.Empty; string uphone = string.Empty; string address = string.Empty; string zipcode = string.Empty; string dadetail = string.Empty; string updaid = string.Empty; #region -------------------获取请求信息---------------------- if (Request["uname"] != null && Request["uname"] != "") { uname = Common.Common.NoHtml(Request["uname"]); } if (Request["uphone"] != null && Request["uphone"] != "") { uphone = Common.Common.NoHtml(Request["uphone"]); } if (Request["address"] != null && Request["address"] != "") { address = Request["address"]; } if (Request["dadetail"] != null && Request["dadetail"] != "") { dadetail = Common.Common.NoHtml(Request["dadetail"]); } if (Request["zipcode"] != null && Request["zipcode"] != "") { zipcode = Common.Common.NoHtml(Request["zipcode"]); } if (Request["daid"] != null && Request["daid"] != "") { updaid = Common.Common.NoHtml(Request["daid"]); } #endregion MSDeliveryAddress daModel = new MSDeliveryAddress(); MSDeliveryAddressDAL daDal = new MSDeliveryAddressDAL(); #region ---------------设置Model属性--------------------------- if (uname != null && uname != "") { daModel.DaName = uname; } if (uphone != null && uphone != "") { daModel.DaPhone = uphone; } if (address != null && address != "") { daModel.DaAddress = address; } if (dadetail != null && dadetail != "") { daModel.AddressDetail = dadetail; } if (zipcode != null && zipcode != "") { daModel.DaZipCode = zipcode; } daModel.UID = customid; #endregion if (action != null && action != "" && action.Trim().ToLower() == "updalist" && updaid != null && updaid != "") { daModel.ID = updaid; if (daDal.UpdateDA(daModel)) { Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true}"); } } else { daModel.ID = Guid.NewGuid().ToString("N").ToUpper(); if (daDal.AddDA(daModel)) { Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true}"); } } Response.End(); }
/// <summary> /// 获取购物信息 /// </summary> void GetInfo() { #region 产品详细 MSProductDAL productDal = new MSProductDAL(); MSProduct productModel = new MSProduct(); DataSet productds = productDal.GetProductDetail(strpid); MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); MSProductAtlas atlasdetailmodel = null; DataSet atlasDs = null; if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0) { productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]); } #endregion #region 获取产品默认展示图 atlasDs = atlasDal.GetDefaultAtlasByPid(strpid); foreach (DataRow atlasrow in atlasDs.Tables[0].Rows) { atlasdetailmodel = DataConvert.DataRowToModel <MSProductAtlas>(atlasrow); } #endregion #region -----------获取型号尺码---------------- MSProductPara paraModel = new MSProductPara(); MSProductParaDAL paraDal = new MSProductParaDAL(); DataSet parads = paraDal.GetParaDetail(mid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { paraModel = DataConvert.DataRowToModel <MSProductPara>(parads.Tables[0].Rows[0]); } #endregion #region 获取收货地址 MSDeliveryAddressDAL addressDal = new MSDeliveryAddressDAL(); MSDeliveryAddress defaultadModel = new MSDeliveryAddress(); List <MSDeliveryAddress> damodellist = new List <MSDeliveryAddress>(); string stradwhere = string.Empty; stradwhere = "and [UID]='" + customid + "' "; DataSet addressds = addressDal.GetDAList(3, stradwhere); if (null != addressds && addressds.Tables.Count > 0 && addressds.Tables[0].Rows.Count > 0) { foreach (DataRow row in addressds.Tables[0].Rows) { MSDeliveryAddress damodel = DataConvert.DataRowToModel <MSDeliveryAddress>(row); damodellist.Add(damodel); } } #endregion string customerphone = string.Empty; MSCustomers customerModel = new MSCustomers(); if (customid != null && customid != "") { MSCustomersDAL CustomerDal = new MSCustomersDAL(); DataSet customerds = CustomerDal.GetCustomerDetail(customid); if (customerds != null && customerds.Tables.Count > 0 && customerds.Tables[0].Rows.Count > 0) { customerModel = DataConvert.DataRowToModel <MSCustomers>(customerds.Tables[0].Rows[0]); } } string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/setOrder.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["productdetail"] = productModel; context.TempData["atlas"] = atlasdetailmodel; context.TempData["paramodel"] = paraModel; context.TempData["errorscript"] = errorscript; context.TempData["dalist"] = damodellist; context.TempData["customer"] = customerModel; context.TempData["openid"] = openid; context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }