protected void Page_Load(object sender, EventArgs e) { if (null != Common.Common.NoHtml(Request.QueryString["action"])) { strAction = Common.Common.NoHtml(Request.QueryString["action"]); } if (null != Common.Common.NoHtml(Request.QueryString["id"])) { strID = Common.Common.NoHtml(Request.QueryString["id"]); } MSProductParaDAL dal = new MSProductParaDAL(); switch (strAction) { case "del": if (dal.UpdateMSPParaState(strID)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; } Response.Write(strMessage); Response.End(); }
protected void btnSave_Click(object sender, EventArgs e) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { if (paraname.Text.Trim() != null && paraname.Text.Trim() != "" && paravalue.Text.Trim() != null && paravalue.Text.Trim() != "") { MSProductParaDAL ParaDal = new MSProductParaDAL(); MSProductPara paraModel = new MSProductPara(); paraModel.ParName = paraname.Text; paraModel.ParState = 0; paraModel.ID = strID; //paraModel.ParValue = paravalue.Text; if (ParaDal.UpdateMSPPara(paraModel)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } else { MessageBox.Show(this, "请输入相应名称或参数值!"); } } else { return; } }
void showdetailinfo() { MSProductParaDAL ParaDal = new MSProductParaDAL(); DataSet ParaDs = ParaDal.GetParaDetail(strID); MSProductPara ParaModel = DataConvert.DataRowToModel <MSProductPara>(ParaDs.Tables[0].Rows[0]); paraname.Text = ParaModel.ParName; //paravalue.Text = ParaModel.ParValue; if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { MSProductParaDAL paraDal = new MSProductParaDAL(); DataSet ds = paraDal.GetMSPParaList(strWhere); DataView dv = ds.Tables[0].DefaultView; AspNetPager1.RecordCount = dv.Count; PagedDataSource pds = new PagedDataSource(); pds.DataSource = dv; pds.AllowPaging = true; pds.CurrentPageIndex = AspNetPager1.CurrentPageIndex - 1; pds.PageSize = AspNetPager1.PageSize; Repeater1.DataSource = pds; Repeater1.DataBind(); }
protected void btnSave_Click(object sender, EventArgs e) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { bool rowcount = false; MSProductParaDAL paraDal = new MSProductParaDAL(); rowcount = paraDal.ExistMSPPara("", strID); if (pname.Text.Trim() != null && pname.Text.Trim() != "" && price.Text.Trim() != null && price.Text.Trim() != "") { MSProductDAL productdal = new MSProductDAL(); MSProduct productmodel = new MSProduct(); productmodel.Pstate = 0; productmodel.ID = strID; productmodel.Ptitle = pname.Text; if (rowcount == true) { productmodel.Price = 0; } else { productmodel.Price = decimal.Parse(price.Text); } productmodel.Pcontent = hd_content.Value; productmodel.IsSecHand = isstateno.Checked ? 0 : 1; if (productdal.UpdateMSProduct(productmodel)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } else { MessageBox.Show(this, "请输入相应标题或价格!"); } } else { return; } }
protected void btnSave_Click(object sender, EventArgs e) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { if (paraname.Text.Trim() != null && paraname.Text.Trim() != "" && paravalue.Text.Trim() != null && paravalue.Text.Trim() != "" && setpvalue.Value.Trim() != null && setpvalue.Value.Trim() != "") { MSProductParaDAL ParaDal = new MSProductParaDAL(); if (ParaDal.ExistMSPPara(paraname.Text, setpvalue.Value)) { MessageBox.Show(this, "该参数已经存在!"); } else { MSProductPara paraModel = new MSProductPara(); paraModel.PID = setpvalue.Value; paraModel.ParName = paraname.Text; //paraModel.ParValue = paravalue.Text; paraModel.ParState = 0; paraModel.ID = Guid.NewGuid().ToString("N").ToUpper(); if (ParaDal.AddMSPPara(paraModel)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } } else { MessageBox.Show(this, "请选择相应产品或参数值!"); } } else { return; } }
/// <summary> /// 删除型号 /// </summary> void DelPara() { string pr = string.Empty; if (Request["pr"] != null && Request["pr"] != "") { pr = Common.Common.NoHtml(Request["pr"]); } MSProductParaDAL paraDal = new MSProductParaDAL(); if (pr != null && pr != "") { if (paraDal.UpdateMSPParaState(pr)) { Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true}"); } } Response.End(); }
/// <summary> /// 添加属性列表 /// </summary> bool AddProductModel() { string isnull = ""; bool result = false; if (Request["m"] != null && Request["m"] != "") { try { mcount = Convert.ToInt32(Common.Common.NoHtml(Request["m"])); } catch (Exception) { } } if (mcount > 0) { MSProductParaDAL paraDal = new MSProductParaDAL(); for (int i = 0; i < mcount; i++) { string m_model = string.Empty; string m_price = string.Empty; string m_stock = string.Empty; int stock = 0; #region --------------------获取model值--------------------- try { m_model = HttpContext.Current.Request.Form.Get("model" + i).ToString(); } catch (Exception) { m_model = isnull; } try { m_price = HttpContext.Current.Request.Form.Get("mprice" + i).ToString(); } catch (Exception) { m_price = isnull; } try { m_stock = HttpContext.Current.Request.Form.Get("mstock" + i).ToString(); } catch (Exception) { m_stock = isnull; } if (m_stock != null && m_stock != "") { try { stock = Convert.ToInt32(m_stock); } catch (Exception) { } } #endregion MSProductPara paraModel = new MSProductPara(); paraModel.ParName = m_model; paraModel.Price = Convert.ToDecimal(m_price); paraModel.Stock = Convert.ToInt32(stock); paraModel.ID = Guid.NewGuid().ToString("N").ToUpper(); paraModel.PID = pid; if (paraDal.AddMSPPara(paraModel)) { result = true; } } } return(result); }
void GetProductDetail() { string ptitle = string.Empty; string shopID = string.Empty; string puid = string.Empty; int paracount = 0; #region 产品详细 MSProductDAL productDal = new MSProductDAL(); MSProduct productModel = new MSProduct(); DataSet productds = productDal.GetProductDetail(strpid); if (null != productds && productds.Tables.Count > 0 && productds.Tables[0].Rows.Count > 0) { productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]); ptitle = productModel.Ptitle; puid = productModel.CustomerID; if (productModel.SID != null && productModel.SID != "") { shopID = productModel.SID; } } #endregion #region 店铺详细 MSShop shopModel = new MSShop(); if (shopID != null && shopID != "") { MSShopDAL shopDal = new MSShopDAL(); DataSet shopds = shopDal.GetMSShopDetail(shopID); if (shopds != null && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0) { shopModel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]); } } #endregion #region 图集列表 MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); List <MSProductAtlas> AtlasListModel = new List <MSProductAtlas>(); DataSet atlasds = atlasDal.GetProductAtlasByPID(strpid); if (null != atlasds && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { foreach (DataRow row in atlasds.Tables[0].Rows) { MSProductAtlas atlasModel = DataConvert.DataRowToModel <MSProductAtlas>(row); AtlasListModel.Add(atlasModel); } } #endregion #region 产品参数列表 //MSProductParaDAL paraDal = new MSProductParaDAL(); //DataSet paramds = paraDal.GetProductParamByPID(strpid); //string paramlist = string.Empty; //if (null != paramds && paramds.Tables.Count > 0 && paramds.Tables[0].Rows.Count > 0) //{ // for (int i = 0; i < paramds.Tables[0].Rows.Count; i++) // { // paramlist += "<tr>\r\n"; // string paraname = paramds.Tables[0].Rows[i]["ParName"].ToString(); // string paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString(); // paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n"; // try // { // i = i + 1; // paraname = paramds.Tables[0].Rows[i]["ParName"].ToString(); // paravalue = paramds.Tables[0].Rows[i]["ParValue"].ToString(); // paramlist += "<td class=\"td_title\">" + paraname + "</td><td>" + paravalue + "</td>\r\n"; // } // catch (Exception) // { // paramlist += "<td class=\"td_title\"> </td><td> </td>\r\n"; // } // paramlist += "</tr>\r\n"; // } //} #endregion #region -------获取产品型号及价格------------ ProductPara ParaModel = new ProductPara(); List <MSProductPara> paralistmodel = new List <MSProductPara>(); MSProductParaDAL paraDal = new MSProductParaDAL(); DataSet parads = paraDal.GetMaxMinPrice(strpid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { paracount = parads.Tables[0].Rows.Count; ParaModel = DataConvert.DataRowToModel <ProductPara>(parads.Tables[0].Rows[0]); } parads = null; parads = paraDal.GetProductParamByPID(strpid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { foreach (DataRow item in parads.Tables[0].Rows) { MSProductPara paramodel = DataConvert.DataRowToModel <MSProductPara>(item); paralistmodel.Add(paramodel); } } #endregion #region ----------------根据产品编号获取联系方式-------------------- MSShopContactsDAL contactDal = new MSShopContactsDAL(); MSShopContacts contactModel = new MSShopContacts(); DataSet contactDs = contactDal.GetContactDetailByPID(strpid); MSCustomersDAL CustomerDal = new MSCustomersDAL(); MSCustomers CustomerModel = new MSCustomers(); DataSet PuidDs = null; int contactcount = 0; if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0) { contactModel = DataConvert.DataRowToModel <MSShopContacts>(contactDs.Tables[0].Rows[0]); contactcount = 1; } else { if (puid != null && puid != "") { PuidDs = CustomerDal.GetCustomerDetail(puid); } if (PuidDs != null && PuidDs.Tables.Count > 0 && PuidDs.Tables[0].Rows.Count > 0) { CustomerModel = DataConvert.DataRowToModel <MSCustomers>(PuidDs.Tables[0].Rows[0]); } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/Product_detail.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = ptitle; if (shopModel != null) { context.TempData["shopdetail"] = shopModel; } context.TempData["productdetail"] = productModel; context.TempData["atlaslist"] = AtlasListModel; if (contactcount > 0) { context.TempData["contactdetail"] = contactModel; } else { context.TempData["contactdetail"] = CustomerModel; } context.TempData["customid"] = customid; //context.TempData["paramlist"] = paramlist; context.TempData["paracount"] = paracount; context.TempData["paramodel"] = ParaModel; context.TempData["paralist"] = paralistmodel; context.TempData["footer"] = "奥琦微商易"; context.TempData["errorscript"] = errorscript; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
/// <summary> /// 把购物车添加到订单 /// </summary> void setAddOrder() { string uname = string.Empty; string uphone = string.Empty; string address = string.Empty; string payway = string.Empty; string carryway = string.Empty; string countcost = string.Empty; string leavemsg = string.Empty; string zipcode = string.Empty; string num = string.Empty; #region --------------获取请求信息--------------- if (Request["num"] != null && Request["num"] != "") { num = Request["num"]; } 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["payway"] != null && Request["payway"] != "") { payway = Common.Common.NoHtml(Request["payway"]); } if (Request["carryway"] != null && Request["carryway"] != "") { carryway = Common.Common.NoHtml(Request["carryway"]); } if (Request["countcost"] != null && Request["countcost"] != "") { countcost = Common.Common.NoHtml(Request["countcost"]); } if (Request["leavemsg"] != null && Request["leavemsg"] != "") { leavemsg = Common.Common.NoHtml(Request["leavemsg"]); } if (Request["zipcode"] != null && Request["zipcode"] != "") { zipcode = Common.Common.NoHtml(Request["zipcode"]); } #endregion if (customid.Trim() != null && customid.Trim() != "") { MSShoppingCartDAL cartDal = new MSShoppingCartDAL(); MSProductOrderDAL OrderDal = new MSProductOrderDAL(); if (OrderDal.ExistOrderByUID(customid, strpid)) { Response.Write("{\"error\":true,\"exist\":true}"); } else { try { string strOrdernum = cartDal.SubOrder(customid, uname, uphone, leavemsg, address, zipcode, strpid, countcost, num, mid); if (strOrdernum != null && strOrdernum != "") { strSiteCode = "VYIGO"; MSOrderLogDAL.AddMSOrderLog("客户【" + customid + "】下单成功,订单号为【" + strOrdernum + "】"); MSProductDAL productDal = new MSProductDAL(); string pnam = string.Empty; if (strpid != null && strpid != "") { pnam = productDal.GetMSProductVaueByID("Ptitle", strpid).ToString(); } #region -发消息到店铺注册用户 string p_uid = string.Empty; string p_openid = string.Empty; if (strpid != null && strpid != "") { try { p_uid = productDal.GetMSProductVaueByID("CustomerID", strpid).ToString(); } catch (Exception) { } } if (p_uid != null && p_uid != "") { MSCustomersDAL P_UDal = new MSCustomersDAL(); try { p_openid = P_UDal.GetCustomerValueByID("OpenID", p_uid).ToString(); } catch (Exception) { } } if (p_openid != null && p_openid != "" && strSiteCode != null && strSiteCode != "") { JQDialog.SendWeiXinMsg(strSiteCode, p_openid, "亲爱的店长大人,您的宝贝【" + pnam + "】已于" + DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss") + "被" + uname + "成功买下,单号【" + strOrdernum + "】赶紧去小店看看吧!"); } MSOrderLogDAL.AddMSOrderLog("下单成功,通知到OpenID为【" + p_openid + "】的店长"); #endregion #region -产品属性 MSProductParaDAL paraDal = new MSProductParaDAL(); int stock = 0; if (paraDal.ExistMSPPara("", strpid) && mid != null && mid != "") { try { stock = int.Parse(paraDal.GetMSPParaValueByID("Stock", mid).ToString()); } catch (Exception) { } if (stock > 0) { int buynum = 0; try { buynum = Convert.ToInt32(quantity); } catch (Exception) { } if (buynum != 0 && buynum < stock) { stock = stock - buynum; paraDal.UpdateStock(stock, mid); } } } #endregion DataSet orderds = cartDal.GetMyOrderDetail(strOrdernum); string payinfo = string.Empty; string productname = string.Empty; //用户购买的商品名称 string ordernum = string.Empty; //订单号 if (orderds != null && orderds.Tables.Count > 0 && orderds.Tables[0].Rows.Count > 0) { productname = orderds.Tables[0].Rows[0]["Ptitle"].ToString(); ordernum = orderds.Tables[0].Rows[0]["ID"].ToString(); //payinfo= WapPayHelper.BuildRequest(productname, ordernum, countcost, customid); } if (productname.Trim() != null && productname.Trim() != "" && ordernum != null && ordernum != "") { //Response.Write("{\"success\":true,\"payinfo\":\"" + payinfo + "\"}"); Response.Write("{\"success\":true,\"pname\":\"" + productname + "\",\"ordernum\":\"" + ordernum + "\",\"countcost\":\"" + countcost + "\",\"customid\":\"" + customid + "\",\"openid\":\"" + openid + "\"}"); } } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}"); } } catch (Exception) { Response.Write("{\"error\":true,\"msg\":\"操作失败,重新操作\"}"); } } } else { setCookies(); Response.Write("{\"error\":true,\"msg\":\"操作失败,请登录后再操作\",\"loginurl\":\"UserLogin.aspx\"}"); } 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); }
/// <summary> /// 获取店铺商品信息 /// </summary> void GetInfo() { #region 获取店铺详细 MSShopDAL shopdal = new MSShopDAL(); DataSet shopds = shopdal.GetMSShopDetail(shopid); MSShop shopmodel = new MSShop(); string pagetitle = string.Empty; if (null != shopds && shopds.Tables.Count > 0 && shopds.Tables[0].Rows.Count > 0) { shopmodel = DataConvert.DataRowToModel <MSShop>(shopds.Tables[0].Rows[0]); pagetitle = shopmodel.ShopName; } #endregion List <MSProduct> ProductModel = new List <MSProduct>(); MSProductDAL productdal = new MSProductDAL(); MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); List <MSProductAtlas> AtlasModel = new List <MSProductAtlas>(); List <ProductPara> ParaListModel = new List <ProductPara>(); MSProductParaDAL paraDal = new MSProductParaDAL(); string thpid = string.Empty; #region 获取产品列表 DataSet productds = null; string cid = string.Empty; string like = string.Empty; if (Request["cid"] != null && Request["cid"] != "") { cid = Common.Common.NoHtml(Request["cid"]); } if (cid.Trim() != null && cid.Trim() != "") { cid = " and a.[CID]='" + cid + "' "; } if (Request["like"] != null && Request["like"] != "") { like = Common.Common.NoHtml(Request["like"]); } if (like.Trim() != null && like.Trim() != "") { like = " and a.Ptitle like '%" + like + "%' "; } productds = productdal.GetProductList(" and a.[SID]='" + shopid + "' " + cid + like); DataSet atlasDs = null; foreach (DataRow row in productds.Tables[0].Rows) { MSProduct model = DataConvert.DataRowToModel <MSProduct>(row); string pdesc = model.Pcontent; pdesc = JQDialog.GetTextFromHTML(pdesc); if (pdesc.Length > 50) { pdesc = pdesc.ToString().Substring(0, 50) + "..."; } model.Pcontent = pdesc; ProductModel.Add(model); thpid = model.ID; #region 获取产品默认展示图 atlasDs = atlasDal.GetDefaultAtlasByPid(thpid); foreach (DataRow atlasrow in atlasDs.Tables[0].Rows) { MSProductAtlas atlasdetailmodel = DataConvert.DataRowToModel <MSProductAtlas>(atlasrow); AtlasModel.Add(atlasdetailmodel); } #endregion #region -------获取产品型号及价格------------ DataSet parads = paraDal.GetMaxMinPrice(thpid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { foreach (DataRow pararow in parads.Tables[0].Rows) { ProductPara paramodel = DataConvert.DataRowToModel <ProductPara>(pararow); ParaListModel.Add(paramodel); } } #endregion } #endregion #region 获取产品类别 List <MSProductCategory> CategoryModel = new List <MSProductCategory>(); MSProductCategoryDAL categorydal = new MSProductCategoryDAL(); DataSet categoryds = categorydal.GetMSPCList(" and a.[SID]='" + shopid + "' "); foreach (DataRow row in categoryds.Tables[0].Rows) { MSProductCategory model = DataConvert.DataRowToModel <MSProductCategory>(row); CategoryModel.Add(model); } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/MyShop.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["title"] = pagetitle; context.TempData["ShopDetail"] = shopmodel; context.TempData["shopid"] = shopid; context.TempData["productlist"] = ProductModel; context.TempData["defaultatlas"] = AtlasModel; context.TempData["categorylist"] = CategoryModel; context.TempData["paralist"] = ParaListModel; context.TempData["errormsg"] = errormsg; context.TempData["customerid"] = customerid; if (Session["customerID"] != null && Session["customerID"].ToString() != "") { context.TempData["uid"] = Session["customerID"].ToString(); } context.TempData["footer"] = "奥琦微商易"; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }
/// <summary> /// 删除订单 /// </summary> void DelOrder() { string oid = string.Empty; string uid = string.Empty; if (Request["oid"] != null && Request["oid"] != "") { oid = Common.Common.NoHtml(Request["oid"]); } if (Request["uid"] != null && Request["uid"] != "") { uid = Common.Common.NoHtml(Request["uid"]); } if (oid != null && oid != "" && uid != null && uid != "") { MSProductOrderDAL OrderDal = new MSProductOrderDAL(); if (OrderDal.UpdateOrderStateByUID(uid, oid)) { int orderquantity = 0; string mid = string.Empty; int quantity = 0; #region -更新库存 MSProductParaDAL paraDal = new MSProductParaDAL(); try { orderquantity = Convert.ToInt32(OrderDal.GetOrderDetailValueByOID("Quantity", oid).ToString()); } catch (Exception) { } if (orderquantity != null && orderquantity > 0) { try { mid = OrderDal.GetOrderDetailValueByOID("MID", oid).ToString(); } catch (Exception) { } } if (mid != null && mid != "") { try { quantity = Convert.ToInt32(paraDal.GetMSPParaValueByID("Stock", mid).ToString()); } catch (Exception) { } } #endregion if (quantity >= 0 && orderquantity > 0) { quantity = quantity + orderquantity; try { paraDal.UpdateStock(quantity, mid); } catch (Exception) { } } MSOrderLogDAL.AddMSOrderLog("订单【" + oid + "】已被客户【" + uid + "】OpenID-【" + strOpenID + "】取消,库存更新"); Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,请稍后再操作\"}"); } } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}"); } Response.End(); }
/// <summary> /// 输出到页面 /// </summary> void GetHtmlInfo() { MSProduct ProductModel = new MSProduct(); MSProductDAL ProductDal = new MSProductDAL(); MSProductCategory categoryModel = new MSProductCategory(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet detailds = null; string cid = string.Empty; string bigcid = string.Empty; #region ------------------产品详细------------------------- if (pid.Trim() != null && pid.Trim() != "") { detailds = ProductDal.GetProductDetail(pid); if (detailds != null && detailds.Tables.Count > 0 && detailds.Tables[0].Rows.Count > 0) { ProductModel = DataConvert.DataRowToModel <MSProduct>(detailds.Tables[0].Rows[0]); cid = ProductModel.Cid; } } #endregion #region -----------类别绑定--------------- if (cid != null && cid != "") { string upid = string.Empty; try { upid = categoryDal.GetMSPCategoryValueByID("UpID", cid).ToString(); } catch (Exception) { } if (upid != null && upid != "") { bigcid = upid; } else { bigcid = cid; } } #endregion #region -------------获取图集--------------- MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); DataSet atlasDs = atlasDal.GetProductAtlasByPID(pid); int rowcount = 0; atlaslist = ""; if (atlasDs != null && atlasDs.Tables.Count > 0 && atlasDs.Tables[0].Rows.Count > 0) { rowcount = atlasDs.Tables[0].Rows.Count; for (int i = 0; i < rowcount; i++) { string imgurl = atlasDs.Tables[0].Rows[i]["PimgUrl"].ToString(); string imgid = atlasDs.Tables[0].Rows[i]["ID"].ToString(); string datarow = string.Empty; atlaslist += "\r\n<dd type=\"image\">\r\n" + "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " + "onchange=\"form_pics.addImg(this);\" name=\"pics" + i + "\"><img dataid=\"" + imgid + "\" src=\"" + imgurl + "\">" + "\r\n<span onclick=\"form_pics.removeImg(this);\"> </span>\r\n" + "</dd>"; } } if (rowcount < 8) { atlaslist += "\r\n<dd>\r\n" + "<input type=\"file\" accept=\"image/jpg, image/jpeg, image/png\" " + "onchange=\"form_pics.addImg(this);\" name=\"pics" + rowcount + "\"><img src=\"images/upload.png\">" + "\r\n<span onclick=\"form_pics.removeImg(this);\"> </span>\r\n" + "</dd>"; } altascount = rowcount; #endregion #region ------------------绑定型号------------------ List <MSProductPara> paralistmodel = new List <MSProductPara>(); MSProductParaDAL paraDal = new MSProductParaDAL(); DataSet parads = paraDal.GetProductParamByPID(pid); if (parads != null && parads.Tables.Count > 0 && parads.Tables[0].Rows.Count > 0) { foreach (DataRow row in parads.Tables[0].Rows) { MSProductPara paramodel = DataConvert.DataRowToModel <MSProductPara>(row); paralistmodel.Add(paramodel); } } #endregion string text = System.IO.File.ReadAllText(Server.MapPath("../ShopPage/EditeProduct.html")); JinianNet.JNTemplate.TemplateContext context = new JinianNet.JNTemplate.TemplateContext(); context.TempData["customid"] = customerid; context.TempData["atlaslist"] = atlaslist; context.TempData["altascount"] = altascount; context.TempData["cid"] = cid; context.TempData["bigcid"] = bigcid; context.TempData["pdetail"] = ProductModel; context.TempData["paralist"] = paralistmodel; context.TempData["footer"] = "奥琦微商易"; context.TempData["errorscript"] = errorscript; JinianNet.JNTemplate.Template t = new JinianNet.JNTemplate.Template(context, text); t.Render(Response.Output); }