Exemplo n.º 1
0
        private async void CreateButton_Click(object sender, RoutedEventArgs e)
        {
            using (var client = new MyCouchClient("http://*****:*****@localhost:5984", "tv-series"))
            {
                //POST (create) with server generated id & Rev
                await client.Documents.PostAsync("{\"title\": \"" + TitleText.Text + "\", \"creator\":\"" + CreatorTxt.Text + "\",\"stars\":\"" + StarsTxt.Text +
                                                 "\",\"seasons\":\"" + SeasonsTxt.Text + "\",\"mpa_rating\":\"" + MPARatingTxt.Text + "\",\"imbd_rating\":\"" + IMBDRatingTxt.Text + "/10\"}");

                MessageBox.Show("Document Successfully Created", "TV-Series", MessageBoxButton.OK, MessageBoxImage.Information);

                // Clears all text boxes when a document is created.
                TitleText.Clear();
                CreatorTxt.Clear();
                StarsTxt.Clear();
                SeasonsTxt.Clear();
                MPARatingTxt.Clear();
                IMBDRatingTxt.Clear();

                // Refreshes the number of tv-serie documents when one is created.
                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 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);
        }