protected void Page_Load(object sender, System.EventArgs e) { this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click); string[] allKeys = base.Request.Params.AllKeys; if (allKeys.Contains("id") && base.Request["id"].ToString().bInt(ref this.eId) && !this.Page.IsPostBack) { PointExChangeInfo pointExChangeInfo = PointExChangeHelper.Get(this.eId); this.txt_name.Text = pointExChangeInfo.Name; this.calendarStartDate.SelectedDate = new System.DateTime?(pointExChangeInfo.BeginDate); this.calendarEndDate.SelectedDate = new System.DateTime?(pointExChangeInfo.EndDate); this.txt_img.Text = pointExChangeInfo.ImgUrl; this.hidpic.Value = pointExChangeInfo.ImgUrl; System.Web.UI.WebControls.HiddenField hiddenField = this.SetMemberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField2 = this.SetMemberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField3 = this.SetMemberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField; this.SetMemberRange.Grade = pointExChangeInfo.MemberGrades; this.SetMemberRange.DefualtGroup = pointExChangeInfo.DefualtGroup; this.SetMemberRange.CustomGroup = pointExChangeInfo.CustomGroup; hiddenField.Value = pointExChangeInfo.MemberGrades; hiddenField2.Value = pointExChangeInfo.DefualtGroup; hiddenField3.Value = pointExChangeInfo.CustomGroup; if (pointExChangeInfo.EndDate < System.DateTime.Now) { this.bFinished = true; return; } this.bFinished = false; } }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["id"], out this.id)) { base.GotoResourceNotFound(""); } PointExChangeInfo info = PointExChangeHelper.Get(this.id); if (info != null) { PageTitle.AddSiteNameTitle("积分兑换"); MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember != null) { this.imgCover = (Image)this.FindControl("imgCover"); this.litPoints = (Literal)this.FindControl("litPoints"); this.litPoints.Text = currentMember.Points.ToString(); this.gradeId = currentMember.GradeId; this.imgCover.ImageUrl = !string.IsNullOrEmpty(info.ImgUrl) ? info.ImgUrl : "http://fpoimg.com/640x220"; } } else { HttpContext.Current.Response.Redirect("/vshop/"); HttpContext.Current.Response.End(); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int result = 0; int.TryParse(context.Request.Params["id"], out result); if (result > 0) { int num2; int num3; PointExChangeInfo info = PointExChangeHelper.Get(result); string str = context.Request.Params["sort"]; if (string.IsNullOrWhiteSpace(str)) { str = "ProductId"; } string str2 = context.Request.Params["order"]; if (string.IsNullOrWhiteSpace(str2)) { str2 = "asc"; } if (!int.TryParse(context.Request.Params["page"], out num2)) { num2 = 1; } if (!int.TryParse(context.Request.Params["size"], out num3)) { num3 = 10; } if ((info.BeginDate <= DateTime.Now) && (info.EndDate >= DateTime.Now)) { int num4; DataTable table = PointExChangeHelper.GetProducts(result, num2, num3, out num4, str, str2); foreach (DataRow row in table.Rows) { if (row["ProductNumber"].ToString() == "0") { int num5 = 0; int.TryParse(row["ProductId"].ToString(), out num5); ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), num5); if ((product != null) && (product.SaleStatus == ProductSaleStatus.OnSale)) { row["ProductNumber"] = product.Stock.ToString(); } } else { int num6 = 0; int.TryParse(row["ProductId"].ToString(), out num6); int num7 = 0; int.TryParse(row["ProductNumber"].ToString(), out num7); int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(result, num6); int num9 = ((num7 - productExchangedCount) >= 0) ? (num7 - productExchangedCount) : 0; row["ProductNumber"] = num9; } } string s = JsonConvert.SerializeObject(table, Formatting.Indented); context.Response.Write(s); } } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int result = 0; int.TryParse(context.Request.Params["id"], out result); if (result > 0) { int num3; int num4; PointExChangeInfo info = PointExChangeHelper.Get(result); int gradeId = MemberProcessor.GetCurrentMember().GradeId; string str = context.Request.Params["sort"]; if (string.IsNullOrWhiteSpace(str)) { str = "ProductId"; } string str2 = context.Request.Params["order"]; if (string.IsNullOrWhiteSpace(str2)) { str2 = "asc"; } if (!int.TryParse(context.Request.Params["page"], out num3)) { num3 = 1; } if (!int.TryParse(context.Request.Params["size"], out num4)) { num4 = 10; } bool flag = false; foreach (string str3 in info.MemberGrades.Split(new char[] { ',' })) { if ((int.Parse(str3) == gradeId) || (str3 == "0")) { flag = true; } } if ((flag && (info.BeginDate <= DateTime.Now)) && (info.EndDate >= DateTime.Now)) { int num5; DataTable table = PointExChangeHelper.GetProducts(result, num3, num4, out num5, str, str2); foreach (DataRow row in table.Rows) { if (row["ProductNumber"].ToString() == "0") { int num6 = 0; int.TryParse(row["ProductId"].ToString(), out num6); ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), num6); if ((product != null) && (product.SaleStatus == ProductSaleStatus.OnSale)) { row["ProductNumber"] = product.Stock.ToString(); } } } string s = JsonConvert.SerializeObject(table, Formatting.Indented); context.Response.Write(s); } } }
protected void Page_Load(object sender, EventArgs e) { this.saveBtn.Click += new EventHandler(this.saveBtn_Click); if ((base.Request.Params.AllKeys.Contains <string>("id") && base.Request["id"].ToString().bInt(ref this.eId)) && !this.Page.IsPostBack) { PointExChangeInfo info = PointExChangeHelper.Get(this.eId); this.txt_name.Text = info.Name; this.calendarStartDate.SelectedDate = new DateTime?(info.BeginDate); this.calendarEndDate.SelectedDate = new DateTime?(info.EndDate); this.txt_img.Text = info.ImgUrl; this.hidpic.Value = info.ImgUrl; HiddenField field = this.SetMemberRange.FindControl("txt_Grades") as HiddenField; HiddenField field2 = this.SetMemberRange.FindControl("txt_DefualtGroup") as HiddenField; HiddenField field3 = this.SetMemberRange.FindControl("txt_CustomGroup") as HiddenField; this.SetMemberRange.Grade = info.MemberGrades; this.SetMemberRange.DefualtGroup = info.DefualtGroup; this.SetMemberRange.CustomGroup = info.CustomGroup; field.Value = info.MemberGrades; field2.Value = info.DefualtGroup; field3.Value = info.CustomGroup; if (info.EndDate < DateTime.Now) { this.bFinished = true; } else { this.bFinished = false; } } }
public void ProcessRequest(System.Web.HttpContext context) { context.Response.ContentType = "text/plain"; try { int exchangeId = int.Parse(context.Request["id"].ToString()); string productIds = context.Request["products"]; string pNumbers = context.Request["pNumbers"]; string points = context.Request["points"]; string eachNumbers = context.Request["eachNumbers"]; bool flag = PointExChangeHelper.EditProducts(exchangeId, productIds, pNumbers, points, eachNumbers); if (flag) { context.Response.Write("{\"type\":\"success\",\"data\":\"\"}"); } else { context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}"); } } catch (System.Exception ex) { context.Response.Write("{\"type\":\"error\",\"data\":\"" + ex.Message + "\"}"); } }
protected void DelBtn_Click(object sender, System.EventArgs e) { string text = this.txt_ids.Text; if (string.IsNullOrEmpty(text)) { return; } string[] array = text.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { int num = 0; if (!array[i].bInt(ref num)) { this.ShowMsg("选择活动出错!", false); return; } } for (int j = 0; j < array.Length; j++) { PointExChangeHelper.Delete(int.Parse(array[j])); } this.ShowMsg("删除活动成功!", true); this.BindData(); }
private void CountTotal() { int total = 0; ExChangeSearch search = new ExChangeSearch { status = ExchangeStatus.All, IsCount = true, PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortBy = "Id", SortOrder = SortAction.Desc }; DataTable table = PointExChangeHelper.Query(search, ref total); this.lblAll.Text = (table != null) ? table.Rows.Count.ToString() : "0"; search.status = ExchangeStatus.In; table = PointExChangeHelper.Query(search, ref total); this.lblIn.Text = (table != null) ? table.Rows.Count.ToString() : "0"; search.status = ExchangeStatus.End; table = PointExChangeHelper.Query(search, ref total); this.lblEnd.Text = (table != null) ? table.Rows.Count.ToString() : "0"; search.status = ExchangeStatus.unBegin; table = PointExChangeHelper.Query(search, ref total); this.lblUnBegin.Text = (table != null) ? table.Rows.Count.ToString() : "0"; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { if (Globals.GetCurrentManagerUserId() <= 0) { context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}"); context.Response.End(); } int exchangeId = int.Parse(context.Request["id"].ToString()); string productIds = context.Request["products"]; string pNumbers = context.Request["pNumbers"]; string points = context.Request["points"]; string eachNumbers = context.Request["eachNumbers"]; if (PointExChangeHelper.EditProducts(exchangeId, productIds, pNumbers, points, eachNumbers)) { context.Response.Write("{\"type\":\"success\",\"data\":\"\"}"); } else { context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}"); } } catch (Exception exception) { context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}"); } }
private void grdProducts_ItemCommand(object sender, RepeaterCommandEventArgs e) { if ((e.CommandName == "Delete") && !string.IsNullOrEmpty(e.CommandArgument.ToString())) { PointExChangeHelper.Delete(int.Parse(e.CommandArgument.ToString())); this.ShowMsg("删除活动成功!", true); this.BindData(); } }
private void BindData() { int total = 0; string text = this.txt_name.Text; ExChangeSearch search = new ExChangeSearch { status = this.status, ProductName = text, IsCount = true, PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortBy = "Id", SortOrder = SortAction.Desc }; DataTable table = PointExChangeHelper.Query(search, ref total); if (table != null) { table.Columns.Add("sStatus"); table.Columns.Add("canChkStatus"); if (table.Rows.Count > 0) { for (int i = table.Rows.Count - 1; i >= 0; i--) { DateTime time = DateTime.Parse(table.Rows[i]["BeginDate"].ToString()); DateTime time2 = DateTime.Parse(table.Rows[i]["EndDate"].ToString()); if (time > DateTime.Now) { table.Rows[i]["sStatus"] = "未开始"; table.Rows[i]["canChkStatus"] = string.Empty; } else if ((time2 >= DateTime.Now) && (time <= DateTime.Now)) { table.Rows[i]["sStatus"] = "进行中"; table.Rows[i]["canChkStatus"] = string.Empty; } else if (time2 < DateTime.Now) { table.Rows[i]["sStatus"] = "已结束"; table.Rows[i]["canChkStatus"] = "disabled"; } if (table.Rows[i]["ExChangedNumber"].ToString() == "") { table.Rows[i]["ExChangedNumber"] = "0"; } } } } this.grdProducts.DataSource = table; this.grdProducts.DataBind(); this.pager.TotalRecords = total; this.CountTotal(); }
private void BindData() { int totalRecords = 0; string text = this.txt_name.Text; System.Data.DataTable dataTable = PointExChangeHelper.Query(new ExChangeSearch { status = this.status, ProductName = text, IsCount = true, PageIndex = this.pager.PageIndex, PageSize = this.pager.PageSize, SortBy = "Id", SortOrder = SortAction.Desc }, ref totalRecords); if (dataTable != null) { dataTable.Columns.Add("sStatus"); dataTable.Columns.Add("canChkStatus"); if (dataTable.Rows.Count > 0) { for (int i = dataTable.Rows.Count - 1; i >= 0; i--) { System.DateTime t = System.DateTime.Parse(dataTable.Rows[i]["BeginDate"].ToString()); System.DateTime t2 = System.DateTime.Parse(dataTable.Rows[i]["EndDate"].ToString()); if (t > System.DateTime.Now) { dataTable.Rows[i]["sStatus"] = "未开始"; dataTable.Rows[i]["canChkStatus"] = string.Empty; } else if (t2 >= System.DateTime.Now && t <= System.DateTime.Now) { dataTable.Rows[i]["sStatus"] = "进行中"; dataTable.Rows[i]["canChkStatus"] = string.Empty; } else if (t2 < System.DateTime.Now) { dataTable.Rows[i]["sStatus"] = "已结束"; dataTable.Rows[i]["canChkStatus"] = "disabled"; } if (dataTable.Rows[i]["ExChangedNumber"].ToString() == "") { dataTable.Rows[i]["ExChangedNumber"] = "0"; } } } } this.grdProducts.DataSource = dataTable; this.grdProducts.DataBind(); this.pager.TotalRecords = totalRecords; this.CountTotal(); }
private void grdProducts_ItemCommand(object sender, System.Web.UI.WebControls.RepeaterCommandEventArgs e) { if (e.CommandName == "Delete") { if (string.IsNullOrEmpty(e.CommandArgument.ToString())) { return; } int id = int.Parse(e.CommandArgument.ToString()); PointExChangeHelper.Delete(id); this.ShowMsg("删除活动成功!", true); this.BindData(); } }
protected void Page_Load(object sender, EventArgs e) { this.saveBtn.Click += new EventHandler(this.saveBtn_Click); if ((base.Request.Params.AllKeys.Contains <string>("id") && base.Request["id"].ToString().bInt(ref this.eId)) && !this.Page.IsPostBack) { PointExChangeInfo info = PointExChangeHelper.Get(this.eId); this.txt_name.Text = info.Name; this.txt_Grades.Value = info.MemberGrades; this.calendarStartDate.SelectedDate = new DateTime?(info.BeginDate); this.calendarEndDate.SelectedDate = new DateTime?(info.EndDate); this.txt_img.Text = info.ImgUrl; this.hidpic.Value = info.ImgUrl; if (info.EndDate < DateTime.Now) { this.bFinished = true; } else { this.bFinished = false; } } }
protected void btnBatchStop_Click(object sender, EventArgs e) { if (base.Request.Form["CheckBoxGroup"] != null) { string productIds = base.Request.Form["CheckBoxGroup"].ToString(); if (!string.IsNullOrEmpty(base.Request["id"].ToString())) { if (PointExChangeHelper.SetProductsStatus(int.Parse(base.Request["id"]), 1, productIds)) { this.ShowMsg("暂停商品成功", true); this.BindProducts(this.exchangeId); } else { this.ShowMsg("暂停商品失败", false); } } } else { this.ShowMsg("请先选择商品", false); } }
private void CountTotal() { int num = 0; ExChangeSearch exChangeSearch = new ExChangeSearch(); exChangeSearch.status = ExchangeStatus.All; exChangeSearch.IsCount = true; exChangeSearch.PageIndex = this.pager.PageIndex; exChangeSearch.PageSize = this.pager.PageSize; exChangeSearch.SortBy = "Id"; exChangeSearch.SortOrder = SortAction.Desc; System.Data.DataTable dataTable = PointExChangeHelper.Query(exChangeSearch, ref num); this.lblAll.Text = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0"); exChangeSearch.status = ExchangeStatus.In; dataTable = PointExChangeHelper.Query(exChangeSearch, ref num); this.lblIn.Text = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0"); exChangeSearch.status = ExchangeStatus.End; dataTable = PointExChangeHelper.Query(exChangeSearch, ref num); this.lblEnd.Text = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0"); exChangeSearch.status = ExchangeStatus.unBegin; dataTable = PointExChangeHelper.Query(exChangeSearch, ref num); this.lblUnBegin.Text = ((dataTable != null) ? dataTable.Rows.Count.ToString() : "0"); }
protected void btnDelete_Click(object sender, EventArgs e) { string str = base.Request.Form["CheckBoxGroup"]; if (!string.IsNullOrEmpty(str)) { string[] strArray = str.Split(new char[] { ',' }); for (int i = 0; i < strArray.Length; i++) { int num2 = 0; if (!strArray[i].bInt(ref num2)) { this.ShowMsg("选择活动出错!", false); return; } } for (int j = 0; j < strArray.Length; j++) { PointExChangeHelper.Delete(int.Parse(strArray[j])); } this.ShowMsg("删除活动成功!", true); this.BindData(); } }
protected void btnBatchRemove_Click(object sender, System.EventArgs e) { if (base.Request.Form["CheckBoxGroup"] != null) { string productIds = base.Request.Form["CheckBoxGroup"].ToString(); if (!string.IsNullOrEmpty(base.Request["id"].ToString())) { int num = int.Parse(base.Request["id"]); bool flag = PointExChangeHelper.DeleteProducts(num, productIds); if (flag) { this.ShowMsg("移除商品成功", true); this.BindProducts(this.exchangeId); return; } this.ShowMsg("移除商品失败", false); return; } } else { this.ShowMsg("请先选择商品", false); } }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId) || !int.TryParse(this.Page.Request.QueryString["exchangeId"], out this.exchangeId)) { base.GotoResourceNotFound(""); } this.rptProductImages = (VshopTemplatedRepeater)this.FindControl("rptProductImages"); this.litItemParams = (Literal)this.FindControl("litItemParams"); this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litSalePoint = (Literal)this.FindControl("litSalePoint"); this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litSurplusTime = (Literal)this.FindControl("litSurplusTime"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litStock = (Literal)this.FindControl("litStock"); this.litEachCount = (Literal)this.FindControl("litEachCount"); this.skuSelector = (Common_SKUSelector)this.FindControl("skuSelector"); this.linkDescription = (HyperLink)this.FindControl("linkDescription"); this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes"); this.litSoldCount = (Literal)this.FindControl("litSoldCount"); this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount"); this.litReviewsCount = (Literal)this.FindControl("litReviewsCount"); this.hdHasCollected = (HtmlInputHidden)this.FindControl("hdHasCollected"); this.hdCategoryId = (HtmlInputHidden)this.FindControl("hdCategoryId"); this.hdEachCount = (HtmlInputHidden)this.FindControl("hdEachCount"); this.hdProductId = (HtmlInputHidden)this.FindControl("hdProductId"); this.hdStock = (HtmlInputHidden)this.FindControl("hdStock"); this.hdIsActive = (HtmlInputHidden)this.FindControl("hdIsActive"); this.hdIsInRange = (HtmlInputHidden)this.FindControl("hdIsInRange"); this.hdPoint = (HtmlInputHidden)this.FindControl("hdPoint"); this.hdTemplateid = (HtmlInputHidden)this.FindControl("hdTemplateid"); this.hdUserExchanged = (HtmlInputHidden)this.FindControl("hdUserExchanged"); PointExChangeInfo info = PointExChangeHelper.Get(this.exchangeId); PointExchangeProductInfo productInfo = PointExChangeHelper.GetProductInfo(this.exchangeId, this.productId); ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId); if (((info != null) && (product != null)) && (productInfo != null)) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember != null) { this.hdPoint.Value = currentMember.Points.ToString(); if (MemberProcessor.CheckCurrentMemberIsInRange(info.MemberGrades, info.DefualtGroup, info.CustomGroup)) { this.hdIsInRange.Value = "true"; } else { this.hdIsInRange.Value = "false"; } } if (info.EndDate < DateTime.Now) { this.litSurplusTime.Text = "已结束"; this.hdIsActive.Value = "0"; } else if (info.BeginDate > DateTime.Now) { this.litSurplusTime.Text = "未开始"; this.hdIsActive.Value = "0"; } else { this.hdIsActive.Value = "1"; TimeSpan span = (TimeSpan)(info.EndDate - DateTime.Now); if (span.Days > 1) { this.litSurplusTime.Text = string.Concat(new object[] { "还剩", span.Days, "天", span.Hours, "小时" }); } else { this.litSurplusTime.Text = "还剩" + span.Hours + "小时"; } } this.hdProductId.Value = this.productId.ToString(); if (product == null) { base.GotoResourceNotFound("此商品已不存在"); } if (product.SaleStatus != ProductSaleStatus.OnSale) { base.GotoResourceNotFound(ErrorType.前台商品下架, "此商品已下架"); } if (this.rptProductImages != null) { string locationUrl = "javascript:;"; SlideImage[] imageArray = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) }; this.rptProductImages.DataSource = from item in imageArray where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } string mainCategoryPath = product.MainCategoryPath; if (!string.IsNullOrEmpty(mainCategoryPath)) { this.hdCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0]; } else { this.hdCategoryId.Value = "0"; } this.litProdcutName.Text = product.ProductName; this.hdTemplateid.Value = product.FreightTemplateId.ToString(); this.litSalePoint.Text = productInfo.PointNumber.ToString(); if (product.MarketPrice.HasValue && (product.MarketPrice > 0M)) { this.litMarketPrice.Text = "<del class=\"text-muted font-s\">\x00a5" + product.MarketPrice.Value.ToString("F2") + "</del>"; } this.litShortDescription.Text = product.ShortDescription; string description = product.Description; if (!string.IsNullOrEmpty(description)) { description = Regex.Replace(description, "<img[^>]*\\bsrc=('|\")([^'\">]*)\\1[^>]*>", "<img alt='" + HttpContext.Current.Server.HtmlEncode(product.ProductName) + "' src='$2' />", RegexOptions.IgnoreCase); } if (this.litDescription != null) { this.litDescription.Text = description; } this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString()); int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(this.exchangeId, this.productId); int num2 = ((productInfo.ProductNumber - productExchangedCount) >= 0) ? (productInfo.ProductNumber - productExchangedCount) : 0; this.litStock.Text = num2.ToString(); this.hdStock.Value = num2.ToString(); this.litEachCount.Text = productInfo.EachMaxNumber.ToString(); this.hdEachCount.Value = productInfo.EachMaxNumber.ToString(); this.skuSelector.ProductId = this.productId; if (this.expandAttr != null) { this.expandAttr.ProductId = this.productId; } if (this.linkDescription != null) { this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId; } int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(this.productId, false); this.litConsultationsCount.SetWhenIsNotNull(productConsultationsCount.ToString()); this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId).ToString()); bool flag = false; if (currentMember != null) { this.hdUserExchanged.Value = PointExChangeHelper.GetUserProductExchangedCount(this.exchangeId, this.productId, currentMember.UserId).ToString(); flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId); this.hdHasCollected.SetWhenIsNotNull(flag ? "1" : "0"); } ProductBrowser.UpdateVisitCounts(this.productId); PageTitle.AddSiteNameTitle("积分商品"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); string objStr = ""; if (!string.IsNullOrEmpty(masterSettings.GoodsPic)) { objStr = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic; } this.litItemParams.Text = Globals.GetReplaceStr(objStr, "|", "|") + "|" + Globals.GetReplaceStr(masterSettings.GoodsName, "|", "|") + "|" + Globals.GetReplaceStr(masterSettings.GoodsDescription, "|", "|") + "$" + Globals.HostPath(HttpContext.Current.Request.Url).Replace("|", "|") + Globals.GetReplaceStr(product.ImageUrl1, "|", "|") + "|" + Globals.GetReplaceStr(product.ProductName, "|", "|") + "|" + Globals.GetReplaceStr(product.ShortDescription, "|", "|") + "|" + HttpContext.Current.Request.Url.ToString().Replace("|", "|"); } else { HttpContext.Current.Response.Redirect("/default.aspx"); HttpContext.Current.Response.End(); } }
protected void saveBtn_Click(object sender, EventArgs e) { HiddenField field = this.SetMemberRange.FindControl("txt_Grades") as HiddenField; HiddenField field2 = this.SetMemberRange.FindControl("txt_DefualtGroup") as HiddenField; HiddenField field3 = this.SetMemberRange.FindControl("txt_CustomGroup") as HiddenField; string str = field.Value; string str2 = field2.Value; string str3 = field3.Value; string text = this.txt_name.Text; DateTime? selectedDate = this.calendarStartDate.SelectedDate; DateTime? nullable2 = this.calendarEndDate.SelectedDate; string str5 = this.txt_img.Text; if (string.IsNullOrEmpty(text) || (text.Length > 30)) { this.ShowMsg("请输入活动名称,长度不能超过30个字符!", false); } else if ((str.Equals("-1") && str2.Equals("-1")) && str3.Equals("-1")) { this.ShowMsg("请选择会员范围!", false); } else { DateTime?nullable3 = nullable2; DateTime?nullable4 = selectedDate; if ((nullable3.HasValue & nullable4.HasValue) ? (nullable3.GetValueOrDefault() < nullable4.GetValueOrDefault()) : false) { this.ShowMsg("结束时间不能早于开始时间!", false); } else if (!selectedDate.HasValue || !nullable2.HasValue) { this.ShowMsg("开始时间或者结束时间不能为空!", false); } else if (string.IsNullOrEmpty(str5)) { this.ShowMsg("请上传封面图片!", false); } else { PointExChangeInfo exchange = new PointExChangeInfo(); if (this.eId != 0) { exchange = PointExChangeHelper.Get(this.eId); } exchange.BeginDate = selectedDate.Value; exchange.EndDate = nullable2.Value; exchange.Name = text; exchange.MemberGrades = str; exchange.DefualtGroup = str2; exchange.CustomGroup = str3; exchange.ImgUrl = str5; int eId = this.eId; string msg = ""; if (this.eId == 0) { exchange.ProductNumber = 0; int num2 = PointExChangeHelper.Create(exchange, ref msg); if (num2 == 0) { this.ShowMsg("保存失败(" + msg + ")", false); return; } eId = num2; this.ShowMsg("保存成功!", true); } else if (PointExChangeHelper.Update(exchange, ref msg)) { this.ShowMsg("保存成功!", true); } else { this.ShowMsg("保存失败(" + msg + ")", false); return; } base.Response.Redirect("AddProductToPointExchange.aspx?id=" + eId.ToString()); } } }
protected void saveBtn_Click(object sender, EventArgs e) { string text = this.txt_name.Text; string str2 = this.txt_Grades.Value; DateTime date = this.calendarStartDate.SelectedDate.Value.Date; DateTime time2 = this.calendarEndDate.SelectedDate.Value.Date.AddDays(1.0).AddSeconds(-1.0); string str3 = this.txt_img.Text; if (string.IsNullOrEmpty(text) || (text.Length > 30)) { this.ShowMsg("请输入活动名称,长度不能超过30个字符!", false); } else if (string.IsNullOrEmpty(str2)) { this.ShowMsg("请选择会员等级!", false); } else if (time2 < date) { this.ShowMsg("结束时间不能早于开始时间!", false); } else if (string.IsNullOrEmpty(str3)) { this.ShowMsg("请上传封面图片!", false); } else { PointExChangeInfo exchange = new PointExChangeInfo(); if (this.eId != 0) { exchange = PointExChangeHelper.Get(this.eId); } exchange.BeginDate = date; exchange.EndDate = time2; exchange.Name = text; exchange.MemberGrades = str2; exchange.ImgUrl = str3; int eId = this.eId; string msg = ""; if (this.eId == 0) { exchange.ProductNumber = 0; int num2 = PointExChangeHelper.Create(exchange, ref msg); if (num2 == 0) { this.ShowMsg("保存失败(" + msg + ")", false); return; } eId = num2; this.ShowMsg("保存成功!", true); } else if (PointExChangeHelper.Update(exchange, ref msg)) { this.ShowMsg("保存成功!", true); } else { this.ShowMsg("保存失败(" + msg + ")", false); return; } base.Response.Redirect("AddProductToPointExchange.aspx?id=" + eId.ToString()); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; try { if (Globals.GetCurrentManagerUserId() <= 0) { context.Response.Write("{\"type\":\"error\",\"data\":\"请先登录\"}"); context.Response.End(); } int num = int.Parse(context.Request["actType"].ToString()); int couponId = int.Parse(context.Request["id"].ToString()); string productIds = context.Request["products"]; int num3 = int.Parse(context.Request["type"].ToString()); bool flag = false; if (num == 0) { switch (num3) { case 0: flag = CouponHelper.SetProductsStatus(couponId, 1, productIds); break; case 1: flag = CouponHelper.SetProductsStatus(couponId, 0, productIds); break; case 2: flag = CouponHelper.DeleteProducts(couponId, productIds); break; } } else if (num == 1) { switch (num3) { case 0: flag = ActivityHelper.SetProductsStatus(couponId, 1, productIds); break; case 1: flag = ActivityHelper.SetProductsStatus(couponId, 0, productIds); break; case 2: flag = ActivityHelper.DeleteProducts(couponId, productIds); break; } } else if (num == 2) { switch (num3) { case 0: flag = PointExChangeHelper.SetProductsStatus(couponId, 1, productIds); break; case 1: flag = PointExChangeHelper.SetProductsStatus(couponId, 0, productIds); break; case 2: flag = PointExChangeHelper.DeleteProducts(couponId, productIds); break; } } if (flag) { context.Response.Write("{\"type\":\"success\",\"data\":\"\"}"); } else { context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}"); } } catch (Exception exception) { context.Response.Write("{\"type\":\"error\",\"data\":\"" + exception.Message + "\"}"); } }
public System.Data.DataTable GetExChangeTable(System.Web.HttpContext context, ref int pageCount) { return(PointExChangeHelper.Query(this.GetExChangeSearch(context), ref pageCount)); }
protected void grdProducts_ItemCommand(object source, RepeaterCommandEventArgs e) { string commandName = e.CommandName; switch (commandName) { case "Renew": if (!string.IsNullOrEmpty(base.Request["id"].ToString())) { int exchangeId = int.Parse(base.Request["id"]); string productIds = e.CommandArgument.ToString(); if (PointExChangeHelper.SetProductsStatus(exchangeId, 0, productIds)) { this.ShowMsg("恢复商品成功", true); this.BindProducts(this.exchangeId); return; } this.ShowMsg("恢复商品失败", false); return; } break; case "Pause": if (!string.IsNullOrEmpty(base.Request["id"].ToString())) { int num2 = int.Parse(base.Request["id"]); string str3 = e.CommandArgument.ToString(); if (PointExChangeHelper.SetProductsStatus(num2, 1, str3)) { this.ShowMsg("暂停商品成功", true); this.BindProducts(this.exchangeId); return; } this.ShowMsg("暂停商品失败", false); return; } break; default: if ((commandName == "Delete") && !string.IsNullOrEmpty(base.Request["id"].ToString())) { int num3 = int.Parse(base.Request["id"]); string str4 = e.CommandArgument.ToString(); if (!string.IsNullOrEmpty(str4)) { if (PointExChangeHelper.GetProductExchangedCount(num3, int.Parse(str4)) > 0) { this.ShowMsg("该商品已经存在兑换记录,不能移除!", false); return; } if (PointExChangeHelper.DeleteProducts(num3, str4)) { this.ShowMsg("删除商品成功", true); this.BindProducts(this.exchangeId); return; } this.ShowMsg("删除商品失败", false); } } break; } }
private void BindProducts(int eId) { if (this.exchangeId != 0) { string text = this.txt_name.Text; string val = this.txt_minPrice.Text; string str3 = this.txt_maxPrice.Text; decimal?nullable = null; decimal?nullable2 = null; decimal i = 0M; if (!this.bDecimal(val, ref i)) { nullable = null; } else { nullable = new decimal?(i); } if (!this.bDecimal(str3, ref i)) { nullable2 = null; } else { nullable2 = new decimal?(i); } ProductQuery entity = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = null, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", StartDate = null, BrandId = null, EndDate = null, TypeId = null, SaleStatus = this.status, minPrice = nullable, maxPrice = nullable2, selectQuery = string.Format(" ProductId in ( select ProductId from Hishop_PointExChange_Products where exChangeId={0})", this.exchangeId) }; Globals.EntityCoding(entity, true); DbQueryResult products = ProductHelper.GetProducts(entity); DataTable data = (DataTable)products.Data; data.Columns.Add("ProductNumber"); data.Columns.Add("PointNumber"); data.Columns.Add("eachMaxNumber"); data.Columns.Add("status"); data.Columns.Add("seledStatus"); data.Columns.Add("canSelStatus"); data.Columns.Add("canChkStatus"); DataTable table2 = PointExChangeHelper.GetProducts(this.exchangeId); if ((data != null) && (data.Rows.Count > 0)) { for (int j = data.Rows.Count - 1; j >= 0; j--) { DataRow[] rowArray = table2.Select(" productId='" + data.Rows[j]["ProductId"].ToString() + "'"); if (rowArray.Length > 0) { data.Rows[j]["ProductNumber"] = rowArray[0]["ProductNumber"]; data.Rows[j]["PointNumber"] = rowArray[0]["PointNumber"]; data.Rows[j]["eachMaxNumber"] = rowArray[0]["eachMaxNumber"]; data.Rows[j]["status"] = rowArray[0]["status"]; } else { data.Rows.RemoveAt(j); } } } if (table2 != null) { if ((data.Rows.Count > 0) && (table2.Rows.Count > 0)) { for (int k = 0; k < data.Rows.Count; k++) { int num4 = int.Parse(data.Rows[k]["ProductId"].ToString()); if (table2.Select(string.Format("ProductId={0}", num4)).Length > 0) { data.Rows[k]["seledStatus"] = "''"; data.Rows[k]["canSelStatus"] = "none"; data.Rows[k]["canChkStatus"] = "disabled"; } else { data.Rows[k]["seledStatus"] = "none"; data.Rows[k]["canSelStatus"] = "''"; data.Rows[k]["canChkStatus"] = string.Empty; } } } else if (data.Rows.Count > 0) { for (int m = 0; m < data.Rows.Count; m++) { data.Rows[m]["seledStatus"] = "none"; data.Rows[m]["canSelStatus"] = "''"; data.Rows[m]["canChkStatus"] = string.Empty; } } } this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.lbSelectNumber.Text = (table2 != null) ? table2.Rows.Count.ToString() : "0"; this.setInSaleAndStock(); } }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["productId"], out this.productId) || !int.TryParse(this.Page.Request.QueryString["exchangeId"], out this.exchangeId)) { base.GotoResourceNotFound(""); } this.rptProductImages = (VshopTemplatedRepeater)this.FindControl("rptProductImages"); this.litItemParams = (Literal)this.FindControl("litItemParams"); this.litProdcutName = (Literal)this.FindControl("litProdcutName"); this.litActivities = (Literal)this.FindControl("litActivities"); this.litSalePoint = (Literal)this.FindControl("litSalePoint"); this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litShortDescription = (Literal)this.FindControl("litShortDescription"); this.litSurplusTime = (Literal)this.FindControl("litSurplusTime"); this.litDescription = (Literal)this.FindControl("litDescription"); this.litStock = (Literal)this.FindControl("litStock"); this.litEachCount = (Literal)this.FindControl("litEachCount"); this.skuSelector = (Common_SKUSelector)this.FindControl("skuSelector"); this.linkDescription = (HyperLink)this.FindControl("linkDescription"); this.expandAttr = (Common_ExpandAttributes)this.FindControl("ExpandAttributes"); this.litSoldCount = (Literal)this.FindControl("litSoldCount"); this.litConsultationsCount = (Literal)this.FindControl("litConsultationsCount"); this.litReviewsCount = (Literal)this.FindControl("litReviewsCount"); this.hdHasCollected = (HtmlInputHidden)this.FindControl("hdHasCollected"); this.hdCategoryId = (HtmlInputHidden)this.FindControl("hdCategoryId"); this.hdEachCount = (HtmlInputHidden)this.FindControl("hdEachCount"); this.hdProductId = (HtmlInputHidden)this.FindControl("hdProductId"); this.hdStock = (HtmlInputHidden)this.FindControl("hdStock"); this.hdIsActive = (HtmlInputHidden)this.FindControl("hdIsActive"); this.hdNeedGrade = (HtmlInputHidden)this.FindControl("hdNeedGrade"); this.hdGradeId = (HtmlInputHidden)this.FindControl("hdGradeId"); this.hdPoint = (HtmlInputHidden)this.FindControl("hdPoint"); this.hdTemplateid = (HtmlInputHidden)this.FindControl("hdTemplateid"); this.hdUserExchanged = (HtmlInputHidden)this.FindControl("hdUserExchanged"); PointExChangeInfo info = PointExChangeHelper.Get(this.exchangeId); PointExchangeProductInfo productInfo = PointExChangeHelper.GetProductInfo(this.exchangeId, this.productId); ProductInfo product = ProductBrowser.GetProduct(MemberProcessor.GetCurrentMember(), this.productId); if (((info != null) && (product != null)) && (productInfo != null)) { MemberInfo currentMember = MemberProcessor.GetCurrentMember(); if (currentMember != null) { this.hdGradeId.Value = currentMember.GradeId.ToString(); this.hdPoint.Value = currentMember.Points.ToString(); this.hdNeedGrade.Value = info.MemberGrades; if (info.EndDate < DateTime.Now) { this.litSurplusTime.Text = "已结束"; this.hdIsActive.Value = "0"; } else if (info.BeginDate > DateTime.Now) { this.litSurplusTime.Text = "未开始"; this.hdIsActive.Value = "0"; } else { this.hdIsActive.Value = "1"; TimeSpan span = (TimeSpan)(info.EndDate - DateTime.Now); if (span.Days > 1) { this.litSurplusTime.Text = string.Concat(new object[] { "还剩", span.Days, "天", span.Hours, "小时" }); } else { this.litSurplusTime.Text = "还剩" + span.Hours + "小时"; } } this.hdProductId.Value = this.productId.ToString(); if (!string.IsNullOrEmpty(product.MainCategoryPath)) { DataTable allFull = ProductBrowser.GetAllFull(int.Parse(product.MainCategoryPath.Split(new char[] { '|' })[0].ToString())); this.litActivities.Text = "<div class=\"price clearfix\"><span class=\"title\">促销活动:</span><div class=\"all-action\">"; if (allFull.Rows.Count > 0) { for (int i = 0; i < allFull.Rows.Count; i++) { if (i == 0) { object text = this.litActivities.Text; this.litActivities.Text = string.Concat(new object[] { text, "<div class=\"action\"><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=", allFull.Rows[i]["ActivitiesId"], "&CategoryId=", allFull.Rows[i]["ActivitiesType"], "\">", allFull.Rows[i]["ActivitiesName"].ToString(), "满", decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()).ToString("0"), "减", decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString()).ToString("0"), "</a> </span></div>" }); } else { object obj3 = this.litActivities.Text; this.litActivities.Text = string.Concat(new object[] { obj3, "<div class=\"action actionnone\"><span class=\"purchase\"><a href=\"/Vshop/ActivityDetail.aspx?ActivitiesId=", allFull.Rows[i]["ActivitiesId"], "&CategoryId=", allFull.Rows[i]["ActivitiesType"], "\">", allFull.Rows[i]["ActivitiesName"].ToString(), "满", decimal.Parse(allFull.Rows[i]["MeetMoney"].ToString()).ToString("0"), "减", decimal.Parse(allFull.Rows[i]["ReductionMoney"].ToString()).ToString("0"), "</a> </span></div>" }); } } this.litActivities.Text = this.litActivities.Text + "</div><em> more</em></div>"; } else { this.litActivities.Text = ""; } } if (!string.IsNullOrEmpty(this.litActivities.Text) && (product == null)) { base.GotoResourceNotFound("此商品已不存在"); } if (product.SaleStatus != ProductSaleStatus.OnSale) { base.GotoResourceNotFound("此商品已下架"); } if (this.rptProductImages != null) { string locationUrl = "javascript:;"; SlideImage[] imageArray = new SlideImage[] { new SlideImage(product.ImageUrl1, locationUrl), new SlideImage(product.ImageUrl2, locationUrl), new SlideImage(product.ImageUrl3, locationUrl), new SlideImage(product.ImageUrl4, locationUrl), new SlideImage(product.ImageUrl5, locationUrl) }; this.rptProductImages.DataSource = from item in imageArray where !string.IsNullOrWhiteSpace(item.ImageUrl) select item; this.rptProductImages.DataBind(); } string mainCategoryPath = product.MainCategoryPath; if (!string.IsNullOrEmpty(mainCategoryPath)) { this.hdCategoryId.Value = mainCategoryPath.Split(new char[] { '|' })[0]; } else { this.hdCategoryId.Value = "0"; } this.litProdcutName.Text = product.ProductName; this.hdTemplateid.Value = product.FreightTemplateId.ToString(); this.litSalePoint.Text = productInfo.PointNumber.ToString(); if (product.MarketPrice.HasValue) { this.litMarketPrice.SetWhenIsNotNull(product.MarketPrice.GetValueOrDefault(0M).ToString("F2")); } this.litShortDescription.Text = product.ShortDescription; if (this.litDescription != null) { this.litDescription.Text = product.Description; } this.litSoldCount.SetWhenIsNotNull(product.ShowSaleCounts.ToString()); int productExchangedCount = PointExChangeHelper.GetProductExchangedCount(this.exchangeId, this.productId); int num3 = ((productInfo.ProductNumber - productExchangedCount) >= 0) ? (productInfo.ProductNumber - productExchangedCount) : 0; this.litStock.Text = num3.ToString(); this.hdStock.Value = num3.ToString(); this.litEachCount.Text = productInfo.EachMaxNumber.ToString(); this.hdEachCount.Value = productInfo.EachMaxNumber.ToString(); this.hdUserExchanged.Value = PointExChangeHelper.GetUserProductExchangedCount(this.exchangeId, this.productId, currentMember.UserId).ToString(); this.skuSelector.ProductId = this.productId; if (this.expandAttr != null) { this.expandAttr.ProductId = this.productId; } if (this.linkDescription != null) { this.linkDescription.NavigateUrl = "/Vshop/ProductDescription.aspx?productId=" + this.productId; } int productConsultationsCount = ProductBrowser.GetProductConsultationsCount(this.productId, false, currentMember.UserId); this.litConsultationsCount.SetWhenIsNotNull(productConsultationsCount.ToString()); this.litReviewsCount.SetWhenIsNotNull(ProductBrowser.GetProductReviewsCount(this.productId, currentMember.UserId).ToString()); bool flag = false; flag = ProductBrowser.CheckHasCollect(currentMember.UserId, this.productId); this.hdHasCollected.SetWhenIsNotNull(flag ? "1" : "0"); ProductBrowser.UpdateVisitCounts(this.productId); PageTitle.AddSiteNameTitle("积分商品"); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false, wid); string str3 = ""; if (!string.IsNullOrEmpty(masterSettings.GoodsPic)) { str3 = Globals.HostPath(HttpContext.Current.Request.Url) + masterSettings.GoodsPic; } this.litItemParams.Text = string.Concat(new object[] { str3, "|", masterSettings.GoodsName, "|", masterSettings.GoodsDescription, "$", Globals.HostPath(HttpContext.Current.Request.Url), product.ImageUrl1, "|", this.litProdcutName.Text, "|", product.ShortDescription, "|", HttpContext.Current.Request.Url }); } } else { HttpContext.Current.Response.Redirect("/vshop/"); HttpContext.Current.Response.End(); } }
public void ProcessRequest(System.Web.HttpContext context) { context.Response.ContentType = "text/plain"; context.Response.ContentType = "text/plain"; try { int num = int.Parse(context.Request["actType"].ToString()); int num2 = int.Parse(context.Request["id"].ToString()); string productIds = context.Request["products"]; int num3 = int.Parse(context.Request["type"].ToString()); bool flag = false; if (num == 0) { if (num3 == 0) { flag = CouponHelper.SetProductsStatus(num2, 1, productIds); } else if (num3 == 1) { flag = CouponHelper.SetProductsStatus(num2, 0, productIds); } else if (num3 == 2) { flag = CouponHelper.DeleteProducts(num2, productIds); } } else if (num == 1) { if (num3 == 0) { flag = ActivityHelper.SetProductsStatus(num2, 1, productIds); } else if (num3 == 1) { flag = ActivityHelper.SetProductsStatus(num2, 0, productIds); } else if (num3 == 2) { flag = ActivityHelper.DeleteProducts(num2, productIds); } } else if (num == 2) { if (num3 == 0) { flag = PointExChangeHelper.SetProductsStatus(num2, 1, productIds); } else if (num3 == 1) { flag = PointExChangeHelper.SetProductsStatus(num2, 0, productIds); } else if (num3 == 2) { flag = PointExChangeHelper.DeleteProducts(num2, productIds); } } if (flag) { context.Response.Write("{\"type\":\"success\",\"data\":\"\"}"); } else { context.Response.Write("{\"type\":\"success\",\"data\":\"写数据库失败\"}"); } } catch (System.Exception ex) { context.Response.Write("{\"type\":\"error\",\"data\":\"" + ex.Message + "\"}"); } }
protected override void AttachChildControls() { if (!int.TryParse(this.Page.Request.QueryString["id"], out this.id)) { base.GotoResourceNotFound(""); } PointExChangeInfo pointExChangeInfo = PointExChangeHelper.Get(this.id); if (pointExChangeInfo != null) { this.hideImgUrl = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideImgUrl"); this.hideTitle = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideTitle"); this.hideDesc = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hideDesc"); this.hideTitle.Value = pointExChangeInfo.Name; this.hideDesc.Value = "活动时间:" + pointExChangeInfo.BeginDate.ToString("yyyy-MM-dd HH:mm:ss") + "至" + pointExChangeInfo.EndDate.ToString("yyyy-MM-dd HH:mm:ss"); System.Uri url = System.Web.HttpContext.Current.Request.Url; string imgUrl = pointExChangeInfo.ImgUrl; string str = string.Empty; if (!string.IsNullOrEmpty(imgUrl)) { if (!imgUrl.StartsWith("http")) { str = url.Scheme + "://" + url.Host + ((url.Port == 80) ? "" : (":" + url.Port.ToString())); } this.hideImgUrl.Value = str + imgUrl; } PageTitle.AddSiteNameTitle(pointExChangeInfo.Name); this.imgCover = (System.Web.UI.WebControls.Image) this.FindControl("imgCover"); if (!string.IsNullOrEmpty(pointExChangeInfo.ImgUrl)) { this.imgCover.ImageUrl = pointExChangeInfo.ImgUrl; } else { this.imgCover.Visible = false; } MemberInfo currentMember = MemberProcessor.GetCurrentMember(); this.litPoints = (System.Web.UI.WebControls.Literal) this.FindControl("litPoints"); if (currentMember != null) { this.hiddisInRange = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddisInRange"); this.hiddUserId = (System.Web.UI.HtmlControls.HtmlInputHidden) this.FindControl("hiddUserId"); this.litPoints.Text = currentMember.Points.ToString(); this.hiddUserId.Value = currentMember.UserId.ToString(); if (MemberProcessor.CheckCurrentMemberIsInRange(pointExChangeInfo.MemberGrades, pointExChangeInfo.DefualtGroup, pointExChangeInfo.CustomGroup)) { this.hiddisInRange.Value = "true"; } else { this.hiddisInRange.Value = "false"; } } else { this.litPoints.Text = "请先登录"; } } else { System.Web.HttpContext.Current.Response.Redirect("/default.aspx"); System.Web.HttpContext.Current.Response.End(); } }
private void BindProducts(int exchangeId) { if (exchangeId == 0) { return; } string text = this.txt_name.Text; string text2 = this.txt_minPrice.Text; string text3 = this.txt_maxPrice.Text; decimal?minPrice = null; decimal?maxPrice = null; decimal value = 0m; if (!this.bDecimal(text2, ref value)) { minPrice = null; } else { minPrice = new decimal?(value); } if (!this.bDecimal(text3, ref value)) { maxPrice = null; } else { maxPrice = new decimal?(value); } ProductQuery productQuery = new ProductQuery { Keywords = text, ProductCode = "", CategoryId = null, PageSize = this.pager.PageSize, PageIndex = this.pager.PageIndex, SortOrder = SortAction.Desc, SortBy = "DisplaySequence", StartDate = null, BrandId = null, EndDate = null, TypeId = null, SaleStatus = this.status, minPrice = minPrice, maxPrice = maxPrice, TwoSaleStatus = "OnStock" }; Globals.EntityCoding(productQuery, true); DbQueryResult products = ProductHelper.GetProducts(productQuery); System.Data.DataTable dataTable = (System.Data.DataTable)products.Data; System.Data.DataTable products2 = PointExChangeHelper.GetProducts(this.eId); dataTable.Columns.Add("ProductNumber"); dataTable.Columns.Add("PointNumber"); dataTable.Columns.Add("eachMaxNumber"); dataTable.Columns.Add("seledStatus"); dataTable.Columns.Add("canSelStatus"); dataTable.Columns.Add("canChkStatus"); if (dataTable != null && dataTable.Rows.Count > 0) { for (int i = 0; i < dataTable.Rows.Count; i++) { dataTable.Rows[i]["ProductNumber"] = 0; dataTable.Rows[i]["PointNumber"] = 0; dataTable.Rows[i]["eachMaxNumber"] = 0; } } if (products2 != null) { if (dataTable.Rows.Count > 0 && products2.Rows.Count > 0) { for (int j = 0; j < dataTable.Rows.Count; j++) { int num = int.Parse(dataTable.Rows[j]["ProductId"].ToString()); if (products2.Select(string.Format("ProductId={0}", num)).Length > 0) { dataTable.Rows[j]["seledStatus"] = "''"; dataTable.Rows[j]["canSelStatus"] = "none"; dataTable.Rows[j]["canChkStatus"] = "disabled"; PointExchangeProductInfo productInfo = PointExChangeHelper.GetProductInfo(exchangeId, num); if (productInfo != null) { dataTable.Rows[j]["ProductNumber"] = productInfo.ProductNumber.ToString(); dataTable.Rows[j]["PointNumber"] = productInfo.PointNumber.ToString(); dataTable.Rows[j]["eachMaxNumber"] = productInfo.EachMaxNumber.ToString(); } } else { dataTable.Rows[j]["seledStatus"] = "none"; dataTable.Rows[j]["canSelStatus"] = "''"; dataTable.Rows[j]["canChkStatus"] = string.Empty; } } } else if (dataTable.Rows.Count > 0) { for (int k = 0; k < dataTable.Rows.Count; k++) { dataTable.Rows[k]["seledStatus"] = "none"; dataTable.Rows[k]["canSelStatus"] = "''"; dataTable.Rows[k]["canChkStatus"] = string.Empty; } } } this.grdProducts.DataSource = products.Data; this.grdProducts.DataBind(); this.pager.TotalRecords = products.TotalRecords; this.lbwareNumber.Text = products.TotalRecords.ToString(); this.lbSelectNumber.Text = ((products2 != null) ? products2.Rows.Count.ToString() : "0"); this.setInSale(); }
protected void saveBtn_Click(object sender, System.EventArgs e) { System.Web.UI.WebControls.HiddenField hiddenField = this.SetMemberRange.FindControl("txt_Grades") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField2 = this.SetMemberRange.FindControl("txt_DefualtGroup") as System.Web.UI.WebControls.HiddenField; System.Web.UI.WebControls.HiddenField hiddenField3 = this.SetMemberRange.FindControl("txt_CustomGroup") as System.Web.UI.WebControls.HiddenField; string value = hiddenField.Value; string value2 = hiddenField2.Value; string value3 = hiddenField3.Value; string text = this.txt_name.Text; System.DateTime?selectedDate = this.calendarStartDate.SelectedDate; System.DateTime?selectedDate2 = this.calendarEndDate.SelectedDate; string text2 = this.txt_img.Text; if (string.IsNullOrEmpty(text) || text.Length > 30) { this.ShowMsg("请输入活动名称,长度不能超过30个字符!", false); return; } if (value.Equals("-1") && value2.Equals("-1") && value3.Equals("-1")) { this.ShowMsg("请选择会员范围!", false); return; } if (selectedDate2 < selectedDate) { this.ShowMsg("结束时间不能早于开始时间!", false); return; } if (!selectedDate.HasValue || !selectedDate2.HasValue) { this.ShowMsg("开始时间或者结束时间不能为空!", false); return; } if (string.IsNullOrEmpty(text2)) { this.ShowMsg("请上传封面图片!", false); return; } PointExChangeInfo pointExChangeInfo = new PointExChangeInfo(); if (this.eId != 0) { pointExChangeInfo = PointExChangeHelper.Get(this.eId); } pointExChangeInfo.BeginDate = selectedDate.Value; pointExChangeInfo.EndDate = selectedDate2.Value; pointExChangeInfo.Name = text; pointExChangeInfo.MemberGrades = value; pointExChangeInfo.DefualtGroup = value2; pointExChangeInfo.CustomGroup = value3; pointExChangeInfo.ImgUrl = text2; int num = this.eId; string str = ""; if (this.eId == 0) { pointExChangeInfo.ProductNumber = 0; int num2 = PointExChangeHelper.Create(pointExChangeInfo, ref str); if (num2 == 0) { this.ShowMsg("保存失败(" + str + ")", false); return; } num = num2; this.ShowMsg("保存成功!", true); } else { bool flag = PointExChangeHelper.Update(pointExChangeInfo, ref str); if (!flag) { this.ShowMsg("保存失败(" + str + ")", false); return; } this.ShowMsg("保存成功!", true); } base.Response.Redirect("AddProductToPointExchange.aspx?id=" + num.ToString()); }