protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckAdminPower("ReadUserGrade", PowerCheckType.Single); BindControl(UserGradeBLL.ReadList(), RecordList); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { UserGrade.DataSource = UserGradeBLL.ReadList(); UserGrade.DataTextField = "Name"; UserGrade.DataValueField = "Id"; UserGrade.DataBind(); RegionID.DataSource = RegionBLL.ReadRegionUnlimitClass(); ProductClass.DataSource = ProductClassBLL.ReadUnlimitClassList(); favorableActivityID = RequestHelper.GetQueryString <int>("ID"); if (favorableActivityID != int.MinValue) { CheckAdminPower("ReadFavorableActivity", PowerCheckType.Single); favorableActivity = FavorableActivityBLL.Read(favorableActivityID); Photo.Text = favorableActivity.Photo; Name.Text = favorableActivity.Name; Content.Text = favorableActivity.Content; StartDate.Text = favorableActivity.StartDate.ToString("yyyy-MM-dd"); EndDate.Text = favorableActivity.EndDate.ToString("yyyy-MM-dd"); ControlHelper.SetCheckBoxListValue(UserGrade, favorableActivity.UserGrade); OrderProductMoney.Text = favorableActivity.OrderProductMoney.ToString(); RegionID.ClassIDList = favorableActivity.RegionId ?? ""; ReduceMoney.Text = favorableActivity.ReduceMoney.ToString(); ReduceDiscount.Text = favorableActivity.ReduceDiscount.ToString(); favorableType = favorableActivity.Type; ProductClass.ClassIDList = favorableActivity.ClassIds ?? ""; if (!string.IsNullOrEmpty(favorableActivity.GiftId)) { var giftSearch = new FavorableActivityGiftSearchInfo(); giftSearch.InGiftIds = Array.ConvertAll <string, int>(favorableActivity.GiftId.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries), k => Convert.ToInt32(k)); giftList = FavorableActivityGiftBLL.SearchList(giftSearch); } } else {//新增:默认所有会员等级全部选中 foreach (ListItem item in UserGrade.Items) { item.Selected = true; } } } }
protected void SubmitButton_Click(object sender, EventArgs e) { UserGradeInfo userGrade = new UserGradeInfo(); userGrade.Id = RequestHelper.GetQueryString <int>("ID"); userGrade.Name = Name.Text; userGrade.MinMoney = Convert.ToDecimal(MinMoney.Text); userGrade.MaxMoney = Convert.ToDecimal(MaxMoney.Text); userGrade.Discount = Convert.ToDecimal(Discount.Text); if (userGrade.MinMoney >= userGrade.MaxMoney) { ScriptHelper.Alert("等级最高金额必须大于最低金额"); } #region 判断等级范围是否重叠 var gradeList = UserGradeBLL.ReadList().Where(k => k.Id != userGrade.Id).ToList(); if (gradeList.Any(k => (k.MinMoney >= userGrade.MinMoney && k.MaxMoney <= userGrade.MaxMoney) || (k.MinMoney <= userGrade.MinMoney && k.MaxMoney >= userGrade.MaxMoney) || (k.MinMoney < userGrade.MinMoney && k.MaxMoney > userGrade.MinMoney && k.MaxMoney < userGrade.MaxMoney) || (k.MinMoney > userGrade.MinMoney && k.MinMoney < userGrade.MaxMoney && k.MaxMoney > userGrade.MaxMoney))) { ScriptHelper.Alert("等级范围重叠,请重新输入"); } #endregion string alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (userGrade.Id == int.MinValue) { CheckAdminPower("AddUserGrade", PowerCheckType.Single); int id = UserGradeBLL.Add(userGrade); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("UserGrade"), id); } else { CheckAdminPower("UpdateUserGrade", PowerCheckType.Single); UserGradeBLL.Update(userGrade); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("UserGrade"), userGrade.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
/// <summary> /// 获取用户等级规则信息 /// </summary> /// <returns></returns> public ActionResult UserGradeRules() { List <UserGradeInfo> dataList = UserGradeBLL.ReadList(); return(Json(new { ok = true, datalist = dataList, count = dataList.Count, user = user }, JsonRequestBehavior.AllowGet)); }
protected void SubmitButton_Click(object sender, EventArgs e) { FavorableActivityInfo favorableActivity = new FavorableActivityInfo(); favorableActivity.Id = RequestHelper.GetQueryString <int>("ID"); favorableActivity.Name = Name.Text; favorableActivity.Photo = Photo.Text; favorableActivity.Content = Content.Text; favorableActivity.StartDate = Convert.ToDateTime(StartDate.Text); favorableActivity.EndDate = Convert.ToDateTime(EndDate.Text).AddDays(1).AddSeconds(-1); favorableActivity.UserGrade = ControlHelper.GetCheckBoxListValue(UserGrade); favorableActivity.OrderProductMoney = Convert.ToDecimal(OrderProductMoney.Text); favorableActivity.Type = RequestHelper.GetForm <int>("FavorableType") < 0 ? 0 : RequestHelper.GetForm <int>("FavorableType"); int shippingWay = RequestHelper.GetForm <int>("ShippingWay"); string regionID = string.Empty; if (UserGradeBLL.ReadList().Count > 0 && string.IsNullOrEmpty(favorableActivity.UserGrade)) { ScriptHelper.Alert("至少选择1个会员等级", RequestHelper.RawUrl); } if (favorableActivity.EndDate < favorableActivity.StartDate) { ScriptHelper.Alert("结束日期不得小于开始日期"); } //如果是订单优惠类型并选择了运费优惠 if (favorableActivity.Type == (int)FavorableType.AllOrders && shippingWay == 1) { //regionID = RegionID.ClassIDList; favorableActivity.RegionId = RegionID.ClassIDList; } //如果是商品分类优惠 if (favorableActivity.Type == (int)FavorableType.ProductClass) { favorableActivity.ClassIds = ProductClass.ClassIDList; } favorableActivity.ShippingWay = shippingWay; int reduceWay = RequestHelper.GetForm <int>("ReduceWay"); decimal reduceMoney = 0; decimal reduceDiscount = 0; if (reduceWay == 1) { reduceMoney = Convert.ToDecimal(ReduceMoney.Text); } else if (reduceWay == 2) { reduceDiscount = Convert.ToDecimal(ReduceDiscount.Text); } favorableActivity.ReduceWay = reduceWay; favorableActivity.ReduceMoney = reduceMoney; favorableActivity.ReduceDiscount = reduceDiscount; favorableActivity.GiftId = RequestHelper.GetIntsForm("GiftList"); string alertMessage = string.Empty; //限制同一时间段只能有一种优惠方式 //if (FavorableActivityBLL.Read(favorableActivity.StartDate, favorableActivity.EndDate, favorableActivity.Id).Id > 0) //{ // alertMessage = ShopLanguage.ReadLanguage("OneTimeManyFavorableActivity"); //} //else //{ alertMessage = ShopLanguage.ReadLanguage("AddOK"); if (favorableActivity.Id == int.MinValue) { CheckAdminPower("AddFavorableActivity", PowerCheckType.Single); int id = FavorableActivityBLL.Add(favorableActivity); AdminLogBLL.Add(ShopLanguage.ReadLanguage("AddRecord"), ShopLanguage.ReadLanguage("FavorableActivity"), id); } else { CheckAdminPower("UpdateFavorableActivity", PowerCheckType.Single); FavorableActivityBLL.Update(favorableActivity); AdminLogBLL.Add(ShopLanguage.ReadLanguage("UpdateRecord"), ShopLanguage.ReadLanguage("FavorableActivity"), favorableActivity.Id); alertMessage = ShopLanguage.ReadLanguage("UpdateOK"); } //} ScriptHelper.Alert(alertMessage, RequestHelper.RawUrl); }
/// <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; }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckAdminPower("ProductBatchEdit", PowerCheckType.Single); foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList()) { ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|")); } ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty)); BrandID.DataSource = ProductBrandBLL.ReadList(); BrandID.DataTextField = "Name"; BrandID.DataValueField = "ID"; BrandID.DataBind(); BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty)); string action = RequestHelper.GetQueryString <string>("Action"); switch (action) { case "UnionEdit": UnionEdit(); break; case "search": ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Name = RequestHelper.GetQueryString <string>("Name"); productSearch.ClassId = RequestHelper.GetQueryString <string>("ClassID"); productSearch.BrandId = RequestHelper.GetQueryString <int>("BrandID"); productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate"); productSearch.EndAddDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate")); productSearch.IsSale = (int)BoolType.True; ClassID.Text = RequestHelper.GetQueryString <string>("ClassID"); BrandID.Text = RequestHelper.GetQueryString <string>("BrandID"); Name.Text = RequestHelper.GetQueryString <string>("Name"); StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate"); EndAddDate.Text = RequestHelper.GetQueryString <string>("EndAddDate"); BindControl(ProductBLL.SearchList(productSearch), RecordList); break; default: break; } userGradeList = UserGradeBLL.ReadList(); foreach (UserGradeInfo userGrade in userGradeList) { if (userGradeIDList == string.Empty) { userGradeIDList = userGrade.Id.ToString(); userGradeNameList = userGrade.Name; } else { userGradeIDList += "," + userGrade.Id.ToString(); userGradeNameList += "," + userGrade.Name; } } } }
/// <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; }
/// <summary> /// 页面加载方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { CheckAdminPower("ProductBatchEdit", PowerCheckType.Single); string action = RequestHelper.GetQueryString <string>("Action"); if (action == "SingleEdit") { SingleEdit(); } foreach (ProductClassInfo productClass in ProductClassBLL.ReadNamedList()) { ClassID.Items.Add(new ListItem(productClass.Name, "|" + productClass.Id + "|")); } ClassID.Items.Insert(0, new ListItem("所有分类", string.Empty)); BrandID.DataSource = ProductBrandBLL.ReadList(); BrandID.DataTextField = "Name"; BrandID.DataValueField = "ID"; BrandID.DataBind(); BrandID.Items.Insert(0, new ListItem("所有品牌", string.Empty)); ProductSearchInfo productSearch = new ProductSearchInfo(); productSearch.Name = RequestHelper.GetQueryString <string>("Name"); productSearch.ClassId = RequestHelper.GetQueryString <string>("ClassID"); productSearch.BrandId = RequestHelper.GetQueryString <int>("BrandID");; productSearch.StartAddDate = RequestHelper.GetQueryString <DateTime>("StartAddDate"); productSearch.EndAddDate = ShopCommon.SearchEndDate(RequestHelper.GetQueryString <DateTime>("EndAddDate")); productSearch.IsSale = (int)BoolType.True; ClassID.Text = RequestHelper.GetQueryString <string>("ClassID"); BrandID.Text = RequestHelper.GetQueryString <string>("BrandID"); Name.Text = RequestHelper.GetQueryString <string>("Name"); StartAddDate.Text = RequestHelper.GetQueryString <string>("StartAddDate"); EndAddDate.Text = RequestHelper.GetQueryString <string>("EndAddDate"); productList = ProductBLL.SearchList(CurrentPage, PageSize, productSearch, ref Count); BindControl(MyPager); string strProductID = string.Empty; foreach (ProductInfo product in productList) { if (strProductID == string.Empty) { strProductID = product.Id.ToString(); } else { strProductID += "," + product.Id.ToString(); } } userGradeList = UserGradeBLL.ReadList(); foreach (UserGradeInfo userGrade in userGradeList) { if (userGradeIDList == string.Empty) { userGradeIDList = userGrade.Id.ToString(); userGradeNameList = userGrade.Name; } else { userGradeIDList += "," + userGrade.Id.ToString(); userGradeNameList += "," + userGrade.Name; } } } }