public static void AdjustCoupon(Basket basket, CouponAdjustment coupAdj) { if (coupAdj != null) { BasketItem basketItem = new BasketItem(); basketItem.OrderItemType = OrderItemType.Coupon; basketItem.Price = -1 * coupAdj.appliedamount.Value; basketItem.Quantity = 1; basketItem.BasketId = basket.BasketId; basketItem.Sku = coupAdj.code; Coupon coupon = CouponDataSource.LoadForCouponCode(coupAdj.code); if (coupon == null) { //shouldn't ever happen. However if it does we have //no option but to add as an unknown coupon basketItem.Name = "Unknown Coupon '" + coupAdj.code + "' (GoogleCheckout)"; Logger.Warn("A coupon applied by Google Checkout is not recognized in the Store. Coupon Code : " + coupAdj.code + ", Applied Amount : " + coupAdj.appliedamount); } else { basketItem.Name = coupon.Name; basket.BasketCoupons.Add(new BasketCoupon(basket.BasketId, coupon.CouponId)); } basket.Items.Add(basketItem); } }
private void SaveOrder() { if (AlwaysConvert.ToInt16(ItemType.SelectedValue) == (Int16)OrderItemType.Coupon) { //IF IT IS A COUPON, VALIDATE THE ENTERED SKU ( COUPON CODE ) if (CouponDataSource.LoadForCouponCode(Sku.Text) == null) { CustomValidator skuValidator = new CustomValidator(); skuValidator.IsValid = false; skuValidator.ControlToValidate = "Sku"; skuValidator.ValidationGroup = ValidationSummary.ValidationGroup; skuValidator.ErrorMessage = "Sku is not a valid coupon code."; skuValidator.Text = "*"; phSkuValidators.Controls.Add(skuValidator); return; } } //add the custom item OrderItem oi = new OrderItem(); oi.OrderId = _OrderId; oi.OrderItemTypeId = AlwaysConvert.ToInt16(ItemType.SelectedValue); if (_OrderShipment == null) { oi.OrderShipmentId = AlwaysConvert.ToInt(ShipmentsList.SelectedValue); } else { oi.OrderShipmentId = _OrderShipmentId; } oi.Name = Name.Text; oi.Sku = Sku.Text; Decimal price = AlwaysConvert.ToDecimal(Price.Text); //We should not allow positive values for Discount or Credit. We should not // allow negative values for Charge. switch (oi.OrderItemTypeId) { case ((short)OrderItemType.Discount): case ((short)OrderItemType.Credit): if (price > 0) { price = Decimal.Negate(price); } break; case ((short)OrderItemType.Charge): if (price < 0) { price = Decimal.Negate(price); } break; } oi.Price = price; oi.Quantity = AlwaysConvert.ToInt16(Quantity.Text); _Order.Items.Add(oi); _Order.Save(true, false); }
public static bool DeleteCoupons(int[] couponIds) { List<string> ids = new List<string>(); IDatabaseSessionManager database = AbleContext.Current.Database; database.BeginTransaction(); foreach (int cid in couponIds) { CouponDataSource.Delete(cid); } database.CommitTransaction(); return true; }
public static bool DeleteAllCoupons(SearchFilter filter) { IList<Coupon> coupons = CouponDataSource.Search(filter.CouponCode, filter.UsageFilter); if (coupons != null) { IDatabaseSessionManager database = AbleContext.Current.Database; database.BeginTransaction(); coupons.DeleteAll(); database.CommitTransaction(); return true; } else return false; }
protected void Page_Load(object sender, EventArgs e) { _CouponId = AlwaysConvert.ToInt(Request.QueryString["CouponId"]); _Coupon = CouponDataSource.Load(_CouponId); if (_Coupon == null) { Response.Redirect("Default.aspx"); } if (_Coupon.ProductRule == CouponRule.All) { RedirectToEdit(); } if (!Page.IsPostBack) { Caption.Text = string.Format(Caption.Text, _Coupon.Name); } FindAssignProducts1.AssignmentValue = _CouponId; FindAssignProducts1.OnAssignProduct += new AssignProductEventHandler(FindAssignProducts1_AssignProduct); FindAssignProducts1.OnLinkCheck += new AssignProductEventHandler(FindAssignProducts1_LinkCheck); FindAssignProducts1.OnCancel += new EventHandler(FindAssignProducts1_CancelButton); }
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(); } }
internal LSDecimal GetProductSubtotal() { LSDecimal productSubtotal = 0; foreach (OrderItem oi in this.Items) { if (oi.OrderItemType == OrderItemType.Product || oi.OrderItemType == OrderItemType.Discount) { productSubtotal += oi.ExtendedPrice; } else if (oi.OrderItemType == OrderItemType.Coupon) { //ONLY ADD COUPON IF IT IS NOT A SHIPPING COUPON string couponCode = oi.Sku; Coupon coupon = CouponDataSource.LoadForCouponCode(couponCode); if (coupon != null && coupon.CouponType != CouponType.Shipping) { productSubtotal += oi.ExtendedPrice; } } } return(productSubtotal); }
private void ApplyCoupon() { ValidCouponMessage.Visible = false; string couponCode = StringHelper.StripHtml(Request.Form[CouponCode.UniqueID]); Coupon coupon = CouponDataSource.LoadForCouponCode(couponCode); String couponValidityMessage = String.Empty; InvalidCouponMessage.Text = "Invalid coupon code."; if (coupon != null) { ICouponCalculator couponCalculator = AbleContext.Resolve <ICouponCalculator>(); if (!couponCalculator.IsCouponAlreadyUsed(AbleContext.Current.User.Basket, coupon)) { if (couponCalculator.IsCouponValid(AbleContext.Current.User.Basket, coupon, out couponValidityMessage)) { Basket basket = AbleContext.Current.User.Basket; BasketCoupon recentCoupon = new BasketCoupon(AbleContext.Current.User.Basket, coupon); recentCoupon.AppliedDate = LocaleHelper.LocalNow; basket.BasketCoupons.Add(recentCoupon); // APPLY COUPON COMBINE RULE //THE RULE: //If most recently applied coupon is marked "do not combine", then all previously //entered coupons must be removed from basket. //If most recently applied coupon is marked "combine", then remove any applied //coupon that is marked "do not combine". (Logically, in this instance there //could be at most one other coupon of this type...) string previousCouponsRemoved = ""; if (recentCoupon.Coupon.AllowCombine) { //IF ALLOW COMBINE, REMOVE ALL PREVIOUS NOCOMBINE COUPONS for (int i = (basket.BasketCoupons.Count - 1); i >= 0; i--) { if (!basket.BasketCoupons[i].Coupon.AllowCombine) { if (previousCouponsRemoved.Length > 0) { previousCouponsRemoved += "," + basket.BasketCoupons[i].Coupon.Name; } else { previousCouponsRemoved = basket.BasketCoupons[i].Coupon.Name; } basket.BasketCoupons.DeleteAt(i); } } } else { //IF NOT ALLOW COMBINE, REMOVE ALL EXCEPT THIS COUPON for (int i = (basket.BasketCoupons.Count - 1); i >= 0; i--) { if (basket.BasketCoupons[i] != recentCoupon) { if (previousCouponsRemoved.Length > 0) { previousCouponsRemoved += "," + basket.BasketCoupons[i].Coupon.Name; } else { previousCouponsRemoved = basket.BasketCoupons[i].Coupon.Name; } basket.BasketCoupons.DeleteAt(i); } } } basket.Save(); IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Recalculate(basket); if (previousCouponsRemoved.Length > 0) { if (recentCoupon.Coupon.AllowCombine) { CombineCouponRemoveMessage.Text = String.Format(CombineCouponRemoveMessage.Text, recentCoupon.Coupon.Name, previousCouponsRemoved, previousCouponsRemoved); CombineCouponRemoveMessage.Visible = true; } else { NotCombineCouponRemoveMessage.Text = String.Format(NotCombineCouponRemoveMessage.Text, recentCoupon.Coupon.Name, previousCouponsRemoved); NotCombineCouponRemoveMessage.Visible = true; } } ValidCouponMessage.Visible = true; } else { InvalidCouponMessage.Text = couponValidityMessage + "<br /><br />"; } } else { InvalidCouponMessage.Text = string.Format(InvalidCouponMessage.Text, "The coupon code you've entered is already in use."); } } else { InvalidCouponMessage.Text = string.Format(InvalidCouponMessage.Text, "The coupon code you've entered is invalid."); } InvalidCouponMessage.Visible = !ValidCouponMessage.Visible; }
protected int SaveCoupon() { if (Page.IsValid) { // VALIDATE IF A PROPER END DATE IS SELECTED if (EndDate.SelectedEndDate != DateTime.MinValue && DateTime.Compare(EndDate.SelectedEndDate, StartDate.SelectedEndDate) < 0) { CustomValidator dateValidator = new CustomValidator(); dateValidator.ControlToValidate = "Name"; // THIS SHOULD BE "EndDate" CONTROL, BUT THAT CANNOT BE VALIDATED dateValidator.Text = "*"; dateValidator.ErrorMessage = "End date can not be earlier than start date."; dateValidator.IsValid = false; phEndDateValidator.Controls.Add(dateValidator); return(0); } Coupon existingCoupon = CouponDataSource.LoadForCouponCode(CouponCode.Text); if (existingCoupon != null) { CustomValidator codeValidator = new CustomValidator(); codeValidator.ControlToValidate = "CouponCode"; codeValidator.Text = "*"; codeValidator.ErrorMessage = "The coupon code " + CouponCode.Text + " is already in use."; codeValidator.IsValid = false; phCouponCodeValidator.Controls.Add(codeValidator); return(0); } Coupon _Coupon = new Coupon(); _Coupon.CouponType = this.CouponType; _Coupon.Name = Name.Text; _Coupon.CouponCode = CouponCode.Text; _Coupon.DiscountAmount = AlwaysConvert.ToDecimal(DiscountAmount.Text); _Coupon.IsPercent = (DiscountType.SelectedIndex == 0); //QUANTITY SETTINGS (PRODUCT COUPON) if (_Coupon.CouponType == CouponType.Product) { _Coupon.MinQuantity = AlwaysConvert.ToInt16(Quantity.Text); if (RepeatCoupon.Checked) { _Coupon.MaxQuantity = 0; _Coupon.QuantityInterval = _Coupon.MinQuantity; } else { _Coupon.MaxQuantity = _Coupon.MinQuantity; _Coupon.QuantityInterval = 0; } _Coupon.MaxValue = 0; _Coupon.MinPurchase = 0; } //PURCHASE RESTRICTIONS (ORDER AND SHIPPING COUPONS) else { _Coupon.MaxValue = AlwaysConvert.ToDecimal(MaxValue.Text); _Coupon.MinPurchase = AlwaysConvert.ToDecimal(MinPurchase.Text); _Coupon.MinQuantity = 0; _Coupon.MaxQuantity = 0; _Coupon.QuantityInterval = 0; } //SET START DATE _Coupon.StartDate = StartDate.SelectedDate; //SET END DATE _Coupon.EndDate = EndDate.SelectedEndDate; //MAX USES _Coupon.MaxUsesPerCustomer = AlwaysConvert.ToInt16(MaximumUsesPerCustomer.Text); _Coupon.MaxUses = AlwaysConvert.ToInt16(MaximumUses.Text); //COMBINE RULE _Coupon.AllowCombine = AllowCombine.Checked; //PRODUCT (OR SHIPPING) RULE if (_Coupon.CouponType != CouponType.Shipping) { _Coupon.ProductRule = (CouponRule)ProductRule.SelectedIndex; } else { _Coupon.ProductRule = (CouponRule)ShipMethodRule.SelectedIndex; _Coupon.ShipMethods.Clear(); _Coupon.Save(); if (_Coupon.ProductRule != CouponRule.All) { foreach (ListItem item in ShipMethodList.Items) { ShipMethod shipMethod = ShipMethodDataSource.Load(AlwaysConvert.ToInt(item.Value)); if (item.Selected) { _Coupon.ShipMethods.Add(shipMethod); } } } } //GROUP RESTRICTION if (UseGroupRestriction.SelectedIndex > 0) { _Coupon.Groups.Clear(); _Coupon.Save(); foreach (ListItem item in GroupList.Items) { Group group = GroupDataSource.Load(AlwaysConvert.ToInt(item.Value)); if (item.Selected) { _Coupon.Groups.Add(group); } } } _Coupon.Save(); return(_Coupon.Id); } return(0); }
protected void ApplyCouponButton_Click(object sender, EventArgs e) { ValidCouponMessage.Visible = false; CouponCode.Text = StringHelper.StripHtml(CouponCode.Text); Coupon coupon = CouponDataSource.LoadForCouponCode(CouponCode.Text); String couponValidityMessage = String.Empty; ICouponCalculator couponCalculator = AbleContext.Resolve <ICouponCalculator>(); if (coupon != null) { if (!couponCalculator.IsCouponAlreadyUsed(_Basket, coupon)) { if (couponCalculator.IsCouponValid(_Basket, coupon, out couponValidityMessage)) { BasketCoupon recentCoupon = new BasketCoupon(_Basket, coupon); _Basket.BasketCoupons.Add(recentCoupon); // APPLY COUPON COMBINE RULE //THE RULE: //If most recently applied coupon is marked "do not combine", then all previously //entered coupons must be removed from _Basket. //If most recently applied coupon is marked "combine", then remove any applied //coupon that is marked "do not combine". (Logically, in this instance there //could be at most one other coupon of this type...) string previousCouponsRemoved = ""; if (recentCoupon.Coupon.AllowCombine) { //IF ALLOW COMBINE, REMOVE ALL PREVIOUS NOCOMBINE COUPONS for (int i = (_Basket.BasketCoupons.Count - 1); i >= 0; i--) { if (!_Basket.BasketCoupons[i].Coupon.AllowCombine) { if (previousCouponsRemoved.Length > 0) { previousCouponsRemoved += "," + _Basket.BasketCoupons[i].Coupon.Name; } else { previousCouponsRemoved = _Basket.BasketCoupons[i].Coupon.Name; } _Basket.BasketCoupons.DeleteAt(i); } } } else { //IF NOT ALLOW COMBINE, REMOVE ALL EXCEPT THIS COUPON for (int i = (_Basket.BasketCoupons.Count - 1); i >= 0; i--) { if (_Basket.BasketCoupons[i] != recentCoupon) { if (previousCouponsRemoved.Length > 0) { previousCouponsRemoved += "," + _Basket.BasketCoupons[i].Coupon.Name; } else { previousCouponsRemoved = _Basket.BasketCoupons[i].Coupon.Name; } _Basket.BasketCoupons.DeleteAt(i); } } } _Basket.Save(); IBasketService preCheckoutService = AbleContext.Resolve <IBasketService>(); preCheckoutService.Recalculate(_Basket); if (previousCouponsRemoved.Length > 0) { if (recentCoupon.Coupon.AllowCombine) { CombineCouponRemoveMessage.Text = String.Format(CombineCouponRemoveMessage.Text, recentCoupon.Coupon.Name, previousCouponsRemoved, previousCouponsRemoved); CombineCouponRemoveMessage.Visible = true; } else { NotCombineCouponRemoveMessage.Text = String.Format(NotCombineCouponRemoveMessage.Text, recentCoupon.Coupon.Name, previousCouponsRemoved); NotCombineCouponRemoveMessage.Visible = true; } } ValidCouponMessage.Visible = true; } else { InvalidCouponMessage.Text = couponValidityMessage + "<br /><br />"; } } else { InvalidCouponMessage.Text = "The coupon code you've entered is already in use.<br /><br />"; } } else { InvalidCouponMessage.Text = "The coupon code you've entered is invalid.<br /><br />"; } CouponCode.Text = string.Empty; InvalidCouponMessage.Visible = !ValidCouponMessage.Visible; }
protected int GetUseCount(string couponCode) { return CouponDataSource.CountUses(couponCode); }
protected void Page_Load(object sender, EventArgs e) { _CouponId = AlwaysConvert.ToInt(Request.QueryString["CouponId"]); _Coupon = CouponDataSource.Load(_CouponId); if (_Coupon == null) { Response.Redirect("Default.aspx"); } if (!Page.IsPostBack) { Caption.Text = string.Format(Caption.Text, _Coupon.Name); trShipMethodRule.Visible = (_Coupon.CouponType == CouponType.Shipping); trProductRule.Visible = (_Coupon.CouponType != CouponType.Shipping); trQuantity.Visible = (_Coupon.CouponType == CouponType.Product); trValue.Visible = (_Coupon.CouponType != CouponType.Product); Name.Text = _Coupon.Name; CouponCode.Text = _Coupon.CouponCode; DiscountAmount.Text = string.Format("{0:F2}", _Coupon.DiscountAmount); DiscountType.SelectedIndex = (_Coupon.IsPercent ? 0 : 1); //QUANTITY FOR PRODUCT COUPONS if (_Coupon.MinQuantity > 0) { Quantity.Text = string.Format("{0:F0}", _Coupon.MinQuantity); } RepeatCoupon.Checked = (_Coupon.MaxQuantity != _Coupon.MinQuantity); //VALUE RESTRICTIONS FOR ORDER AND SHIPPING COUPONS if (_Coupon.MaxValue > 0) { MaxValue.Text = string.Format("{0:F2}", _Coupon.MaxValue); } if (_Coupon.MinPurchase > 0) { MinPurchase.Text = string.Format("{0:F2}", _Coupon.MinPurchase); } //START DATE StartDate.SelectedDate = _Coupon.StartDate.HasValue?_Coupon.StartDate.Value : DateTime.MinValue; //END DATE EndDate.SelectedDate = _Coupon.EndDate.HasValue ? _Coupon.EndDate.Value : DateTime.MinValue; //MAX USES if (_Coupon.MaxUsesPerCustomer > 0) { MaximumUsesPerCustomer.Text = string.Format("{0:F0}", _Coupon.MaxUsesPerCustomer); } if (_Coupon.MaxUses > 0) { MaximumUses.Text = string.Format("{0:F0}", _Coupon.MaxUses); } //COMBINE RULE AllowCombine.Checked = _Coupon.AllowCombine; //PRODUCT RULE ProductRule.SelectedIndex = _Coupon.ProductRuleId; BindProducts(); //SHIP METHOD RULE ShipMethodRule.SelectedIndex = _Coupon.ProductRuleId; BindShipMethods(); //GROUP RESTRICTION UseGroupRestriction.SelectedIndex = (_Coupon.Groups.Count > 0) ? 1 : 0; BindGroups(); // SHOW SAVE CONFIRMATION NOTIFICATION IF NEEDED if (Request.UrlReferrer != null && Request.UrlReferrer.AbsolutePath.ToLowerInvariant().EndsWith("addcoupon.aspx")) { SavedMessage.Visible = true; SavedMessage.Text = string.Format(SavedMessage.Text, LocaleHelper.LocalNow); } } }
private void ProcessRules(BreadCrumbItem breadCrumbItem) { int id; if (breadCrumbItem.Url == "#") { return; } switch (breadCrumbItem.Url.ToLowerInvariant()) { case "~/admin/orders/shipments/editshipment.aspx": id = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]); breadCrumbItem.Url += "?OrderShipmentId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, id); break; case "~/admin/products/editproduct.aspx": case "~/admin/products/variants/variants.aspx": case "~/admin/products/variants/options.aspx": case "~/admin/products/digitalgoods/digitalgoods.aspx": case "~/admin/products/kits/editkit.aspx": case "~/admin/products/assets/images.aspx": case "~/admin/products/editproducttemplate.aspx": case "~/admin/products/specials/default.aspx": int categoryId = AbleCommerce.Code.PageHelper.GetCategoryId(); id = AbleCommerce.Code.PageHelper.GetProductId(); Product product = ProductDataSource.Load(id); if (categoryId > 0) { breadCrumbItem.Url += "?CategoryId=" + categoryId + "&ProductId=" + id; } else { breadCrumbItem.Url += "?ProductId=" + id; } breadCrumbItem.Title = string.Format(breadCrumbItem.Title, product.Name); break; case "~/admin/orders/vieworder.aspx": case "~/admin/orders/edit/editorderitems.aspx": case "~/admin/orders/viewdigitalgoods.aspx": case "~/admin/orders/payments/default.aspx": case "~/admin/orders/shipments/default.aspx": id = AbleCommerce.Code.PageHelper.GetOrderId(); Order order = OrderDataSource.Load(id); breadCrumbItem.Url += "?OrderNumber=" + order.OrderNumber; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, order.OrderNumber); break; case "~/admin/marketing/coupons/editcoupon.aspx": id = AlwaysConvert.ToInt(Request.QueryString["CouponId"]); Coupon coupon = CouponDataSource.Load(id); breadCrumbItem.Url += "?CouponId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, coupon.Name); break; case "~/admin/products/variants/editoption.aspx": case "~/admin/products/variants/editchoices.aspx": id = AlwaysConvert.ToInt(Request.QueryString["OptionId"]); Option option = OptionDataSource.Load(id); breadCrumbItem.Url += "?OptionId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, option.Name); break; case "~/admin/products/giftwrap/editwrapgroup.aspx": id = AlwaysConvert.ToInt(Request.QueryString["WrapGroupId"]); WrapGroup wrapGroup = WrapGroupDataSource.Load(id); breadCrumbItem.Url += "?WrapGroupId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, wrapGroup.Name); break; case "~/admin/marketing/email/managelist.aspx": id = AlwaysConvert.ToInt(Request.QueryString["EmailListId"]); EmailList emailList = EmailListDataSource.Load(id); if (emailList != null) { breadCrumbItem.Url += "?EmailListId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, emailList.Name); } break; case "~/admin/marketing/discounts/editdiscount.aspx": id = AlwaysConvert.ToInt(Request.QueryString["VolumeDiscountId"]); VolumeDiscount discount = VolumeDiscountDataSource.Load(id); breadCrumbItem.Url += "?VolumeDiscountId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, discount.Name); break; case "~/admin/catalog/editwebpage.aspx": id = AbleCommerce.Code.PageHelper.GetWebpageId(); Webpage webpage = WebpageDataSource.Load(id); breadCrumbItem.Url += "?WebpageId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, webpage.Name); break; case "~/admin/catalog/editLink.aspx": id = AbleCommerce.Code.PageHelper.GetLinkId(); Link link = LinkDataSource.Load(id); breadCrumbItem.Url += "?LinkId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, link.Name); break; case "~/admin/people/users/edituser.aspx": id = AlwaysConvert.ToInt(Request.QueryString["UserId"]); User user = UserDataSource.Load(id); breadCrumbItem.Url += "?UserId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, user.UserName); break; case "~/admin/digitalgoods/editdigitalgood.aspx": case "~/admin/digitalgoods/serialkeyproviders/defaultprovider/configure.aspx": id = AlwaysConvert.ToInt(Request.QueryString["DigitalGoodId"]); DigitalGood dg = DigitalGoodDataSource.Load(id); if (dg != null) { breadCrumbItem.Url += "?DigitalGoodId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, dg.Name); } break; case "~/admin/products/producttemplates/editproducttemplate.aspx": id = AlwaysConvert.ToInt(Request.QueryString["ProductTemplateId"]); ProductTemplate template = ProductTemplateDataSource.Load(id); if (template == null) { InputField field = InputFieldDataSource.Load(AlwaysConvert.ToInt(Request.QueryString["InputFieldId"])); if (field != null) { template = field.ProductTemplate; id = template.Id; } } if (template != null) { breadCrumbItem.Url += "?ProductTemplateId=" + id; breadCrumbItem.Title = string.Format(breadCrumbItem.Title, template.Name); } else { } break; case "~/admin/reports/dailyabandonedbaskets.aspx": id = AlwaysConvert.ToInt(Request.QueryString["BasketId"]); Basket basket = BasketDataSource.Load(id); if (basket != null) { breadCrumbItem.Url += "?ReportDate=" + basket.User.LastActivityDate.Value.ToShortDateString(); } break; } // resolve relative urls if (breadCrumbItem.Url.StartsWith("~/")) { breadCrumbItem.Url = Page.ResolveUrl(breadCrumbItem.Url); } }