Example #1
0
        protected void SubscriptionGrid_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int          subscriptionId = AlwaysConvert.ToInt(e.CommandArgument);
            Subscription subscription   = SubscriptionDataSource.Load(subscriptionId);

            switch (e.CommandName)
            {
            case "Activate":
                subscription.Activate();
                SubscriptionGrid.DataBind();
                break;

            case "Deactivate":
                subscription.Deactivate();
                SubscriptionGrid.DataBind();
                break;

            case "CancelSubscription":
                subscription.Delete();
                SubscriptionGrid.DataBind();
                break;
            }

            BindSubscriptions();
        }
Example #2
0
        private void BindSubscriptions()
        {
            IList <Subscription> subscriptions = new List <Subscription>();

            if (_Order.IsSubscriptionGenerated)
            {
                IList <SubscriptionOrder> subOrders = SubscriptionOrderDataSource.LoadForOrder(_Order.Id);
                foreach (SubscriptionOrder subOrder in subOrders)
                {
                    if (subOrder.Subscription != null)
                    {
                        subscriptions.Add(subOrder.Subscription);
                    }
                }

                SubscriptionGrid.DataSource = subscriptions;
                SubscriptionGrid.DataBind();
            }
            else
            {
                subscriptions = SubscriptionDataSource.LoadForOrder(_Order.Id);
                SubscriptionGrid.DataSource = subscriptions;
                SubscriptionGrid.DataBind();
            }
        }
        protected void CancelButton_Click(object sender, EventArgs e)
        {
            List <DataKey> selectedItems = GetSelectedItems();

            foreach (DataKey item in selectedItems)
            {
                int          subscriptionId = AlwaysConvert.ToInt(item.Value);
                Subscription subscription   = SubscriptionDataSource.Load(subscriptionId);
                if (subscription != null)
                {
                    subscription.Delete();
                }
            }
            SubscriptionGrid.DataBind();
        }
 protected void SubscriptionGrid_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
 {
     SubscriptionGrid.EditIndex = -1;
     SubscriptionGrid.DataBind();
 }
 protected void SubscriptionGrid_RowEditing(object sender, GridViewEditEventArgs e)
 {
     SubscriptionGrid.EditIndex = e.NewEditIndex;
     SubscriptionGrid.DataBind();
 }