private PlayerEntity GetPlayerEntity(PlayerBE pbe)
        {
            var pse = new PlayerSeasonEntity
            {
                @class      = pbe.ClassYr.Trim(),
                eligibility = pbe.EligibilityYr.Trim(),
                height      = (short)pbe.Height,
                jersey      = (short)pbe.JerseyNum,
                player_id   = (short)pbe.PlayerID,
                position    = pbe.Position.Trim(),
                season_id   = (short)pbe.SeasonID,
                weight      = (short)pbe.Weight,
                team        = pbe.Team.Trim()
            };

            var pe = new PlayerEntity
            {
                first      = pbe.FirstName.Trim(),
                highschool = pbe.HighSchool.Trim(),
                homestate  = pbe.HomeState.Trim(),
                hometown   = pbe.Hometown.Trim(),
                id         = (short)pbe.PlayerID,
                last       = pbe.LastName.Trim(),
                major      = pbe.Major.Trim(),
                middle     = pbe.MiddleName.Trim()
            };

            pe.PlayerSeason.Add(pse);

            return(pe);
        }
Exemple #2
0
        private PlayerBE GetEntity(PlayerEntity pe)
        {
            if (null == pe)
            {
                return(null);
            }

            short MaxSeason        = pe.PlayerSeason.Max <PlayerSeasonEntity, short>(x => x.season_id);
            PlayerSeasonEntity pse = pe.PlayerSeason.Single(x => x.season_id.Equals(MaxSeason));

            var result = new PlayerBE
            {
                Bio           = string.IsNullOrEmpty(pse.bio) ? "no bio provided" : pse.bio,
                Captain       = pse.captain.GetValueOrDefault(),
                ClassYr       = pse.@class,
                EligibilityYr = pse.eligibility,
                FirstName     = pe.first,
                Height        = pse.height.GetValueOrDefault(),
                HighSchool    = pe.highschool,
                HomeState     = pe.homestate,
                Hometown      = pe.hometown,
                JerseyNum     = pse.jersey.GetValueOrDefault(),
                LastName      = pe.last,
                Major         = pe.major,
                MiddleName    = pe.middle,
                Officer       = pse.officer.GetValueOrDefault(),
                PlayerID      = pe.id,
                Position      = pse.position,
                President     = pse.president.GetValueOrDefault(),
                SeasonID      = pse.season_id,
                Weight        = pse.weight.GetValueOrDefault()
            };

            return(result);
        }
Exemple #3
0
        private PlayerBE GetEntity(PlayerEntity pe, short seasonID = -1)
        {
            if (null == pe)
            {
                return(null);
            }

            if (seasonID.Equals(-1))
            {
                seasonID = pe.PlayerSeason.Max <PlayerSeasonEntity, short>(x => x.season_id);
            }

            PlayerSeasonEntity pse = pe.PlayerSeason.Single(x => x.season_id.Equals(seasonID));

            var result = new PlayerBE
            {
                FirstName  = pe.first,
                HighSchool = pe.highschool,
                HomeState  = pe.homestate,
                Hometown   = pe.hometown,
                LastName   = pe.last,
                Major      = pe.major,
                MiddleName = pe.middle,
                PlayerID   = pe.id
            };

            bool seasonExists = (null == pse);

            result.Bio           = (seasonExists || string.IsNullOrEmpty(pse.bio)) ? "no bio provided" : pse.bio;
            result.Captain       = seasonExists ? false : pse.captain.GetValueOrDefault();
            result.ClassYr       = seasonExists ? string.Empty : pse.@class;
            result.EligibilityYr = seasonExists ? string.Empty : pse.eligibility;
            result.Height        = seasonExists ? 0 : pse.height.GetValueOrDefault();
            result.JerseyNum     = seasonExists ? -1 : pse.jersey.GetValueOrDefault();
            result.Officer       = seasonExists ? false : pse.officer.GetValueOrDefault();
            result.Position      = seasonExists ? string.Empty : pse.position;
            result.President     = seasonExists ? false : pse.president.GetValueOrDefault();
            result.SeasonID      = seasonExists ? 0 : pse.season_id;
            result.Weight        = seasonExists ? 0 : pse.weight.GetValueOrDefault();

            return(result);
        }