private void LoadOrder() { //Items ucOrderItems.Rebind(); litOrderSummary.Text = CurrentOrder.TotalsAsTable(); txtInstructions.Text = CurrentOrder.Instructions; CouponGrid.DataSource = CurrentOrder.Coupons; CouponGrid.DataBind(); }
protected void CouponGrid_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.Equals("Copy")) { int couponId = AlwaysConvert.ToInt(e.CommandArgument); Coupon coupon = CouponDataSource.Load(couponId); if (coupon != null) { Coupon newCoupon = coupon.Clone(true); // THE NAME SHOULD NOT EXCEED THE MAX 100 CHARS String newName = "Copy of " + newCoupon.Name; if (newName.Length > 100) { newName = newName.Substring(0, 97) + "..."; } newCoupon.Name = newName; newCoupon.CouponCode = StringHelper.RandomString(12); newCoupon.Save(); } CouponGrid.DataBind(); } }
protected void SearchButton_Click(object sender, EventArgs e) { CouponGrid.DataBind(); Session["CouponSearchFilter"] = new SearchFilter(CouponCode.Text.Trim(), AlwaysConvert.ToEnum<CouponUsageFilter>(UsageFilter.SelectedValue, CouponUsageFilter.Any)); }