Beispiel #1
0
 public Fixture(IClub team, IClub opposition, Venue v, DateTime ko)
 {
     m_team       = team;
     m_venue      = v;
     m_opposition = opposition;
     m_kickOff    = ko;
 }
 public Fixture(IClub team, IClub opposition, Venue v, DateTime ko)
 {
     m_team = team;
     m_venue = v;
     m_opposition = opposition;
     m_kickOff = ko;
 }
        public PlayerGameweek(IClub club, object[] stats)
        {
            var koTime     = (string)stats[0];
            var koDateTime = DateTime.ParseExact(koTime, "dd MMM HH:mm", CultureInfo.InvariantCulture);

            Gameweek = (int)(long)stats[1];
            var resultStr = (string)stats[2];

            Result          = new Result(club, resultStr, koDateTime);
            MinutesPlayed   = (int)(long)stats[3];
            GoalsScored     = (int)(long)stats[4];
            Assists         = (int)(long)stats[5];
            CleanSheets     = (int)(long)stats[6];
            GoalsConceded   = (int)(long)stats[7];
            OwnGoals        = (int)(long)stats[8];
            PenaltiesSaved  = (int)(long)stats[9];
            PenaltiesMissed = (int)(long)stats[10];
            YellowCards     = (int)(long)stats[11];
            RedCards        = (int)(long)stats[12];
            Saves           = (int)(long)stats[13];
            Bonus           = (int)(long)stats[14];
            EASportsPPI     = (int)(long)stats[15];
            NetTransers     = (int)(long)stats[16];
            Value           = (int)(long)stats[17];
            Points          = (int)(long)stats[19];
        }
		protected override IList<ICrew> InternalCreate ()
		{
			IList<ICrew> crews = new List<ICrew> ();
			foreach (var raw in RawUnderlying) 
			{
				if (raw.currentCrewStatus != "Accepted" && raw.currentCrewStatus != "Submitted")
				{
                    Logger.DebugFormat("Crew {0} is {1}", raw.crewId, raw.currentCrewStatus); 
					continue;
				}
                CrewOverride crewOverride = RawOverrides.FirstOrDefault(o => o.CrewId == raw.crewId);

                // if there are several categories for the single event id, pick one with the appropriate CRI range. 
                // todo: deal with the situation where lightweights cannot be in the lowest or highest bands 
                var validcats = _eventCategories.Where(cat => cat.EventId == raw.eventId).ToList();
                if(crewOverride != null && !string.IsNullOrEmpty(crewOverride.EventName))
                {
                    var overridecats = _eventCategories.Where(cat => cat.Name == crewOverride.EventName).ToList();
                    if (overridecats.Count == 1)
                        validcats = overridecats;
                    else
                    {
                        // if the event name has been overridden, we need to map across to the agg Master 
                        var aggMasters = overridecats.Where(cat => cat.AggregationMaster != null).Select(cat => cat.AggregationMaster).ToList();
                        if (aggMasters.Count > 0)
                            validcats = new List<EventCategory> { aggMasters[0] };
                    }
                }

                // HACK: euch. The PRI Name hack to ensure that crews that should be novice but aren't, but then end in an aggregated category ... 
                EventCategory eventCategory = 
                    validcats.Count > 1 
                        ? validcats.FirstOrDefault(vc => vc.CriInRange(crewOverride != null && crewOverride.PRI > 0 ? crewOverride.PRI : raw.rowingPointsCri)) // todo - sculling vs rowing 
                        : validcats[0];

				int startPosition = -1;
				try
				{
					startPosition = _startPositions == null ? -1 : _startPositions.First(sp => sp.CrewId == raw.crewId).StartNumber;
				}
				catch (Exception)
				{
					Logger.ErrorFormat("A problem with the start position for crewid: {0}", raw.crewId);
					throw;
				}
				IClub boatingLocation = _clubs.FirstOrDefault (cl => !string.IsNullOrEmpty(raw.boatingPermissionClubIndexCode) && cl.Index == raw.boatingPermissionClubIndexCode);
				if (boatingLocation == null)
					Logger.WarnFormat ("Cannot identify boating location [crewid: {1}]: {0}", raw.boatingPermissionClubIndexCode, raw.crewId);
				var athletes = _athletes.Where (a => a.CrewId == raw.crewId).ToList();
				var componentClubs = athletes.Select(a => a.Club).Distinct().ToList();
				ICrew crew = new Crew (raw, eventCategory, crewOverride, boatingLocation, startPosition, componentClubs);
				foreach (var athlete in athletes) {
					athlete.SetCrew (crew);
					crew.AddAthlete (athlete);
				}
				crews.Add (crew);
			}
			return crews;
		}
Beispiel #5
0
        public string ToFriendlyString()
        {
            IClub home_team = m_venue == Venue.Home ? m_team : m_opposition;
            IClub away_team = m_venue == Venue.Home ? m_opposition : m_team;


            return(String.Format("{0}: {1} v {2}", m_kickOff.ToString("dd/MM"), home_team.ToString(), away_team.ToString()));
        }
Beispiel #6
0
        public static void Serialize(IClub club)
        {
            var serializer   = new XmlSerializer(typeof(Club));
            var streamWriter = new StreamWriter(EASY_SPORT_CLUB_DB_FILE_NAME);

            serializer.Serialize(streamWriter, club);
            streamWriter.Close();
        }
Beispiel #7
0
        private void GoToClubEventCallBack(IClub arg)
        {
            visibleTopBanner();
            visibleBottomBanner();
            IModuleFactory <IClubModuleViewModel> clubModuleFactory = new ClubModuleFactory();

            MainContent = clubModuleFactory.CreateView(arg);
        }
Beispiel #8
0
 public Fixture(int id, bool completed, IClub homeClub, IClub awayClub, DateTime date, FixtureScore score)
 {
     Id        = id;
     Completed = completed;
     HomeClub  = homeClub;
     AwayClub  = awayClub;
     Date      = date;
     Score     = score;
 }
        /// <summary>
        /// Expects a 3 element array e.g.
        /// 
        /// [
        ///   "13 Apr 15:00",
        ///   "Gameweek 33",
        ///   "Norwich (H)"
        /// ]
        /// 
        /// </summary>
        /// <param name="fixtureInfo"></param>
        public Fixture(IClub team, string[] fixtureInfo)
        {
            m_team = team;

            Match oppositionMatch = Regex.Match(fixtureInfo[2], @"(.+)\((H|A)\)", RegexOptions.Singleline);

            m_opposition = Clubs.GetClubFromName(oppositionMatch.Groups[1].Value.Trim());
            m_venue = ParseVenue(oppositionMatch.Groups[2].Value.Trim());
            m_kickOff = DateTime.ParseExact(fixtureInfo[0], "dd MMM HH:mm", CultureInfo.InvariantCulture);
        }
Beispiel #10
0
        /// <summary>
        /// Expects a 3 element array e.g.
        ///
        /// [
        ///   "13 Apr 15:00",
        ///   "Gameweek 33",
        ///   "Norwich (H)"
        /// ]
        ///
        /// </summary>
        /// <param name="fixtureInfo"></param>
        public Fixture(IClub team, string[] fixtureInfo)
        {
            m_team = team;

            Match oppositionMatch = Regex.Match(fixtureInfo[2], @"(.+)\((H|A)\)", RegexOptions.Singleline);

            m_opposition = Clubs.GetClubFromName(oppositionMatch.Groups[1].Value.Trim());
            m_venue      = ParseVenue(oppositionMatch.Groups[2].Value.Trim());
            m_kickOff    = DateTime.ParseExact(fixtureInfo[0], "dd MMM HH:mm", CultureInfo.InvariantCulture);
        }
Beispiel #11
0
 public bool Equals(IClub other)
 {
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     if (other == null)
     {
         return(false);
     }
     return(this.Index == other.Index);
 }
Beispiel #12
0
 public Crew(RawCrew rawCrew, EventCategory eventCategory, CrewOverride crewOverride, IClub boatingLocation, int startNumber, IEnumerable<IClub> clubs)
 {
     _rawCrew = rawCrew;
     _eventCategory = eventCategory;
     _categories = new Dictionary<ICategory, int>();
     _crewOverride = crewOverride;
     _athletes = new List<IAthlete>();
     _startNumber = startNumber;
     _boatingLocation = boatingLocation;
     if (boatingLocation != null)
         boatingLocation.AddBoatingCrew (this);
     _clubs = clubs.ToList ();
 }
Beispiel #13
0
        public static void PrintClubInfo(this IClub club, List <string> tvs)
        {
            Console.WriteLine($"Name: {club.Name}");
            Console.WriteLine($"Country: {club.Country}");
            foreach (var player in club.Squad.OrderBy(x => x.Key))
            {
                Console.WriteLine($"{player.Key}. {player.Value}");
            }

            foreach (var tv in tvs)
            {
                Console.WriteLine($"TV: {tv}");
            }
        }
Beispiel #14
0
 public Crew(RawCrew rawCrew, EventCategory eventCategory, CrewOverride crewOverride, IClub boatingLocation, int startNumber, IEnumerable <IClub> clubs)
 {
     _rawCrew         = rawCrew;
     _eventCategory   = eventCategory;
     _categories      = new Dictionary <ICategory, int>();
     _crewOverride    = crewOverride;
     _athletes        = new List <IAthlete>();
     _startNumber     = startNumber;
     _boatingLocation = boatingLocation;
     if (boatingLocation != null)
     {
         boatingLocation.AddBoatingCrew(this);
     }
     _clubs = clubs.ToList();
 }
Beispiel #15
0
 public MemberController(
     IMember memberService,
     IClub clubService,
     IIdol idolService,
     IPayment paymentService,
     ApplicationDbContext context,
     UserManager <ApplicationUser> userManager)
 {
     _clubService    = clubService;
     _idolService    = idolService;
     _paymentService = paymentService;
     _context        = context;
     _memberService  = memberService;
     _userManager    = userManager;
 }
Beispiel #16
0
        private IEnumerable<IShotResult> GetShotsForClub(IClub club, int targetDistance)
        {
            var clubShotList = new ShotResultList(10);

            var shotTypes = Enum.GetValues(typeof(ShotType)).Cast<ShotType>();
            foreach (var shotType in shotTypes)
            {
                var windAdjuster = this.windAdjusterFactory.GetWindAdjuster(shotType);

                var stepCount = club.GetStepCountForShotType(shotType);

                for (var i = 0; i < stepCount; i++)
                {
                    var methods = new Func<ShotType, int, int>[] {club.GetDistance, club.GetHalfDistance };

                    for (var index = 0; index < methods.Length; index++)
                    {
                        var method = methods[index];
                        var distance = method(shotType, i);

                        var step = index == 1 ? i + 0.5d : i;
                        if (distance > 0)
                        {
                            var windAdjustedDistance = windAdjuster.GetWindAdjustedDistance(distance);
                            var distanceToTarget = Math.Abs(windAdjustedDistance - targetDistance);
                            var result = new ShotResult()
                            {
                                ClubName = club.Name,
                                Step = step,
                                ShotType = shotType,
                                Distance = distance,
                                WindDistance = windAdjustedDistance,
                                DistanceToTarget = distanceToTarget,
                                IsWithinRange = distanceToTarget <= MaximumDistance
                            };
                            clubShotList.AddCandidateShot(result);
                        }
                    }
                }
            }

            return clubShotList.Shots;
        }
Beispiel #17
0
        public ClubDTO(IClub club)
        {
            if (club.Id < 0)
            {
                throw new ArgumentOutOfRangeException($"{nameof(club.Id)} cannot be less than 0.");
            }
            ValidateInParameters(club.Name, club.RegistrationDate, club.Address.Id, club.Logo, club.HomePage, club.Description);
            AddressDTO address = new AddressDTO(club.Address);

            Id               = club.Id;
            Name             = club.Name;
            RegistrationDate = club.RegistrationDate;
            Logo             = club.Logo;
            HomePage         = club.HomePage;
            Description      = club.Description;
            AddressId        = club.Address.Id;
            Address          = address;
            Active           = true;
            sa_Info          = club.sa_Info;
        }
        /// <param name="team"></param>
        /// <param name="resultString">string in the format "[OPPOSITION 3 letter code]([VENUE]) [FOR]-[AGAINST] " e.g. "SWA(H) 2-0"</param>
        /// <param name="ko"></param>
        public Result(IClub team, string resultString, DateTime ko)
        {
            Match fixture_match = Regex.Match(resultString, @"(.+)\((H|A)\)(.*)", RegexOptions.Singleline);

            Fixture = new Fixture(team, Clubs.GetClubFromShortcode(fixture_match.Groups[1].Value.Trim()), Fixture.ParseVenue(fixture_match.Groups[2].Value.Trim()), ko);

            var scoreString = fixture_match.Groups[3].Value.Trim();

            if (string.IsNullOrEmpty(scoreString)) // the game hasn't been played yet
            {
                GoalsScored   = 0;
                GoalsConceded = 0;
            }
            else
            {
                Match scoreMatch = Regex.Match(scoreString, @"(\d)-(\d)", RegexOptions.Singleline);

                GoalsScored   = int.Parse(scoreMatch.Groups[1].Value.Trim());
                GoalsConceded = int.Parse(scoreMatch.Groups[2].Value.Trim());
            }
        }
        /// <param name="team"></param>
        /// <param name="resultString">string in the format "[OPPOSITION 3 letter code]([VENUE]) [FOR]-[AGAINST] " e.g. "SWA(H) 2-0"</param>
        /// <param name="ko"></param>
        public Result(IClub team, string resultString, DateTime ko)
        {
            Match fixture_match = Regex.Match(resultString, @"(.+)\((H|A)\)(.*)", RegexOptions.Singleline);
            Fixture = new Fixture(team, Clubs.GetClubFromShortcode(fixture_match.Groups[1].Value.Trim()), Fixture.ParseVenue(fixture_match.Groups[2].Value.Trim()), ko);

            var scoreString = fixture_match.Groups[3].Value.Trim();

            if(string.IsNullOrEmpty(scoreString)) // the game hasn't been played yet
            {
                GoalsScored = 0;
                GoalsConceded = 0;
            }
            else
            {
                Match scoreMatch = Regex.Match(scoreString, @"(\d)-(\d)", RegexOptions.Singleline);

                GoalsScored = int.Parse(scoreMatch.Groups[1].Value.Trim());
                GoalsConceded = int.Parse(scoreMatch.Groups[2].Value.Trim());
            }

        }
        public PlayerGameweekHistory(IClub club, List<object[]> RawGameweeks)
        {
            Gameweeks = new List<PlayerGameweek>();
            MinutesPlayed = 0;
            Goals = 0;
            Assists = 0;
            Conceded = 0;
            CleanSheets = 0;
            PenaltySaves = 0;
            PenaltiesMissed = 0;
            YellowCards = 0;
            RedCards = 0;
            Saves = 0;
            Bonus = 0;

            foreach (var gw in RawGameweeks)
            {
                var playerGw = new PlayerGameweek(club, gw);
                Gameweeks.Add(playerGw);

                // calculate totals
                MinutesPlayed += playerGw.MinutesPlayed;
                Goals += playerGw.GoalsScored;
                Assists += playerGw.Assists;
                Conceded += playerGw.GoalsConceded;
                CleanSheets += playerGw.CleanSheets;
                PenaltySaves += playerGw.PenaltiesSaved;
                PenaltiesMissed += playerGw.PenaltiesMissed;
                YellowCards += playerGw.YellowCards;
                RedCards += playerGw.RedCards;
                Saves += playerGw.Saves;
                Bonus += playerGw.Bonus;
                OwnGoals += playerGw.OwnGoals;
            }

            GamesPlayed = RawGameweeks.Count();
        }
        public PlayerGameweekHistory(IClub club, List <object[]> RawGameweeks)
        {
            Gameweeks       = new List <PlayerGameweek>();
            MinutesPlayed   = 0;
            Goals           = 0;
            Assists         = 0;
            Conceded        = 0;
            CleanSheets     = 0;
            PenaltySaves    = 0;
            PenaltiesMissed = 0;
            YellowCards     = 0;
            RedCards        = 0;
            Saves           = 0;
            Bonus           = 0;

            foreach (var gw in RawGameweeks)
            {
                var playerGw = new PlayerGameweek(club, gw);
                Gameweeks.Add(playerGw);

                // calculate totals
                MinutesPlayed   += playerGw.MinutesPlayed;
                Goals           += playerGw.GoalsScored;
                Assists         += playerGw.Assists;
                Conceded        += playerGw.GoalsConceded;
                CleanSheets     += playerGw.CleanSheets;
                PenaltySaves    += playerGw.PenaltiesSaved;
                PenaltiesMissed += playerGw.PenaltiesMissed;
                YellowCards     += playerGw.YellowCards;
                RedCards        += playerGw.RedCards;
                Saves           += playerGw.Saves;
                Bonus           += playerGw.Bonus;
                OwnGoals        += playerGw.OwnGoals;
            }

            GamesPlayed = RawGameweeks.Count();
        }
 public PlayerGameweek(IClub club, object[] stats)
 {
     var koTime = (string)stats[0];
     var koDateTime = DateTime.ParseExact(koTime, "dd MMM HH:mm", CultureInfo.InvariantCulture);
     Gameweek = (int) (long) stats[1];
     var resultStr = (string)stats[2];
     Result = new Result(club, resultStr, koDateTime);
     MinutesPlayed = (int) (long)  stats[3];
     GoalsScored = (int) (long) stats[4];
     Assists = (int) (long) stats[5];
     CleanSheets = (int) (long)  stats[6];
     GoalsConceded = (int) (long)  stats[7];
     OwnGoals = (int) (long)  stats[8];
     PenaltiesSaved = (int) (long) stats[9];
     PenaltiesMissed = (int) (long)  stats[10];
     YellowCards = (int) (long)  stats[11];
     RedCards = (int) (long)  stats[12];
     Saves = (int) (long)  stats[13];
     Bonus = (int) (long)  stats[14];
     EASportsPPI = (int) (long)  stats[15];
     NetTransers = (int) (long)  stats[16];
     Value = (int) (long)  stats[17];
     Points = (int) (long) stats[19];
 }
 public ClubViewModel(IClub club)
 {
     Club = club;
 }
 public void PickAClub(IEnumerable<IClub> clubs)
 {
     _club = clubs.FirstOrDefault(cl => cl.Index == (_competitor != null ? _competitor.ClubIndex : _athleteOverride.Index));
 }
Beispiel #25
0
 public static ClubDTO MappFrom(IClub club)
 {
     return(new ClubDTO(club));
 }
 public bool Equals(IClub other)
 {
     return(other != null && Name == other.Name);
 }
 private void GoToClubEventCallBack(IClub arg)
 {
     visibleTopBanner();
     visibleBottomBanner();
     IModuleFactory<IClubModuleViewModel> clubModuleFactory = new ClubModuleFactory();
     MainContent = clubModuleFactory.CreateView(arg);
 }
Beispiel #28
0
 public void PickAClub(IEnumerable <IClub> clubs)
 {
     _club = clubs.FirstOrDefault(cl => cl.Index == (_competitor != null ? _competitor.ClubIndex : _athleteOverride.Index));
 }
Beispiel #29
0
 public DAC(IClub club)
 {
     _club = club;
 }
 public HomeController(IClub club)
 {
     this.club = club;
 }
Beispiel #31
0
 public BOSTON_MAJOR(IClub club)
 {
     _club = club;
 }
Beispiel #32
0
 public ClubController(IClub clubService)
 {
     _clubService = clubService;
 }
 public void Initialize()
 {
     JudoClub = Club.Deserialize();
 }
 public void Initialize(IClub club)
 {
     JudoClub = club;
 }
 public ClubViewModel(IClub club)
 {
     Club = club;
 }
Beispiel #36
0
 public ClubController(IClub club)
 {
     foxClubExample = club;
 }