public static SpieltagInfo GetSpieltagInfo(WMTippApp.SvcFussballDB.SportsdataSoapClient client)
        {
            var spieltagInfo = new SpieltagInfo();

            spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = 1;

            var dataNext = client.GetNextMatch(SportsdataConfigInfo.Current.LeagueShortcut);
            var dataLast = client.GetLastMatch(SportsdataConfigInfo.Current.LeagueShortcut);

            if (dataNext == null && dataLast == null)
            {
                return(spieltagInfo);
            }
            else if (dataLast == null)
            {
                spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = dataNext.groupOrderID;

                return(spieltagInfo);
            }
            else if (dataNext == null)
            {
                spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = dataLast.groupOrderID;

                return(spieltagInfo);
            }
            else
            {
                if (dataNext.groupOrderID > dataLast.groupOrderID)
                {
                    spieltagInfo.CurrentSpieltag = dataLast.groupOrderID;
                    spieltagInfo.TippSpieltag    = dataNext.groupOrderID;
                }
                else
                {
                    spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = dataLast.groupOrderID;
                }

                return(spieltagInfo);
            }
        }
        public static SpieltagInfo GetSpieltagInfo(IFussballDataRepository repository)
        {
            var spieltagInfo = new SpieltagInfo();

            spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = 1;

            var dataNext = repository.GetNextMatch();
            var dataLast = repository.GetLastMatch();

            if (dataNext == null && dataLast == null)
            {
                return(spieltagInfo);
            }
            if (dataNext == null || (dataNext.MatchId == -1)) //e.g. last season
            {
                spieltagInfo.CurrentSpieltag = dataLast.GroupId;

                return(spieltagInfo);
            }
            if (dataLast == null || (dataLast.GroupId > dataNext.GroupId)) //e.g. last season
            {
                spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = dataNext.GroupId;

                return(spieltagInfo);
            }
            if (dataNext.GroupId > dataLast.GroupId)
            {
                spieltagInfo.CurrentSpieltag = dataLast.GroupId;
                spieltagInfo.TippSpieltag    = dataNext.GroupId;
            }
            else
            {
                spieltagInfo.CurrentSpieltag = spieltagInfo.TippSpieltag = dataLast.GroupId;
                spieltagInfo.IsCompleted     = true;
            }

            return(spieltagInfo);
        }