add msgbox to actions

This commit is contained in:
Strati 2018-08-12 20:33:28 +02:00
parent 21256ee411
commit 1ee524b71f
5 changed files with 52 additions and 35 deletions

View File

@ -65,6 +65,9 @@ namespace WpfWebClient
client.WriteExam(exam);
// Show success msgbox
System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
client.Close();
}
}

View File

@ -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();
}

View File

@ -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<string> generatedStrains = new List<string>();
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<string> generatedStrains = new List<string>();
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();
}
}

View File

@ -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();
}

View File

@ -32,6 +32,7 @@ namespace WpfWebClient
List<WpfWebClient.ServiceReferenceEHEC.Strain> strainlist = new List<ServiceReferenceEHEC.Strain>(client.GetStrains());
DataGridViewStrains.ItemsSource = strainlist;
client.Close();
}