コード例 #1
0
        protected void CancelHapOrder_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            if (!string.IsNullOrEmpty(HAPOrderID))
            {
                var oHAPOrders    = (this.Page as ProductsBase).ActiveHAPOrders;
                var orderToCancel = oHAPOrders != null?oHAPOrders.Find(oi => oi.OrderID == HAPOrderID) : null;

                if (orderToCancel != null)
                {
                    var error = OrderProvider.SubmitHAPOrder(orderToCancel, (this.Page as ProductsBase).Locale, (this.Page as ProductsBase).DistributorID);
                    if (string.IsNullOrEmpty(error))
                    {
                        var orders = OrderProvider.GetHapOrders((this.Page as ProductsBase).DistributorID, (this.Page as ProductsBase).CountryCode);
                        orders.RemoveAll(r => r.OrderID == orderToCancel.OrderID);
                    }
                    Response.Redirect("~/Ordering/HAPOrders.aspx");
                }
            }
        }