protected void gvOrderProducts_RowDeleting(object sender, GridViewDeleteEventArgs e) { Promotion p = GetCurrentPromotion(); OrderHasProducts q = (OrderHasProducts)GetCurrentQualification(p); if (q == null) { return; } string bvin = (string)e.Keys[0]; q.RemoveProductBvin(bvin); MyPage.MTApp.MarketingServices.Promotions.Update(p); LoadOrderProductEditor(q); }
protected void btnAddOrderProduct_Click(object sender, ImageClickEventArgs e) { Promotion p = GetCurrentPromotion(); OrderHasProducts q = (OrderHasProducts)GetCurrentQualification(p); if (q == null) { return; } foreach (string bvin in this.ProductPickerOrderProducts.SelectedProducts) { q.AddProductBvin(bvin); } MyPage.MTApp.MarketingServices.Promotions.Update(p); LoadOrderProductEditor(q); }
// Order has Products Editor private void LoadOrderProductEditor(OrderHasProducts q) { this.ProductPickerOrderProducts.LoadSearch(); List <FriendlyBvinDisplay> displayData = new List <FriendlyBvinDisplay>(); foreach (string bvin in q.CurrentProductIds()) { FriendlyBvinDisplay item = new FriendlyBvinDisplay(); item.bvin = bvin; item.DisplayName = bvin; MerchantTribe.Commerce.Catalog.Product p = MyPage.MTApp.CatalogServices.Products.Find(item.bvin); if (p != null) { item.DisplayName = "[" + p.Sku + "] " + p.ProductName; } displayData.Add(item); } this.gvOrderProducts.DataSource = displayData; this.gvOrderProducts.DataBind(); }