protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int id = RequestHelper.GetQueryString <int>("Id"); if (id != int.MinValue) { CheckAdminPower("ReadPointProduct", PowerCheckType.Single); pointProduct = PointProductBLL.Read(id); Name.Text = pointProduct.Name; SubTitle.Text = pointProduct.SubTitle; Point.Text = pointProduct.Point.ToString(); TotalCount.Text = pointProduct.TotalStorageCount.ToString(); BeginDate.Text = pointProduct.BeginDate.ToString("yyyy-MM-dd"); EndDate.Text = pointProduct.EndDate.ToString("yyyy-MM-dd"); MarketPrice.Text = pointProduct.MarketPrice.ToString(); Photo.Text = pointProduct.Photo; Introduction.Value = pointProduct.Introduction1; Introduction_Mobile.Value = pointProduct.Introduction1_Mobile; productPhotoList = ProductPhotoBLL.ReadList(pointProduct.Id, 0); } } }
protected void Page_Load(object sender, EventArgs e) { #region 获取当前分类 if (RequestHelper.GetQueryString <string>("Action") == "GetThisClass") { GetthisClass(); } #endregion if (!Page.IsPostBack) { foreach (ArticleClassInfo articleClass in ArticleClassBLL.ReadNamedList()) { ClassID.Items.Add(new ListItem(articleClass.Name, articleClass.Id.ToString())); } RealDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); int articleID = RequestHelper.GetQueryString <int>("ID"); if (articleID != int.MinValue) { productPhotoList = ProductPhotoBLL.ReadList(articleID, 1); CheckAdminPower("ReadArticle", PowerCheckType.Single); ArticleInfo article = ArticleBLL.Read(articleID); Title.Text = article.Title; string classID = article.ClassId; if (classID != string.Empty) { classID = classID.Substring(1, classID.Length - 2); if (classID.IndexOf('|') > -1) { classID = classID.Substring(classID.LastIndexOf('|') + 1); } } ClassID.Text = classID; int thisClassID = 0; int.TryParse(classID, out thisClassID); thisClass = ArticleClassBLL.Read(thisClassID); IsTop.Text = article.IsTop.ToString(); Author.Text = article.Author; Resource.Text = article.Resource; Keywords.Text = article.Keywords; Url.Text = article.Url; Photo.Text = article.Photo; Summary.Text = article.Summary; Content.Value = article.Content; MobileContent.Value = article.AddCol2; RealDate.Text = article.RealDate.ToString(); OrderID.Text = article.OrderId.ToString(); FilePath.Text = article.FilePath; Content1.Value = article.Content1; MobileContent1.Value = article.Mobilecontent1; Content2.Value = article.Content2; MobileContent2.Value = article.Mobilecontent2; //Content3.Value = article.AddCol3; } } }
protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("Id"); Gift = PointProductBLL.Read(id); //产品图片 ProductPhotoList.Add(new ProductPhotoInfo { Name = Gift.Name, ImageUrl = Gift.Photo }); ProductPhotoList.AddRange(ProductPhotoBLL.ReadList(Gift.Id, 0)); }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); //singleUnlimitClass.DataSource = RegionBLL.ReadRegionUnlimitClass(); var regionList = RegionBLL.ReadRegionUnlimitClass(); regionList.RemoveAll(k => k.FatherID == 0 || (k.FatherID == 1 && k.ClassID != 27)); regionList.ForEach(k => { if (k.FatherID == 1) { k.FatherID = 0; } }); singleUnlimitClass.DataSource = regionList; //singleUnlimitClass.ClassID = "|27|"; //singleUnlimitClass.Prefix = "湖南"; SearchCondition(); LoadHotProductList(); artId = RequestHelper.GetQueryString <int>("ID"); if (artId <= 0) { artId = 1; } thisArticle = ArticleBLL.Read(artId); switch (thisArticle.ClassId) { case "|58|54|": topNav = 2; break; case "|58|55|": topNav = 3; break; case "|58|56|": topNav = 4; break; case "|58|57|": topNav = 5; break; default: break; } proPhotoList = ProductPhotoBLL.ReadList(artId, 1); if (RequestHelper.GetQueryString <string>("Action") == "UseMessage") { UseMessage(); } }
protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("id"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } //如果为移动端单独设置了内容,则取移动端内容 if (!string.IsNullOrEmpty(product.Introduction1_Mobile)) { product.Introduction1 = product.Introduction1_Mobile; } if (!string.IsNullOrEmpty(product.Introduction2_Mobile)) { product.Introduction2 = product.Introduction2_Mobile; } if (!string.IsNullOrEmpty(product.Introduction3_Mobile)) { product.Introduction3 = product.Introduction3_Mobile; } //更新查看数量 Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("ViewCount", product.ViewCount + 1); ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id); if (product.BrandId > 0) { productBrand = ProductBrandBLL.Read(product.BrandId); } productPhotoList = ProductPhotoBLL.ReadList(id, 0); attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id); standardRecords = ProductTypeStandardRecordBLL.ReadList(id); //搜索优化 Title = product.Name; Keywords = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords; Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("Id"); gift = PointProductBLL.Read(id); //如果暂未开始或者已经结束 if (gift.EndDate.Date < DateTime.Now.Date || gift.BeginDate.Date > DateTime.Now.Date) { ResponseHelper.Redirect("/pointproduct.html"); } //产品图片 photoList.Add(new ProductPhotoInfo { Name = gift.Name, ImageUrl = gift.Photo }); photoList.AddRange(ProductPhotoBLL.ReadList(gift.Id, 0)); Title = gift.Name + " - 积分商品兑换"; }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int id = RequestHelper.GetQueryString <int>("ID"); if (id <= 0) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False || product.IsDelete == 1) { ScriptHelper.Alert("该产品未上市,不能查看"); } //产品图片 ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo; productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); }
protected override void PageLoad() { base.PageLoad(); string action = RequestHelper.GetQueryString <string>("Action"); switch (action) { case "GetStandardPrice": GetStandardPrice(); break; case "Like": Like(); break; case "Collect": Collect(); break; } int id = RequestHelper.GetQueryString <int>("id"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } //更新查看数量 Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("ViewCount", product.ViewCount + 1); ProductBLL.UpdatePart(ProductInfo.TABLENAME, dict, id); if (product.BrandId > 0) { productBrand = ProductBrandBLL.Read(product.BrandId); } if (product.ShopId > 0) { shop = UserBLL.Read(product.ShopId); } productPhotoList = ProductPhotoBLL.ReadList(id, 0); attributeRecords = ProductTypeAttributeRecordBLL.ReadList(id); standardRecords = ProductTypeStandardRecordBLL.ReadList(id); //导航路径 listPaths = ProductClassBLL.ReadNavigationPath(product.ClassId); listPaths.ForEach(k => paths += string.Format(k[0], k[1], k[2])); //排行榜 //按销量倒序 int count = 0; topProductList = ProductBLL.SearchList(1, 6, new ProductSearchInfo { ClassId = product.ClassId, IsSale = (int)BoolType.True, ProductOrderType = "SendCount", OrderType = OrderType.Desc }, ref count); //同类推荐 classProductList = ProductBLL.SearchList(1, 3, new ProductSearchInfo { ClassId = product.ClassId, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True }, ref count); //搜索优化 Title = product.Name; Keywords = string.IsNullOrEmpty(product.Keywords) ? product.Name : product.Keywords; Description = string.IsNullOrEmpty(product.Summary) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
private string GetProductCSV() { StringBuilder builder = new StringBuilder(); string format = "\"{0}\"\t{1}\t\"{2}\"\t{3}\t\"{4}\"\t\"{5}\"\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}\t{13}\t{14}\t{15}\t{16}\t{17}\t{18}\t\"{19}\"\t\"{20}\"\t\"{21}\"\t{22}\t{23}\t\"{24}\"\t{25}\t\"{26}\"\t{27}\t\"{28}\"\t\"{29}\"\t\"{30}\"\t\"{31}\"\t\"{32}\"\t\"{33}\"\t\"{34}\"\t{35}\t{36}\t{37}\t{38}\t\"{39}\"\t{40}\t{41}\t\"{42}\"\r\n"; builder.Append("version 1.00\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n"); builder.Append("title\tcid\tseller_cids\tstuff_status\tlocation_state\tlocation_city\titem_type\tprice\tauction_increment\tnum\tvalid_thru\tfreight_payer\tpost_fee\tems_fee"); builder.Append("\texpress_fee\thas_invoice\thas_warranty\tapprove_status\thas_showcase\tlist_time\tdescription\tcateProps\tpostage_id\thas_discount\tmodified\tupload_fail_msg"); builder.Append("\tpicture_status\tauction_point\tpicture\tvideo\tskuProps\tinputPids\tinputValues\touter_id\tpropAlias\tauto_fill\tnum_id\tlocal_cid\tnavigation_type\tuser_name\tsyncStatus\tsubtitle\twireless_desc\r\n"); builder.Append("宝贝名称\t宝贝类目\t店铺类目\t新旧程度\t省\t城市\t出售方式\t宝贝价格\t加价幅度\t宝贝数量\t有效期\t运费承担\t平邮\tEMS\t快递\t发票\t保修\t放入仓库\t橱窗推荐\t开始时间\t宝贝描述"); builder.Append("\t宝贝属性\t邮费模版ID\t会员打折\t修改时间\t上传状态\t图片状态\t返点比例\t新图片\t视频\t销售属性组合\t用户输入ID串\t用户输入名-值对\t商家编码\t销售属性别名\t代充类型\t数字ID\t本地ID"); builder.Append("\t宝贝分类\t账户名称\t宝贝状态\t宝贝卖点(摘要)\t无线详情(手机详情描述)\r\n"); foreach (var item in ExportList) { string str2 = string.Empty;; //pc端详情描述,最少5字符,最多25000字符 if (item.Introduction1.Length >= 5) { str2 = this.Trim(StringHelper.Substring(item.Introduction1, 24900, false)).Replace(string.Format("src=\"{0}/upload/attached/image", this.ApplicationPath), string.Format("src=\"{0}/upload/attached/image", this._url)); } //手机端详情描述----不能直接调用本站的 //string mobileContent = string.IsNullOrEmpty(item.Introduction1_Mobile) ? item.Introduction1 : item.Introduction1_Mobile; string mobileContent = string.Empty; mobileContent = this.Trim(mobileContent).Replace(string.Format("src=\"{0}/upload/attached/image", this.ApplicationPath), string.Format("src=\"{0}/upload/attached/image", this._url)); string str3 = string.Empty; //摘要 if (!string.IsNullOrEmpty(item.Summary)) { str3 = this.Trim(Convert.ToString(item.Summary).Trim()); //if (!string.IsNullOrEmpty(str3) && (str3.Length > 0)) //{ // str2 = str3 + "<br/>" + str2; //} } str2 = str2.Replace("\r\n", "").Replace("\r", "").Replace("\n", "").Replace("\"", "\"\""); mobileContent = mobileContent.Replace("\r\n", "").Replace("\r", "").Replace("\n", "").Replace("\"", "\"\""); string str4 = string.Empty; if (!string.IsNullOrEmpty(item.Photo)) { str4 = str4 + this.CopyImage(item.Photo, 1); } int phi = 2; foreach (var productPhoto in ProductPhotoBLL.ReadList(item.Id, 0).Take(4)) { if (!string.IsNullOrEmpty(productPhoto.ImageUrl)) { str4 = str4 + this.CopyImage(productPhoto.ImageUrl.Replace("75-75", "Original"), phi); phi++; } } //if (row["ImageUrl2"] != DBNull.Value) //{ // str4 = str4 + this.CopyImage((string)row["ImageUrl2"], 2); //} //if (row["ImageUrl3"] != DBNull.Value) //{ // str4 = str4 + this.CopyImage((string)row["ImageUrl3"], 3); //} //if (row["ImageUrl4"] != DBNull.Value) //{ // str4 = str4 + this.CopyImage((string)row["ImageUrl4"], 4); //} //if (row["ImageUrl5"] != DBNull.Value) //{ // str4 = str4 + this.CopyImage((string)row["ImageUrl5"], 5); //} //DataRow[] rowArray = this._exportData.Tables["skus"].Select("ProductId=" + row["ProductId"].ToString(), "SalePrice desc"); string str5 = "0"; int num = 0; string str6 = "1"; string str7 = "0"; string str8 = "0"; string str9 = "0"; string str10 = ""; string str11 = "";//分类ID string str12 = ""; string str13 = item.ProductCode; string str14 = ""; string str15 = ""; string str16 = ""; string str17 = ""; string str18 = ""; string str19 = ""; string str20 = ""; string str21 = ""; string str22 = ""; string str23 = ""; string str24 = ""; string str25 = ""; //DataRow[] rowArray2 = this._exportData.Tables["TaobaoSku"].Select("ProductId=" + row["Productid"].ToString()); //if (rowArray2.Length > 0) //{ // if (this._includeStock) // { // if ((rowArray2[0]["SkuQuantities"] != null) && (rowArray2[0]["SkuQuantities"].ToString() != "")) // { // string[] strArray = null; // if (rowArray2[0]["SkuQuantities"].ToString().Contains(",")) // { // strArray = rowArray2[0]["SkuQuantities"].ToString().Split(new char[] { ',' }); // } // else // { // strArray = new string[] { rowArray2[0]["SkuQuantities"].ToString() }; // } // foreach (string str26 in strArray) // { // num += Convert.ToInt32(str26); // } // } // else // { // num += Convert.ToInt32(rowArray2[0]["Num"]); // } // } //str20 = Convert.ToString(rowArray2[0]["LocationState"]); //str21 = Convert.ToString(rowArray2[0]["LocationCity"]); //str22 = (Convert.ToString(rowArray2[0]["HasInvoice"]).ToLower() == "true") ? "1" : "0"; //str23 = (Convert.ToString(rowArray2[0]["HasWarranty"]).ToLower() == "true") ? "1" : "0"; //str24 = (Convert.ToString(rowArray2[0]["HasDiscount"]).ToLower() == "true") ? "1" : "0"; //str25 = (rowArray2[0]["StuffStatus"].ToString() == "new") ? "1" : "0"; str20 = _province; str21 = _city; str22 = "0"; str23 = "0"; str24 = "0"; str25 = "1"; //if (Convert.ToString(rowArray2[0]["FreightPayer"]) == "buyer") //{ // str6 = "2"; // str7 = Convert.ToString(rowArray2[0]["PostFee"]); // str8 = Convert.ToString(rowArray2[0]["ExpressFee"]); // str9 = Convert.ToString(rowArray2[0]["EMSFee"]); //} //str11 = Convert.ToString(rowArray2[0]["Cid"]); //str14 = Convert.ToString(rowArray2[0]["PropertyAlias"]); //str10 = Convert.ToString(rowArray2[0]["inputpids"]); //str12 = Convert.ToString(rowArray2[0]["inputstr"]); //str17 = Convert.ToString(rowArray2[0]["SkuQuantities"]); //str18 = Convert.ToString(rowArray2[0]["skuPrices"]); //str16 = Convert.ToString(rowArray2[0]["SkuProperties"]); //str19 = Convert.ToString(rowArray2[0]["SkuOuterIds"]); //if (!string.IsNullOrEmpty(str17)) //{ // string[] strArray2 = str17.Split(new char[] { ',' }); // string[] strArray3 = str18.Split(new char[] { ',' }); // string[] strArray4 = str19.Split(new char[] { ',' }); // string[] strArray5 = str16.Split(new char[] { ',' }); // for (int i = 0; i < strArray2.Length; i++) // { // string str27 = str15; // str15 = str27 + strArray3[i] + ":" + strArray2[i] + ":" + strArray4[i] + ":" + strArray5[i] + ";"; // } //} //} //else if (this._includeStock && (rowArray.Length > 0)) //{ // foreach (DataRow row2 in rowArray) // { // num += (int)row2["Stock"]; // } //} //计算剩余库存量 int leftStorageCount = 0; if (item.StandardType != 1) { if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.SelfStorageSystem) { leftStorageCount = item.TotalStorageCount - item.OrderCount; } else { leftStorageCount = item.ImportVirtualStorageCount; } } else { List <ProductTypeStandardRecordInfo> standRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(item.Id, 1); if (standRecordList.Count > 0) { leftStorageCount = standRecordList[0].Storage; //取第一种规格的库存 } } str5 = leftStorageCount.ToString(); //库存数量 string spostage_id = "0"; //邮费模板ID //if (rowArray.Length > 0) //{ builder.AppendFormat(format, new object[] { this.Trim(item.Name), str11, "", str25, str20, str21, "1", item.SalePrice, "", str5, "14", str6, str7, str9, str8, str22, str23, "0", "0", "", str2, str14, spostage_id, str24, DateTime.Now, "100", "", "0", str4, string.Empty, str15, str10, str12, str13, string.Empty, "0", "0", "0", "1", "", "1", str3, mobileContent }); //} } return(builder.Remove(builder.Length - 2, 2).ToString()); }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BindClassBrandAttributeClassStandardType(); BrandID.Items.Insert(0, new ListItem("请选择", "0")); RelationBrandID.Items.Insert(0, new ListItem("请选择", "0")); AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0")); string classId = RequestHelper.GetQueryString <string>("classId"); productID = RequestHelper.GetQueryString <int>("ID"); _brandId = RequestHelper.GetQueryString <int>("BrandId"); //ProductClass.DataSource = ProductClassBLL.ReadUnlimitClassList(); if (productID <= 0) //添加商品 { DraftButton.Visible = true; //添加商品可保存草稿 if (string.IsNullOrEmpty(classId)) { Response.Redirect("/admin/productaddinit.aspx"); } else { LastClassID = ProductClassBLL.GetLastClassID(classId); proTypeID = ProductClassBLL.GetProductClassType(LastClassID); ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID); if (aci.Id > 0) { string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); int[] intArray; intArray = Array.ConvertAll <string, int>(strArray, s => int.Parse(s)); productBrandList = ProductBrandBLL.ReadList(intArray); } if (productBrandList.Count > 0) { BrandID.DataSource = productBrandList; BrandID.DataTextField = "Name"; BrandID.DataValueField = "ID"; BrandID.DataBind(); BrandID.Items.Insert(0, new ListItem("请选择", "0")); if (_brandId > 0) { BrandID.Text = _brandId.ToString(); } RelationBrandID.DataSource = productBrandList; RelationBrandID.DataTextField = "Name"; RelationBrandID.DataValueField = "ID"; RelationBrandID.DataBind(); RelationBrandID.Items.Insert(0, new ListItem("请选择", "0")); AccessoryBrandID.DataSource = productBrandList; AccessoryBrandID.DataTextField = "Name"; AccessoryBrandID.DataValueField = "ID"; AccessoryBrandID.DataBind(); AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0")); } //商品分类对应的属性列表 attributeList = ProductTypeAttributeBLL.ReadList(proTypeID); //商品类型对应的规格列表 standardList = ProductTypeStandardBLL.ReadList(proTypeID); //添加商品时自动查找所属分类的售后服务 Remark.Value = GetProductClassRemark(classId); } } else//修改商品 { CheckAdminPower("ReadProduct", PowerCheckType.Single); DraftButton.Visible = false;//修改商品不可保存草稿 ProductInfo product = ProductBLL.Read(productID); pageProduct = product; //如果修改了分类则标识isupdate if (!string.IsNullOrEmpty(classId) && product.ClassId != classId) { isUpdate = 1; } YejiRatio.Text = product.YejiRatio; Name.Text = product.Name; SellPoint.Text = product.SellPoint; Name.Attributes.Add("style", "color:" + product.Color); color = product.Color; FontStyle.Text = product.FontStyle; ProductNumber.Text = product.ProductNumber; //ProductClass.ClassID = product.ClassId; Keywords.Text = product.Keywords; MarketPrice.Text = product.MarketPrice.ToString(); SendPoint.Text = product.SendPoint.ToString(); Photo.Text = product.Photo; Summary.Text = product.Summary; Introduction.Value = product.Introduction1; Weight.Text = product.Weight.ToString(); GroupPrice.Text = product.GroupPrice.ToString(); GroupQuantity.Text = product.GroupQuantity.ToString(); GroupPhoto.Text = product.GroupPhoto; VirtualOrderCount.Text = product.VirtualOrderCount.ToString(); if (Convert.ToBoolean(product.IsSpecial)) { IsSpecial.Checked = true; } if (Convert.ToBoolean(product.IsNew)) { IsNew.Checked = true; } if (Convert.ToBoolean(product.IsHot)) { IsHot.Checked = true; } if (Convert.ToBoolean(product.IsSale)) { IsSale.Checked = true; } else { IsSale.Checked = false; } if (Convert.ToBoolean(product.IsTop)) { IsTop.Checked = true; } if (Convert.ToBoolean(product.AllowComment)) { AllowComment.Checked = true; } else { AllowComment.Checked = false; } TotalStorageCount.Text = product.TotalStorageCount.ToString(); LastClassID = ProductClassBLL.GetLastClassID(product.ClassId); this.proTypeID = ProductClassBLL.GetProductClassType(LastClassID); //商品分类对应的属性列表 //attributeList = ProductTypeAttributeBLL.JoinAttribute(ProductClassBLL.Read(ProductClassBLL.GetLastClassID(product.ClassId)).ProductTypeId, productID); attributeList = ProductTypeAttributeBLL.JoinAttribute(this.proTypeID, productID); Repeater1.DataSource = attributeList; Repeater1.DataBind(); //商品类型对应的规格列表 standardList = ProductTypeStandardBLL.ReadList(this.proTypeID); standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); if (product.StandardType == 1) { if (standardRecordList.Count > 0) { TotalStorageCount.ReadOnly = true; } } if (string.IsNullOrEmpty(classId)) { LastClassID = ProductClassBLL.GetLastClassID(product.ClassId); } else { LastClassID = ProductClassBLL.GetLastClassID(classId); } int proTypeID = ProductClassBLL.GetProductClassType(LastClassID); ProductTypeInfo aci = ProductTypeBLL.Read(proTypeID); if (aci.Id > 0) { string[] strArray = aci.BrandIds.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); int[] intArray; intArray = Array.ConvertAll <string, int>(strArray, s => int.Parse(s)); productBrandList = ProductBrandBLL.ReadList(intArray); } if (productBrandList.Count > 0) { BrandID.DataSource = productBrandList; BrandID.DataTextField = "Name"; BrandID.DataValueField = "ID"; BrandID.DataBind(); BrandID.Items.Insert(0, new ListItem("请选择", "0")); RelationBrandID.DataSource = productBrandList; RelationBrandID.DataTextField = "Name"; RelationBrandID.DataValueField = "ID"; RelationBrandID.DataBind(); RelationBrandID.Items.Insert(0, new ListItem("请选择", "0")); AccessoryBrandID.DataSource = productBrandList; AccessoryBrandID.DataTextField = "Name"; AccessoryBrandID.DataValueField = "ID"; AccessoryBrandID.DataBind(); AccessoryBrandID.Items.Insert(0, new ListItem("请选择", "0")); } if (_brandId > 0) { BrandID.Text = _brandId.ToString(); } else { BrandID.Text = product.BrandId.ToString(); } sendCount = product.SendCount; OrderID.Text = product.OrderId.ToString(); SalePrice.Text = product.SalePrice.ToString(); Units.Text = product.Unit; Introduction_Mobile.Value = product.Introduction1_Mobile; Sub_Title.Text = product.SubTitle; LowerCount.Text = product.LowerCount.ToString(); Remark.Value = product.Remark; BindRelation(product); productPhotoList = ProductPhotoBLL.ReadList(productID, 0); } //userGradeList = UserGradeBLL.JoinUserGrade(productID); } }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int count = int.MinValue; int id = RequestHelper.GetQueryString <int>("ID"); if (id <= 0) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } string fromwhere = RequestHelper.GetQueryString <string>("fw"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False || product.IsDelete == 1) { if (fromwhere.ToLower() != "admin") { ScriptHelper.Alert("该产品未上市,不能查看"); } else { if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录 { ScriptHelper.Alert("该产品未上市,不能查看"); } } } navList = ProductClassBLL.ProductClassNameList(product.ClassId); //更新查看数量 ProductBLL.ChangeViewCount(id, 1); //会员等级 userGradeList = UserGradeBLL.ReadList(); //产品图片 ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo.Replace("Original", "75-75"); productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); // 关联产品,配件,浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct; tempStrProductID = tempStrProductID.Replace(",,", ","); if (tempStrProductID.StartsWith(",")) { tempStrProductID = tempStrProductID.Substring(1); } if (tempStrProductID.EndsWith(",")) { tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = tempStrProductID; productSearch.IsDelete = (int)BoolType.False; tempProductList = ProductBLL.SearchList(productSearch); //产品规格 standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); if (standardRecordList.Count > 0) { string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < standardIDArray.Length; i++) { int standardID = Convert.ToInt32(standardIDArray[i]); ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID); string[] valueArray = standard.ValueList.Split(';'); string valueList = string.Empty; for (int k = 0; k < valueArray.Length; k++) { foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { string[] tempValueArray = standardRecord.ValueList.Split(';'); if (valueArray[k] == tempValueArray[i]) { valueList += valueArray[k] + ";"; break; } } } if (valueList != string.Empty) { valueList = valueList.Substring(0, valueList.Length - 1); } standard.ValueList = valueList; standardList.Add(standard); } //规格值 foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|"; } } //计算剩余库存量 if (ShopConfig.ReadConfigInfo().ProductStorageType == (int)ProductStorageType.SelfStorageSystem) { leftStorageCount = product.TotalStorageCount - product.OrderCount; } else { leftStorageCount = product.ImportVirtualStorageCount; } //搜索优化 Title = product.Name; Keywords = (product.Keywords == string.Empty) ? product.Name : product.Keywords; Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }
public ActionResult Detail(int id) { int userGrade = UserGradeBLL.ReadByMoney(0).Id; int uid = RequestHelper.GetForm <int>("uid"); var user = UserBLL.ReadUserMore(uid); if (user.Id > 0) { userGrade = UserGradeBLL.ReadByMoney(user.MoneyUsed).Id; user.UserName = HttpUtility.UrlDecode(user.UserName, System.Text.Encoding.UTF8); } if (id <= 0) { return(Json(new { ok = false, error = "该产品未上市" })); } string fromwhere = RequestHelper.GetQueryString <string>("fw"); ProductInfo product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False || product.IsDelete == 1) { return(Json(new { ok = false, error = "该产品未上市" })); } #region 如果商品没有小程序码 则生成并保存 if (string.IsNullOrWhiteSpace(product.Qrcode)) { string product_miniProramCode = string.Empty; CreateMiniProgramCode(product.Id, ref product_miniProramCode, product.Qrcode); if (!string.IsNullOrWhiteSpace(product_miniProramCode)) {//如果调用接口成功生成小程序码(因为只有发布后才能使用此微信接口) Dictionary <string, object> dict = new Dictionary <string, object>(); dict.Add("[Qrcode]", product_miniProramCode); ProductBLL.UpdatePart("[Product]", dict, product.Id); product.Qrcode = product_miniProramCode; } } #endregion //更新查看数量 if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null) { ProductBLL.ChangeViewCount(id, 1); CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString()); } ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo(); var proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo { ProductId = product.Id, Status = (int)CommentStatus.Show }); var procomlist = new List <VirtualProductCommend>(); foreach (var item in proComm) { VirtualProductCommend vpc = new VirtualProductCommend() { id = item.Id, name = HttpUtility.UrlDecode(item.UserName, Encoding.UTF8), avator = ShopCommon.ShowImage(UserBLL.Read(item.UserId).Photo), lv = item.Rank, date = item.PostDate, content = item.Content, imglist = ProductPhotoBLL.ReadList(item.Id, 3), adminreply = item.AdminReplyContent, replydate = item.AdminReplyDate }; procomlist.Add(vpc); } //产品价格 int hotCount = 0; var currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, userGrade); var prorecommend = ProductBLL.SearchList(1, 8, new ProductSearchInfo { IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString() }, ref hotCount); var prorelist = new List <ProductVirtualModel>(); foreach (var item in prorecommend) { var vp = new ProductVirtualModel() { id = item.Id, name = item.Name, img = ShopCommon.ShowImage(item.Photo.Replace("Original", "150-150")), imgbig = ShopCommon.ShowImage(item.Photo.Replace("Original", "350-350")), imgorg = ShopCommon.ShowImage(item.Photo), price = ProductBLL.GetCurrentPrice(item.SalePrice, userGrade), marketprice = item.MarketPrice, click = item.ViewCount, like = item.LikeNum, totalstore = item.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(item.Id) : item.TotalStorageCount, //ordercount = item.OrderCount //是否启用不限库存,分别计算销量 ordercount = item.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(item.Id, item.StandardType, DateTime.Now) : item.OrderCount }; prorelist.Add(vp); } //产品图片 List <ProductPhotoInfo> productPhotoList = new List <ProductPhotoInfo>(); ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo; productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); productPhotoList.ForEach(k => k.ImageUrl = k.ImageUrl.Replace("75-75", "Original")); //属性 var attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id); #region 产品规格 List <ProductTypeStandardInfo> standardList = new List <ProductTypeStandardInfo>(); string standardRecordValueList = "|"; var standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); decimal maxPrice = product.SalePrice; if (standardRecordList.Count > 0) { string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < standardIDArray.Length; i++) { int standardID = Convert.ToInt32(standardIDArray[i]); ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID); string[] valueArray = standard.ValueList.Split(';'); string valueList = string.Empty; for (int k = 0; k < valueArray.Length; k++) { foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { if (standardRecord.MarketPrice > maxPrice) { maxPrice = standardRecord.MarketPrice; } string[] tempValueArray = standardRecord.ValueList.Split(';'); if (valueArray[k] == tempValueArray[i]) { valueList += valueArray[k] + ";"; break; } } } if (valueList != string.Empty) { valueList = valueList.Substring(0, valueList.Length - 1); } standard.ValueList = valueList; standardList.Add(standard); } //规格值 foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|"; } } #endregion #region 正在开的团(进行中,排除本人开的团) GroupBuySearchInfo gpsearch = new GroupBuySearchInfo { ProductId = product.Id, //NotLeader = user.Id, Status = (int)GroupBuyStatus.Going }; List <GroupBuyInfo> gpList = GroupBuyBLL.SearchList(gpsearch); gpList.ForEach(k => k.groupSignList = GroupSignBLL.ReadListByGroupId(k.Id)); gpList.ForEach(k => k.GroupUserName = System.Web.HttpUtility.UrlDecode(k.GroupUserName, Encoding.UTF8)); #endregion return(Json(new { ok = true, product = new { id = product.Id, img = ShopCommon.ShowImage(product.Photo.Replace("Original", "350-350")), imgorg = ShopCommon.ShowImage(product.Photo), title = product.Name, summary = product.Summary, price = currentMemberPrice, marketprice = product.MarketPrice, intro = string.IsNullOrEmpty(product.Introduction1_Mobile) ? product.Introduction1 : product.Introduction1_Mobile, remark = product.Remark, totalstore = product.StandardType == (int)ProductStandardType.Single ? ProductTypeStandardRecordBLL.GetSumStorageByProduct(product.Id) : product.TotalStorageCount, ordercount = product.UnlimitedStorage == 1 ? OrderBLL.GetProductOrderCountDaily(product.Id, product.StandardType, DateTime.Now) : product.OrderCount, unlimitedstorage = product.UnlimitedStorage, virtualordercount = product.VirtualOrderCount, usevirtualorder = product.UseVirtualOrder, opengroup = product.OpenGroup, groupprice = product.GroupPrice, groupquantity = product.GroupQuantity, qrcode = product.Qrcode, groupphoto = string.IsNullOrWhiteSpace(product.GroupPhoto) ? product.Photo : product.GroupPhoto }, standardList = standardList, standardRecordValueList = standardRecordValueList, attributeRecordList = attributeRecordList, productPhotoList = productPhotoList, prorecommend = prorelist, proComm = procomlist, maxPrice = maxPrice, groupList = gpList }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 页面加载 /// </summary> protected override void PageLoad() { base.PageLoad(); int count = int.MinValue; topNav = 2; int id = RequestHelper.GetQueryString <int>("ID"); if (id <= 0) { ScriptHelper.AlertFront("该产品未上市,不能查看"); } string fromwhere = RequestHelper.GetQueryString <string>("fw"); product = ProductBLL.Read(id); if (product.IsSale == (int)BoolType.False || product.IsDelete == 1) { if (fromwhere.ToLower() != "admin") { ScriptHelper.AlertFront("该产品未上市,不能查看"); } else { if (Cookies.Admin.GetAdminID(true) == 0)//用户未登录 { ScriptHelper.AlertFront("该产品未上市,不能查看"); } } } navList = ProductClassBLL.ProductClassNameList(product.ClassId); //更新查看数量 if (CookiesHelper.ReadCookie("productview" + product.Id + "") == null) { ProductBLL.ChangeViewCount(id, 1); CookiesHelper.AddCookie("productview" + product.Id + "", product.Id.ToString()); } ProductCommentSearchInfo proCommSear = new ProductCommentSearchInfo(); proComm = ProductCommentBLL.SearchProductCommentList(proCommSear = new ProductCommentSearchInfo { ProductId = product.Id }); //会员等级 userGradeList = UserGradeBLL.ReadList(); //产品价格 int hotCount = 0; currentMemberPrice = ProductBLL.GetCurrentPrice(product.SalePrice, base.GradeID); hotProductList = ProductBLL.SearchList(1, 7, new ProductSearchInfo { IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString() }, ref hotCount); ishot = ProductBLL.SearchList(1, 7, new ProductSearchInfo { IsHot = (int)BoolType.True, IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString() }, ref hotCount); proishot = ProductBLL.SearchList(1, 3, new ProductSearchInfo { IsSale = (int)BoolType.True, IsTop = (int)BoolType.True, IsDelete = (int)BoolType.False, NotInProductId = product.Id.ToString() }, ref hotCount); //产品图片 ProductPhotoInfo productPhoto = new ProductPhotoInfo(); productPhoto.Name = product.Name; productPhoto.ImageUrl = product.Photo; productPhotoList.Add(productPhoto); productPhotoList.AddRange(ProductPhotoBLL.ReadList(id, 0)); // 关联产品,配件,浏览过的商品 strHistoryProduct = Server.UrlDecode(CookiesHelper.ReadCookieValue("HistoryProduct")); string tempStrProductID = product.RelationProduct + "," + product.Accessory + "," + strHistoryProduct; tempStrProductID = tempStrProductID.Replace(",,", ","); if (tempStrProductID.StartsWith(",")) { tempStrProductID = tempStrProductID.Substring(1); } if (tempStrProductID.EndsWith(",")) { tempStrProductID = tempStrProductID.Substring(0, tempStrProductID.Length - 1); } ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.InProductId = tempStrProductID; tempProductList = ProductBLL.SearchList(productSearch); //属性 attributeRecordList = ProductTypeAttributeRecordBLL.ReadList(id); //产品文章 if (product.RelationArticle != string.Empty) { ArticleSearchInfo articleSearch = new ArticleSearchInfo(); articleSearch.InArticleId = product.RelationArticle; productArticleList = ArticleBLL.SearchList(articleSearch); } //产品规格 standardRecordList = ProductTypeStandardRecordBLL.ReadListByProduct(product.Id, product.StandardType); if (standardRecordList.Count > 0) { string[] standardIDArray = standardRecordList[0].StandardIdList.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < standardIDArray.Length; i++) { int standardID = Convert.ToInt32(standardIDArray[i]); ProductTypeStandardInfo standard = ProductTypeStandardBLL.Read(standardID); string[] valueArray = standard.ValueList.Split(';'); string valueList = string.Empty; for (int k = 0; k < valueArray.Length; k++) { foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { string[] tempValueArray = standardRecord.ValueList.Split(';'); if (valueArray[k] == tempValueArray[i]) { valueList += valueArray[k] + ";"; break; } } } if (valueList != string.Empty) { valueList = valueList.Substring(0, valueList.Length - 1); } standard.ValueList = valueList; standardList.Add(standard); } //规格值 foreach (ProductTypeStandardRecordInfo standardRecord in standardRecordList) { standardRecordValueList += standardRecord.ProductId + ";" + standardRecord.ValueList + "|"; } } //计算剩余库存量 leftStorageCount = product.TotalStorageCount - product.OrderCount; //搜索优化 Title = (product.SubTitle == string.Empty) ? product.Name : product.SubTitle; Keywords = (product.Keywords == string.Empty) ? product.Name : product.Keywords; Description = (product.Summary == string.Empty) ? StringHelper.Substring(StringHelper.KillHTML(product.Introduction1), 200) : product.Summary; }