Beispiel #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (validate())
            {

                    League newLeague = new League();
                    newLeague.Description = descriptionInput.Text;
                    newLeague.Name = nameInput.Text;
                    newLeague.Discipline = discipline;
                    newLeague.Matches = new List<Match>();
                    var repo = new LeagueRepository();
                    repo.SaveOrUpdate(newLeague);
                    DialogResult result = MetroMessageBox.Show(this, "League created!", "Success!", MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                    if (result == DialogResult.OK)
                    {

                    }

            }
            else
            {
                MetroMessageBox.Show(this, "Sorry, data is not valid.", "Validation error", MessageBoxButtons.OK,
                    MessageBoxIcon.Error);
                System.Console.Write(discipline.Name);
            }
        }
Beispiel #2
0
 public APILeague(League league)
 {
     this.Name = league.Name;
     this.Description = league.Description;
     this.Id = league.Id;
     this.Matches = league.Matches;
     this.Discipline = league.Discipline != null && league.Discipline.Id>0?league.Discipline.Id:7;
 }
Beispiel #3
0
 public LeagueUpdate(League _league)
 {
     league = _league;
     InitializeComponent();
     MediaTypeNames.Text = "Update league: "+league.Name;
     nameInput.Text = league.Name;
     descriptionInput.Text = league.Description;
 }
Beispiel #4
0
 public LeagueShow(League _handler)
 {
     handler = _handler;
     InitializeComponent();
     MediaTypeNames.Text = handler.Name;
     descriptionText.Text = handler.Description;
     disciplineLabel.Text = handler.Discipline.Name;
     bindingSourceMathces.DataSource = handler.Matches;
     matchesGrid.DataSource = bindingSourceMathces;
 }
Beispiel #5
0
 internal League FromLeague(LeagueResponse result)
 {
     var x = new League();
     var temp = result.Links.Self.Href.Split('/');
     x.ApiId = Int32.Parse(temp[temp.Length - 1]);
     x.Description = result.League + result.Year;
     x.Name = result.Caption;
     x.UpdatedAt = DateTime.Parse(result.LastUpdated, null, System.Globalization.DateTimeStyles.RoundtripKind);
     return x;
 }
Beispiel #6
0
 internal IList<League> FromAllLeaguesToLeagues(IList<AllLeaguesResponse> apiData)
 {
     List<League> ret = new List<League>();
     foreach(var apiLeague in apiData)
     {
         var x = new League();
         var temp = apiLeague.Links.Self.Href.Split('/');
         x.ApiId = Int32.Parse(temp[temp.Length - 1]);
         x.Description = apiLeague.League + apiLeague.Year;
         x.Name = apiLeague.Caption;
         x.UpdatedAt = new DateTime(2010,1,1);
         ret.Add(x);
     }
     return ret;
 }