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; } }
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 -----------一级导航绑定----------- 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 } }