public void BindCouponList() { int userId = 0; MemberInfo user = HiContext.Current.User; if (user != null) { userId = user.UserId; } int num = 0; DataTable couponList = CouponHelper.GetCouponList(this.productId, userId, false, false, false); this.hidCouponCount.Value = couponList.Rows.Count.ToString(); this.rptCouponList.DataSource = couponList; this.rptCouponList.DataBind(); }
public void BindCouponList() { int userId = 0; MemberInfo user = HiContext.Current.User; if (user != null) { userId = user.UserId; } int num = 0; int.TryParse(this.Page.Request.QueryString["productId"], out num); DataTable couponList = CouponHelper.GetCouponList(num, userId, false, false, false); this.hidCouponCount.Value = couponList.Rows.Count.ToString(); this.rptCouponList.Visible = (couponList.Rows.Count > 0); this.rptCouponList.DataSource = couponList; this.rptCouponList.DataBind(); }
private void GetCouponList() { int userId = 0; MemberInfo user = HiContext.Current.User; if (user != null) { userId = user.UserId; } int productId = this.context.Request.QueryString["productId"].ToInt(0); DataTable couponList = CouponHelper.GetCouponList(productId, userId, false, false, false); List <Dictionary <string, object> > value = DataHelper.DataTableToDictionary(couponList); IsoDateTimeConverter isoDateTimeConverter = new IsoDateTimeConverter(); isoDateTimeConverter.DateTimeFormat = "yyyy.MM.dd"; string s = JsonConvert.SerializeObject(value, Formatting.Indented, isoDateTimeConverter); this.context.Response.ContentType = "text/json"; this.context.Response.Write(s); }
private void ShowCoupons(HttpContext context) { int num = context.Request["ProductId"].ToInt(0); bool flag = context.Request["IsGroup"].ToBool(); bool flag2 = context.Request["IsPanicBuying"].ToBool(); bool useWithFireGroup = context.Request["IsFireGroup"].ToBool(); StringBuilder stringBuilder = new StringBuilder(); if (flag) { GroupBuyInfo groupBuy = PromoteHelper.GetGroupBuy(num); num = (groupBuy?.ProductId ?? 0); } if (flag2) { CountDownInfo countDownInfo = PromoteHelper.GetCountDownInfo(num, 0); num = (countDownInfo?.ProductId ?? 0); } DataTable couponList = CouponHelper.GetCouponList(num, HiContext.Current.UserId, flag, flag2, useWithFireGroup); if (couponList.Rows.Count > 0) { foreach (DataRow row in couponList.Rows) { decimal num2 = row["Price"].ToDecimal(0); string text = ""; text = ((!(num2 <= 5m)) ? ((!(num2 <= 50m)) ? "Tag3" : "Tag2") : "Tag1"); try { StringBuilder stringBuilder2 = stringBuilder; object[] obj = new object[6] { text, row["CouponId"].ToNullString(), num2.F2ToString("f2"), string.IsNullOrEmpty(row["CanUseProducts"].ToNullString().Trim()) ? "通用" : "部分", (row["OrderUseLimit"].ToDecimal(0) == decimal.Zero) ? "无限制" : ("满" + row["OrderUseLimit"].ToDecimal(0).F2ToString("f2") + "元使用"), null }; object str; DateTime value; if (!row["StartTime"].ToDateTime().HasValue) { str = ""; } else { value = row["StartTime"].ToDateTime().Value; str = value.ToString("yyyy.MM.dd"); } object str2; if (!row["ClosingTime"].ToDateTime().HasValue) { str2 = ""; } else { value = row["ClosingTime"].ToDateTime().Value; str2 = value.ToString("yyyy.MM.dd"); } obj[5] = (string)str + "至" + (string)str2; stringBuilder2.AppendFormat("{{ \"LiId\": \"{0}\", \"CId\": \"{1}\", \"Price\": \"{2}\", \"CanUseProducts\": \"{3}\", \"OrderUseLimit\": \"{4}\", \"SCTime\": \"{5}\"}},", obj); } catch (Exception ex) { string message = ex.Message; } } } context.Response.Write("{\"TotalRecords\":\"" + couponList.Rows.Count + "\",\"Data\":[" + stringBuilder.ToString().TrimEnd(',') + "]}"); context.Response.End(); }