private void AddButton(object sender, RoutedEventArgs e) { if (StackAdd.Children.OfType <TextBox>().Any(x => x.Text == "") || StackAdd.Children.OfType <ComboBox>().Any(x => x.SelectedIndex < 0)) { MessageBox.Show("Заполните все поля"); return; } try { Player.StatisticPlayerT = new StatisticPlayerT(); Player.Photo = BArray; Connection.NewInstance().PlayerT.Add(Player); Connection.NewInstance().SaveChanges(); } catch (Exception ex) { Connection.NewInstance().PlayerT.Remove(Player); MessageBox.Show(ex.Message); } finally { DataContext = null; PhotoImage.Source = null; BArray = null; Countries = Connection.NewInstance().CountryT.ToList(); Roles = Connection.NewInstance().RoleT.ToList(); Teams = Connection.NewInstance().TeamT.ToList(); Player = new PlayerT(); StackAdd.Children.OfType <TextBox>().ToList().ForEach(tb => tb.Text = String.Empty); StackAdd.Children.OfType <ComboBox>().ToList().ForEach(cb => cb.SelectedIndex = -1); DataContext = this; } }
public CreatePlayerPage() { InitializeComponent(); Player = new PlayerT(); Countries = Connection.NewInstance().CountryT.OrderBy(x => x.Country).ToList(); Roles = Connection.NewInstance().RoleT.ToList(); Teams = Connection.NewInstance().TeamT.ToList(); DataContext = this; }
public void ADD__PLAYER(string str) { //RestClient restClient = new RestClient("http://24.61.47.62:1337"); RestClient restClient = new RestClient("http://*****:*****@bob.com"; PlayerForSQL.SignupDate = DT.ToString(); var request = new RestRequest(postit, Method.POST); request.AddJsonBody(PlayerForSQL); IRestResponse Ires = restClient.Execute(request); if (Ires.StatusCode == System.Net.HttpStatusCode.OK) { //now the new max is TRIPid .. I should make a slef update function in MNGR Console.WriteLine("bob sent"); } }
private void Button_Click(object sender, RoutedEventArgs e) { if ((Player = PlayerComboBox.SelectedItem as PlayerT) != null) { switch ((sender as Button).Name) { case "AddMiss": MissTB.Text = (++Player.StatisticPlayerT.Missed).ToString(); Player.TeamT.StatisticTeamT.Missed++; break; case "RemoveMiss": MissTB.Text = (--Player.StatisticPlayerT.Missed).ToString(); Player.TeamT.StatisticTeamT.Missed--; break; case "AddGoal": ScoredTB.Text = (++Player.StatisticPlayerT.Scored).ToString(); Player.TeamT.StatisticTeamT.Scored++; break; case "RemoveGoal": ScoredTB.Text = (--Player.StatisticPlayerT.Scored).ToString(); Player.TeamT.StatisticTeamT.Scored--; break; case "AddRedCard": RedCardTB.Text = (++Player.StatisticPlayerT.RedCards).ToString(); Player.TeamT.StatisticTeamT.RedCards++; break; case "RemoveRedCard": RedCardTB.Text = (--Player.StatisticPlayerT.RedCards).ToString(); Player.TeamT.StatisticTeamT.RedCards--; break; case "AddYellowCard": YellowCardTB.Text = (++Player.StatisticPlayerT.YellowCards).ToString(); Player.TeamT.StatisticTeamT.YellowCards++; break; case "RemoveYellowCard": YellowCardTB.Text = (--Player.StatisticPlayerT.YellowCards).ToString(); Player.TeamT.StatisticTeamT.YellowCards--; break; case "AddSubstitution": SubstitutionTB.Text = (++Player.StatisticPlayerT.Substitution).ToString(); Player.TeamT.StatisticTeamT.Substitution++; break; case "RemoveSubstitution": SubstitutionTB.Text = (--Player.StatisticPlayerT.Substitution).ToString(); Player.TeamT.StatisticTeamT.Substitution--; break; case "AddSave": SaveTB.Text = (++Player.StatisticPlayerT.SaveGoal).ToString(); Player.TeamT.StatisticTeamT.SaveGoal++; break; case "RemoveSave": SaveTB.Text = (--Player.StatisticPlayerT.SaveGoal).ToString(); Player.TeamT.StatisticTeamT.SaveGoal--; break; } } }
private void PlayerComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { Player = PlayerComboBox?.SelectedItem as PlayerT; }
private void ComboBoxClub_SelectionChanged(object sender, SelectionChangedEventArgs e) { Player = ComboBoxPlayer.SelectedItem as PlayerT; }
public InfoWindow(PlayerT player) { InitializeComponent(); Player = player; DataContext = this; }