Exemplo n.º 1
0
        private async void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            using (var store = new MyCouchStore("http://*****:*****@localhost:5984", "tv-series"))
            {
                //Delete a document using user given ID

                await store.DeleteAsync(SearchIDTxt.Text);

                SearchIDTxt.Clear();
                ReadTxt.Clear();
                SearchIDTxt.IsEnabled = true;

                MessageBox.Show("Document Successfully Deleted", "TV-Series", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }

            // Refreshes the number of tv-serie documents when one is removed.
            using (var client = new MyCouchClient("http://*****:*****@localhost:5984", "tv-series"))
            {
                var personQuery = new QueryViewRequest("series", "CountNoTvSeries").Configure(query2 => query2
                                                                                              .Reduce(false));
                ViewQueryResponse result2 = await client.Views.QueryAsync(personQuery);

                NoTvSeriesTxt.Text = result2.RowCount.ToString();
            }
        }
Exemplo n.º 2
0
        private async void UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            using (var client = new MyCouchClient("http://*****:*****@localhost:5984", "tv-series"))
            {
                //PUT for updates with MyCouch

                await client.Documents.PutAsync(SearchIDTxt.Text, ReadTxt.Text);

                ReadTxt.Clear();

                SearchIDTxt.IsEnabled = true;
                ReadButton.IsEnabled  = true;

                MessageBox.Show("Document Successfully Updated", "TV-Series", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
Exemplo n.º 3
0
        private void ClearButton_Click(object sender, RoutedEventArgs e)
        {
            // Clears all boxes in case of mistake etc..

            SearchIDTxt.Clear();
            SearchIDTxt.IsEnabled = true;
            ReadTxt.Clear();
            TitleText.Clear();
            CreatorTxt.Clear();
            StarsTxt.Clear();
            SeasonsTxt.Clear();
            MPARatingTxt.Clear();
            IMBDRatingTxt.Clear();

            MessageBox.Show("All Fields Have Been Reset", "TV-Series", MessageBoxButton.OK, MessageBoxImage.Exclamation);
        }