diff --git a/WebClient/WpfWebClient/ExamForm.xaml.cs b/WebClient/WpfWebClient/ExamForm.xaml.cs index dbb300d..ac470e6 100644 --- a/WebClient/WpfWebClient/ExamForm.xaml.cs +++ b/WebClient/WpfWebClient/ExamForm.xaml.cs @@ -65,6 +65,9 @@ namespace WpfWebClient client.WriteExam(exam); + // Show success msgbox + System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information); + client.Close(); } } diff --git a/WebClient/WpfWebClient/FoodplaceForm.xaml.cs b/WebClient/WpfWebClient/FoodplaceForm.xaml.cs index 623b4c1..ccc32ce 100644 --- a/WebClient/WpfWebClient/FoodplaceForm.xaml.cs +++ b/WebClient/WpfWebClient/FoodplaceForm.xaml.cs @@ -39,17 +39,20 @@ namespace WpfWebClient { WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient(); - // create new foodplace from user input + // create new foodplace from user input - FoodPlace fp = new FoodPlace(); + FoodPlace fp = new FoodPlace(); - fp.Name = txtFoodPlaceName.Text; - fp.Streetname = txtFoodPlaceStreetName.Text; - fp.Streetnumber = txtFoodPlaceHouseNumber.Text; - fp.Description = txtFoodPlaceDescription.Text; - fp.City = (City)ComboBoxFPCities.SelectedValue; + fp.Name = txtFoodPlaceName.Text; + fp.Streetname = txtFoodPlaceStreetName.Text; + fp.Streetnumber = txtFoodPlaceHouseNumber.Text; + fp.Description = txtFoodPlaceDescription.Text; + fp.City = (City)ComboBoxFPCities.SelectedValue; - client.WriteFoodPlace(fp); + client.WriteFoodPlace(fp); + + // Show success msgbox + System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information); client.Close(); } diff --git a/WebClient/WpfWebClient/Home.xaml.cs b/WebClient/WpfWebClient/Home.xaml.cs index b144c92..ee3ded3 100644 --- a/WebClient/WpfWebClient/Home.xaml.cs +++ b/WebClient/WpfWebClient/Home.xaml.cs @@ -32,9 +32,13 @@ namespace WpfWebClient // create new client connection WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient(); + // msgbox to confirm action + if (MessageBox.Show("This could take a while, are you sure?", "More strains?", + MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes) + { - // Get the number of words and letters per word. - int num_letters = int.Parse(txtNumLetters.Text); + // Get the number of words and letters per word. + int num_letters = int.Parse(txtNumLetters.Text); int num_words = int.Parse(txtNumStrains.Text); // Make an array of the letters we will use. @@ -43,35 +47,38 @@ namespace WpfWebClient // Make a random number generator. Random rand = new Random(); - // Make the words. - for (int i = 1; i <= num_words; i++) - { - // Make a word. - string word = ""; - for (int j = 1; j <= num_letters; j++) + // Make the words. + for (int i = 1; i <= num_words; i++) { - // Pick a random number between 0 and 25 - // to select a letter from the letters array. - int letter_num = rand.Next(2, letters.Length - 1); + // Make a word. + string word = ""; + for (int j = 1; j <= num_letters; j++) + { + // Pick a random number between 0 and 25 + // to select a letter from the letters array. + int letter_num = rand.Next(2, letters.Length - 1); - // Append the letter. - word += letters[letter_num]; + // Append the letter. + word += letters[letter_num]; + } + + // Write the strains into a list + List generatedStrains = new List(); + + generatedStrains.Add(word); + + foreach (var item in generatedStrains) + { + Strain s = new Strain(); + s.Name = item; + client.WriteStrain(s); + } } - - // Write the strains into a list - List generatedStrains = new List(); - - generatedStrains.Add(word); - - foreach (var item in generatedStrains) - { - Strain s = new Strain(); - s.Name = item; - client.WriteStrain(s); - } - } + // Show success msgbox + System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information); + client.Close(); } } diff --git a/WebClient/WpfWebClient/PatientForm.xaml.cs b/WebClient/WpfWebClient/PatientForm.xaml.cs index 8b40dec..f34819f 100644 --- a/WebClient/WpfWebClient/PatientForm.xaml.cs +++ b/WebClient/WpfWebClient/PatientForm.xaml.cs @@ -82,7 +82,10 @@ namespace WpfWebClient p.City = (City)ComboBoxCities.SelectedValue; client.WritePatient(p); - + + // Show success msgbox + System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information); + client.Close(); } diff --git a/WebClient/WpfWebClient/ViewStrains.xaml.cs b/WebClient/WpfWebClient/ViewStrains.xaml.cs index 2222058..b35aadc 100644 --- a/WebClient/WpfWebClient/ViewStrains.xaml.cs +++ b/WebClient/WpfWebClient/ViewStrains.xaml.cs @@ -32,6 +32,7 @@ namespace WpfWebClient List strainlist = new List(client.GetStrains()); DataGridViewStrains.ItemsSource = strainlist; + client.Close(); }