Beispiel #1
0
 // збереження нової групи
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     if (AddGroupTextBox.Text != "")
     {
         string answer = client.AddGroup(AddGroupTextBox.Text);
         if (answer == "successfully")
         {
             AddItemsToComboBox();
             AddGroupLabel.Visibility   = Visibility.Hidden;
             AddGroupTextBox.Visibility = Visibility.Hidden;
             SaveButton.Visibility      = Visibility.Hidden;
             AddButton.IsEnabled        = true;
         }
         else if (answer == "ExistName")
         {
             AddGroupTextBox.Foreground = Brushes.Red;
             MessageBox.Show("A group with this name already exists, please enter another name!");
         }
         else
         {
             MessageBox.Show("Something wrong!");
         }
     }
     else
     {
         MessageBox.Show("Please, enter group name!");
     }
 }
 private void CreateGroupButton_Click(object sender, RoutedEventArgs e)
 {
     if (GroupName.Text != "")
     {
         bool isCorrect = true;
         foreach (var n in groups)
         {
             if (GroupName.Text == n.GroupName)
             {
                 isCorrect = false;
             }
         }
         if (isCorrect)
         {
             string groupName = GroupName.Text;
             string answer    = client.AddGroup(groupName);
             if (answer == "successfull")
             {
                 main.Content = new AdminStudentGroups(client, mw, main);
             }
         }
         else
         {
             MessageBox.Show("This item already exists!");
         }
     }
     else
     {
         MessageBox.Show("Please enter group name!");
     }
 }