Пример #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (validate())
            {
                if (handle != null)
                {
                    handle.Name = nameInput.Text;
                    var repo = new TeamRepository();
                    repo.SaveOrUpdate(handle);
                    DialogResult result = MetroMessageBox.Show(this, "Team updated!", "Success!", MessageBoxButtons.OK,
                       MessageBoxIcon.Information);
                    if (result == DialogResult.OK)
                    {

                    }
                }
                else
                {
                    Team newTeam = new Team();
                    newTeam.Players = new List<Player>();
                    newTeam.Name = nameInput.Text;
                    newTeam.Discipline = discipline;
                    var repo = new TeamRepository();
                    repo.SaveOrUpdate(newTeam);
                    DialogResult result = MetroMessageBox.Show(this, "Team created!", "Success!", MessageBoxButtons.OK,
                       MessageBoxIcon.Information);
                    if (result == DialogResult.OK)
                    {

                    }
                }
            }
        }
Пример #2
0
 public APITeam(Team team)
 {
     this.Id = team.Id;
     this.Name = team.Name;
     this.Discipline = team.Discipline.Id;
     this.LogoURI = team.LogoURI;
 }
Пример #3
0
 public TeamCreate(Discipline _discipline,Team _handle)
 {
     discipline = _discipline;
     handle = _handle;
     InitializeComponent();
     nameInput.Text = handle.Name;
     MediaTypeNames.Text = "Update Team " + handle.Name;
 }
Пример #4
0
 internal Team FromTeam(TeamResponse result)
 {
     var x = new Team();
     var temp = result.Links.Self.Href.Split('/');
     x.ApiId = Int32.Parse(temp[temp.Length - 1]);
     x.Name = result.Name;
     x.LogoURI = result.CrestUrl;
     return x;
 }
Пример #5
0
 internal List<Team> FromLeaguesTeams(LeaguesTeamsResponse apiData)
 {
     List<Team> ret = new List<Team>();
     foreach(var apiTeam in apiData.Teams)
     {
         var x = new Team();
         var temp = apiTeam.Links.Self.Href.Split('/');
         x.ApiId = Int32.Parse(temp[temp.Length - 1]);
         x.LogoURI = apiTeam.CrestUrl;
         x.Name = apiTeam.Name;
         x.UpdatedAt = new DateTime(2010,1,1);
         ret.Add(x);
     }
     return ret;
 }
Пример #6
0
        public TeamShow(Team _handler)
        {
            handler = _handler;
            InitializeComponent();
            MediaTypeNames.Text = handler.Name;
            Name = handler.Name;
            nameLabel.Text = handler.Name;

            homeMatchesGrid.DataSource = null;
            bindingSourceHome = new BindingSource();
            bindingSourceHome.DataSource = handler.HomeMatches;
            homeMatchesGrid.DataSource = bindingSourceHome;

            awayMatchesGrid.DataSource = null;
            bindingSourceAway = new BindingSource();
            bindingSourceAway.DataSource = handler.AwayMatches;
            awayMatchesGrid.DataSource = bindingSourceAway;

            playersGrid.DataSource = null;
            bindingSourcePlayers = new BindingSource();
            bindingSourcePlayers.DataSource = handler.Players;
            playersGrid.DataSource = bindingSourcePlayers;
        }