Example #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                double price = ((SubscriptionListItem)subscriptionList.SelectedItem).Price;

                if (CurrentUser.CanBuy(price))
                {
                    if (subscriptionList.SelectedIndex == 0)
                    {
                        videoStore.ResetSubscription(CurrentUser.UserID);
                    }
                    else
                    {
                        videoStore.UpdateSubscription(((SubscriptionListItem)subscriptionList.SelectedItem).ID, CurrentUser.UserID);
                    }

                    AppUpdate.ToBuyMovie(price);
                    AppUpdate.UpdateServices();
                    AppUpdate.ChangeButton();

                    ForcedUpdateSubscripion(((SubscriptionListItem)subscriptionList.SelectedItem).ID);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                DialogWindowBuySubscription.IsOpen = false;
            }
        }
 private void Button_Click_2(object sender, RoutedEventArgs e)
 {
     try
     {
         AppUpdate.ToBuyMovie(Convert.ToDouble(watchPriceValue.Text));
         _videoStore.LessMoney(CurrentUser.UserID, Convert.ToDouble(watchPriceValue.Text));
         DialogWindowWatchMovie.IsOpen = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (CurrentUser.CanBuy(movieModel.Price))
         {
             _videoStore.ToBuyMovie(movieModel.MovieID, CurrentUser.UserID, movieModel.Price);
             AppUpdate.ToBuyMovie(movieModel.Price);
             AppUpdate.ChangeButton();
             ResetButtons(true);
             DialogWindowBuy.IsOpen = false;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }