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"]); } MSProductAtlasDAL dal = new MSProductAtlasDAL(); switch (strAction) { case "del": if (dal.UpdateMSProductAtlasState(strID)) { strMessage = "操作成功!"; } else { strMessage = "操作失败!"; } break; } Response.Write(strMessage); Response.End(); }
void showdetailinfo() { MSProductAtlasDAL AtlasDal = new MSProductAtlasDAL(); DataSet AtlasDs = AtlasDal.GetAtlasDetail(strID); MSProductAtlas AtlasModel = DataConvert.DataRowToModel <MSProductAtlas>(AtlasDs.Tables[0].Rows[0]); atlasname.Text = AtlasModel.AtlasName; string img = string.Empty; string sid = string.Empty; img = AtlasModel.PimgUrl; pid = AtlasModel.PID; MSProductDAL productDal = new MSProductDAL(); MSShopDAL shopDal = new MSShopDAL(); if (AtlasModel.IsDefault == 0) { isno.Checked = true; } else { isyes.Checked = true; } if (pid.Trim() != null && pid.Trim() != "") { sid = productDal.GetMSProductVaueByID("[SID]", pid).ToString(); } if (sid.Trim() != null && sid.Trim() != "") { ShopPhone = shopDal.GetMSShopValueByID("Phone", sid).ToString(); } else { ShopPhone = pid; } if (ShopPhone.Trim() == null || ShopPhone.Trim() == "") { ShopPhone = AtlasModel.ID; } if (img.Trim() != null && img.Trim() != "") { img0.Src = "../../PalmShop/ShopCode/" + img; oldimg = img; } if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } }
void showdetailinfo() { MSProductDAL productDal = new MSProductDAL(); DataSet productDs = productDal.GetProductDetail(strID); MSProduct productModel = DataConvert.DataRowToModel <MSProduct>(productDs.Tables[0].Rows[0]); price.Text = productModel.Price.ToString(); pname.Text = productModel.Ptitle; hd_content.Value = productModel.Pcontent; if (productModel.IsSecHand == 0) { isstateno.Checked = true; } else { isstateyes.Checked = true; } if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); DataSet atlasds = atlasDal.GetProductAtlasByPID(strID); if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { atlaslist = ""; string atlasimg = string.Empty; for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++) { atlasimg = atlasds.Tables[0].Rows[i]["PimgUrl"].ToString(); atlaslist += "<img src=\"../../PalmShop/ShopCode/" + atlasimg + "\" />"; } } MSShopContactsDAL contactDal = new MSShopContactsDAL(); DataSet contactDs = contactDal.GetContactDetailByPID(strID); if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0) { string uphone = string.Empty; string uname = string.Empty; uphone = contactDs.Tables[0].Rows[0]["Phone"].ToString(); uname = contactDs.Tables[0].Rows[0]["NickName"].ToString(); UserContact.Text = "联系电话:" + uphone + " " + "联系人:" + uname; } }
/// <summary> /// 加载数据 /// </summary> /// <param name="strWhere">条件</param> void LoadData(string strWhere) { MSProductAtlasDAL AtlasDal = new MSProductAtlasDAL(); DataSet AtlasDs = AtlasDal.GetMSProductAtlasList(strWhere); DataView dv = AtlasDs.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(); }
/// <summary> /// 更新信息状态 /// </summary> void delProduct() { string pid = string.Empty; if (Request["pid"] != null && Request["pid"] != "") { pid = Common.Common.NoHtml(Request["pid"]); } if (pid.Trim() != null && pid.Trim() != "") { MSProductDAL productDal = new MSProductDAL(); MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); productDal.UpdateMSProductState(pid); atlasDal.UpdateAtlasByPID(pid); Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true,\"msg\":\"操作失败,请核对后再操作\"}"); } Response.End(); }
/// <summary> /// 删除图片 /// </summary> void DelImg() { string imgid = string.Empty; if (Request["img"] != null && Request["img"] != "") { imgid = Common.Common.NoHtml(Request["img"]); } MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); if (imgid != null && imgid != "") { if (atlasDal.UpdateMSProductAtlasState(imgid)) { Response.Write("{\"success\":true}"); } else { Response.Write("{\"error\":true}"); } } Response.End(); }
void showdetailinfo() { MSProductDAL productDal = new MSProductDAL(); DataSet productDs = productDal.GetProductDetail(strID); MSProduct productModel = DataConvert.DataRowToModel <MSProduct>(productDs.Tables[0].Rows[0]); price.Text = productModel.Price.ToString(); pname.Text = productModel.Ptitle; hd_content.Value = productModel.Pcontent; if (productModel.IsSecHand == 0) { isstateno.Checked = true; } else { isstateyes.Checked = true; } if (strAction == "show") { this.btnReset.Visible = false; this.btnSave.Visible = false; } MSProductAtlasDAL AtlasDal = new MSProductAtlasDAL(); DataSet atlasds = AtlasDal.GetProductAtlasList(" AND PID='" + strID + "' "); if (atlasds != null && atlasds.Tables.Count > 0 && atlasds.Tables[0].Rows.Count > 0) { pataslist = ""; string atlasimg = ""; for (int i = 0; i < atlasds.Tables[0].Rows.Count; i++) { atlasimg = atlasds.Tables[0].Rows[i]["PimgUrl"].ToString(); pataslist += "<img src=\"../../PalmShop/ShopCode/" + atlasimg + "\" />"; } } }
/// <summary> /// 图集上传 /// </summary> /// <returns></returns> bool SaveImages() { bool result = false; if (customerid != null && customerid != "") { MSCustomersDAL customer = new MSCustomersDAL(); phone = customer.GetCustomerValueByID("Phone", customerid).ToString() + "/"; } HttpFileCollection files = HttpContext.Current.Request.Files; try { MSProductAtlas atlasModel = new MSProductAtlas(); MSProductAtlasDAL atlasDal = new MSProductAtlasDAL(); atlasModel.PID = pid; for (int iFile = 0; iFile < files.Count; iFile++) { //检查文件扩展名字 HttpPostedFile postedFile = files[iFile]; string fileName, fileExtension, file_oldid, file_id; //取出精确到毫秒的时间做文件的名称 string my_file_id = DateTime.Now.ToString("yyyyMMddHHmmssfff") + iFile.ToString(); fileName = System.IO.Path.GetFileName(postedFile.FileName); fileExtension = System.IO.Path.GetExtension(fileName); file_id = my_file_id + fileExtension; if (fileName != "" && fileName != null) { fileExtension = System.IO.Path.GetExtension(fileName); string saveurl, modelimgurl; saveurl = modelimgurl = "Atlas/" + phone; saveurl = Server.MapPath(saveurl); if (!Directory.Exists(saveurl)) { Directory.CreateDirectory(saveurl); } int length = postedFile.ContentLength; if (length > 512000) { file_oldid = "old" + file_id; postedFile.SaveAs(saveurl + file_oldid); JQDialog.ystp(saveurl + file_oldid, saveurl + file_id, 15); File.Delete(saveurl + file_oldid); } else { postedFile.SaveAs(saveurl + file_id); } atlasModel.ID = Guid.NewGuid().ToString("N").ToUpper(); if (iFile == 0) { if (!atlasDal.IsExitDefaultImg(pid)) { atlasModel.IsDefault = 1; } } atlasModel.ImgState = 0; atlasModel.PimgUrl = modelimgurl + file_id; atlasModel.AtlasName = ""; if (atlasDal.AddMSProductAtlas(atlasModel)) { result = true; } } } } catch (System.Exception Ex) { result = false; } 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 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); }
protected void btnSave_Click(object sender, EventArgs e) { if (Session["strLoginName"].ToString() != null && Session["strLoginName"].ToString() != "") { if (atlasname.Text.Trim() != null && atlasname.Text.Trim() != "") { //上传图像 string strIconFileName = string.Empty; //图像路径 string strIconSaveFileName = string.Empty; //网址路径 try { if (this.file0.PostedFile.FileName == "") { strIconSaveFileName = ""; } else { if (!System.IO.Directory.Exists(Server.MapPath("~") + @"/Atlas")) { System.IO.Directory.CreateDirectory(Server.MapPath("~") + @"/Atlas"); } if (!System.IO.Directory.Exists(String.Format(@"{0}/PalmShop/ShopCode/Atlas/{1}", Server.MapPath("~"), ShopPhone))) { System.IO.Directory.CreateDirectory(String.Format(@"{0}/PalmShop/ShopCode/Atlas/{1}", Server.MapPath("~"), ShopPhone)); } string orignalName = this.file0.PostedFile.FileName; //获取客户机上传文件的文件名 string extendName = orignalName.Substring(orignalName.LastIndexOf(".")); //获取扩展名 if (extendName != ".gif" && extendName != ".jpg" && extendName != ".jpeg" && extendName != ".png") { MessageBox.Show(this, "文件格式有误!"); return; }//检查文件格式 string newName = String.Format("{0}_{1}{2}", DateTime.Now.Millisecond, file0.PostedFile.ContentLength, extendName);//对文件进行重命名 strIconFileName = String.Format(@"{0}PalmShop/ShopCode/Atlas/{1}/{2}", Server.MapPath("~"), ShopPhone, newName); strIconSaveFileName = String.Format(@"Atlas/{0}/{1}", ShopPhone, newName); file0.PostedFile.SaveAs(strIconFileName); if (oldimg.Trim() != null && oldimg.Trim() != "") { System.IO.File.Delete(String.Format(@"{0}PalmShop/ShopCode/{1}", Server.MapPath("~"), oldimg)); } } } catch (Exception ex) { MessageBox.Show(this, "上传发生错误!原因是:" + ex.ToString()); } MSProductAtlasDAL AtlasDal = new MSProductAtlasDAL(); MSProductAtlas AtlasModel = new MSProductAtlas(); AtlasModel.PID = pid; AtlasModel.AtlasName = atlasname.Text; AtlasModel.ImgState = 0; if (strIconSaveFileName.Trim() != null && strIconSaveFileName.Trim() != "") { AtlasModel.PimgUrl = strIconSaveFileName; } AtlasModel.ID = strID; AtlasModel.IsDefault = isyes.Checked ? 1 : 0; if (AtlasDal.UpdateMSProductAtlas(AtlasModel)) { MessageBox.Show(this, "操作成功!"); } else { MessageBox.Show(this, "操作失败!"); } } else { MessageBox.Show(this, "请输入相应名称!"); } } else { return; } }
/// <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); }
/// <summary> /// 获取类别 /// </summary> void getinfo() { #region -----------一级导航绑定----------- ddlbigcategorylist.Items.Clear(); MSProductCategoryDAL categoryDal = new MSProductCategoryDAL(); DataSet ds = new DataSet(); ds = categoryDal.GetSecHandCategoryList(" and UpID='' and CsecHand=" + ishand); ddlbigcategorylist.DataSource = ds.Tables[0].DefaultView; ddlbigcategorylist.DataTextField = "Cname"; ddlbigcategorylist.DataValueField = "ID"; ddlbigcategorylist.DataBind(); #endregion string cid = string.Empty; string bigcid = string.Empty; if (pid.Trim() != null && pid.Trim() != "") { MSProductDAL productDal = new MSProductDAL(); DataSet productds = productDal.GetProductDetail(pid); MSProduct productModel = DataConvert.DataRowToModel <MSProduct>(productds.Tables[0].Rows[0]); cid = productModel.Cid; ptitle.Value = productModel.Ptitle; pdesc.Value = productModel.Pcontent; price.Value = productModel.Price.ToString(); Review = productModel.Review; #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; } setpvalue.Value = cid; } #endregion ddlbigcategorylist.SelectedIndex = ddlbigcategorylist.Items.IndexOf(ddlbigcategorylist.Items.FindByValue(bigcid)); #region ------------二级导航绑定------------------ if (bigcid != null && bigcid != "") { ddlsmallcategorylist.Items.Clear(); ds = categoryDal.GetSecHandCategoryList(" and UpID='" + bigcid + "' "); ddlsmallcategorylist.DataSource = ds.Tables[0].DefaultView; ddlsmallcategorylist.DataTextField = "Cname"; ddlsmallcategorylist.DataValueField = "ID"; ddlsmallcategorylist.DataBind(); if (cid != null && cid != "") { ddlsmallcategorylist.SelectedIndex = ddlsmallcategorylist.Items.IndexOf(ddlsmallcategorylist.Items.FindByValue(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 datacount=\"" + rowcount + "\">\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 ----------------根据产品编号获取联系方式-------------------- MSShopContactsDAL contactDal = new MSShopContactsDAL(); DataSet contactDs = contactDal.GetContactDetailByPID(pid); if (contactDs != null && contactDs.Tables.Count > 0 && contactDs.Tables[0].Rows.Count > 0) { string uphone = string.Empty; string uname = string.Empty; uphone = contactDs.Tables[0].Rows[0]["Phone"].ToString(); uname = contactDs.Tables[0].Rows[0]["NickName"].ToString(); contactID = contactDs.Tables[0].Rows[0]["ID"].ToString(); UserPhone.Value = uphone; UserName.Value = uname; } #endregion } }