void ReleaseDesignerOutlets()
        {
            if (LeagueName != null)
            {
                LeagueName.Dispose();
                LeagueName = null;
            }

            if (MatchContainer != null)
            {
                MatchContainer.Dispose();
                MatchContainer = null;
            }

            if (StatContainer != null)
            {
                StatContainer.Dispose();
                StatContainer = null;
            }

            if (TableContainer != null)
            {
                TableContainer.Dispose();
                TableContainer = null;
            }
        }
Exemplo n.º 2
0
        private void CreateFederationSeason(Match match)
        {
            SportFederation spFed = new SportFederation();

            string country   = match.Country;
            string nameSport = match.NameSportString;
            var    searchSF  = from c in db.SportFederations
                               where c.NameSportString == nameSport &&
                               c.Country == country
                               select c;

            if (searchSF.Count() > 0)
            {
                FederationSeason fedSeason = new FederationSeason();
                spFed = searchSF.First();

                fedSeason.NameTournament    = LeagueName.Name(match.Country + match.NameSport.ToString() + match.Tournament.ToString());
                fedSeason.Season            = match.Season;
                fedSeason.SportFederation   = spFed;
                fedSeason.SportFederationId = spFed.SportFederationId;
                fedSeason.Tournament        = match.Tournament;
                fedSeason.Matches           = new List <Match>();

                db.FederationSeasons.Add(fedSeason);
                db.SaveChanges();
            }
        }
Exemplo n.º 3
0
        void ReleaseDesignerOutlets()
        {
            if (Country != null)
            {
                Country.Dispose();
                Country = null;
            }

            if (Date != null)
            {
                Date.Dispose();
                Date = null;
            }

            if (LeagueName != null)
            {
                LeagueName.Dispose();
                LeagueName = null;
            }

            if (StadiumAddress != null)
            {
                StadiumAddress.Dispose();
                StadiumAddress = null;
            }

            if (StadiumName != null)
            {
                StadiumName.Dispose();
                StadiumName = null;
            }
        }
Exemplo n.º 4
0
        public User(int id, string name, string memberName, string password, int points, int money, string email)
        {
            this.id               = id;
            this.name             = name;
            this.memberName       = memberName;
            this.password         = password;
            this.points           = points;
            this.money            = money;
            this.email            = email;
            WinNum                = 0;
            LoseNum               = 0;
            HighestCashGainInGame = 0;
            TotalProfit           = 0;

            isActive = true;
            Random rnd      = new Random();
            int    avtarNum = rnd.Next(1, 10);

            avatar = GetRandomPath(avtarNum);
            _gamesAvailableToReplay = new List <Tuple <int, int> >();
            activeGameList          = new List <IGame>();
            spectateGameList        = new List <IGame>();
            unknowGamesPlay         = 0;
            league = LeagueName.Unknow; //TODO change to default one or something
        }
Exemplo n.º 5
0
 public override int GetHashCode()
 {
     return(Date.GetHashCode() ^ 7
            * Discipline.GetHashCode() ^ 11
            * LeagueName.GetHashCode() ^ 17
            * MatchHomeName.GetHashCode() ^ 19
            * MatchAwayName.GetHashCode() ^ 23
            * PickChoice.GetHashCode() ^ 29
            * PickValue.GetHashCode() ^ 31);
 }
Exemplo n.º 6
0
        private LeagueName GetNextLeague(LeagueName curr)
        {
            LeagueName toReturn = LeagueName.E;

            try
            {
                switch (curr)
                {
                case LeagueName.A:
                    toReturn = LeagueName.B;
                    return(toReturn);

                    break;

                case LeagueName.B:
                    toReturn = LeagueName.C;
                    return(toReturn);

                    break;

                case LeagueName.C:
                    toReturn = LeagueName.D;
                    return(toReturn);

                    break;

                case LeagueName.D:
                    toReturn = LeagueName.E;
                    return(toReturn);

                    break;

                case LeagueName.E:
                    toReturn = LeagueName.E;
                    return(toReturn);

                    break;

                default:
                    toReturn = LeagueName.E;
                    return(toReturn);

                    break;
                }
            }
            catch
            {
                ErrorLog log = new ErrorLog("Error: while trying to ey next League name");
                logControl.AddErrorLog(log);
                return(toReturn);
            }

            return(toReturn);
        }
Exemplo n.º 7
0
 public BeforeGameDecorator(int minBetInRoom, int startingChip, bool isSpectetor,
                            int minPlayersInRoom, int maxPlayersInRoom, int enterPayingMoney, LeagueName league)
 {
     this.IsSpectetor      = isSpectetor;
     this.StartingChip     = startingChip;
     this.MaxPlayersInRoom = maxPlayersInRoom;
     this.MinPlayersInRoom = minPlayersInRoom;
     this.EnterPayingMoney = enterPayingMoney;
     this.BB     = minBetInRoom;
     SB          = BB / 2;
     this.league = league;
 }
Exemplo n.º 8
0
        public GameRoomXML(GameRoom g)
        {
            Id      = g.Id;
            Players = new List <PlayerXML>();
            foreach (Player p in g.GetPlayersInRoom())
            {
                Players.Add(new PlayerXML(p));
            }

            Spectatores = new List <SpecXML>();
            foreach (Spectetor p in g.GetSpectetorInRoom())
            {
                Spectatores.Add(new SpecXML(p));
            }

            DealerPos     = g.GetDealerPos();
            maxBetInRound = g.GetMaxBetInRound();
            PotCount      = g.GetPotSize();
            Bb            = g.getBBnum();
            Sb            = g.getSBNUM();
            Deck          = g.GetDeck();
            Hand_Step     = g.GetHandStep();
            PublicCards   = g.GetPublicCards();
            IsActiveGame  = g.IsGameActive();
            if (g.GetSidePots() != null)
            {
                sidePotsXML = new List <SidePotTuple>();
                SidePots    = new List <Tuple <int, PlayerXML> >();
                foreach (var p in g.GetSidePots())
                {
                    PlayerXML pp = new PlayerXML(p.Item2);
                    SidePots.Add(new Tuple <int, PlayerXML>(p.Item1, pp));
                    sidePotsXML.Add(new SidePotTuple(p.Item1, pp));
                }
            }

            GameReplay    = g.GetGameRepObj();
            league        = g.GetLeagueName();
            ReplayManager = g.GetRepManager();

            CurrentPlayer = new PlayerXML(g.GetCurrPlayer());
            DealerPlayer  = new PlayerXML(g.GetDealer());
            BbPlayer      = new PlayerXML(g.GetBb());
            SbPlayer      = new PlayerXML(g.GetSb());
            //  MyDecorator = g.GetDecorator();

            GameNumber                 = g.GetGameNum();
            FirstPlayerInRound         = new PlayerXML(g.GetFirstPlayerInRound());
            currentPlayerPos           = g.GetCurrPosition();
            firstPlayerInRoundPoistion = g.GetFirstPlayerInRoundPos();
            lastRaiseInRound           = g.GetlastRaiseInRound();
            useCommunication           = g.GetUseComm();
        }
Exemplo n.º 9
0
 public bool Equals(LeagueDto other)
 {
     if (ReferenceEquals(null, other))
     {
         return(false);
     }
     if (ReferenceEquals(this, other))
     {
         return(true);
     }
     return(LeagueId == other.LeagueId && LeagueName.Equals(other.LeagueName) &&
            LeagueInfo.Equals(other.LeagueInfo) && Location.Equals(other.Location));
 }
Exemplo n.º 10
0
        //inc num of games play
        public bool IncGamesPlay()
        {
            lock (padlock)
            {
                userDataProxy.EditUserNumOfGamesPlayed(id, unknowGamesPlay + 1);
                unknowGamesPlay++;

                if (unknowGamesPlay > 10 && league == LeagueName.Unknow)
                {
                    league = LeagueName.E;
                    userDataProxy.EditUserLeagueName(id, LeagueName.E);
                }
                return(true);
            }
        }
Exemplo n.º 11
0
        public void EditUserLeagueNameTest_good()
        {
            UserTable toAdd1 = CreateUser(22, "22name");

            _userDataControler.AddNewUser(toAdd1);
            LeagueName n = new LeagueName
            {
                League_Value = 3,
                League_Name  = "C"
            };

            _userDataControler.EditUserLeagueName(22, n);
            Assert.AreEqual(_userDataControler.GetUserById(22).leagueName, 3);
            _userDataControler.DeleteUserById(22);
        }
Exemplo n.º 12
0
        public async Task <IEnumerable <Event> > GetUpcomingByLeague(int limit, LeagueName league)
        {
            var now    = DateTime.UtcNow;
            var inWeek = DateTime.UtcNow.AddDays(7);

            var leagueName = LeagueNameConvertor.Convertor[league];

            var events = await _eventsCollection
                         .Find(x => x.StartEventDate > now && x.StartEventDate < inWeek && x.LeagueName == leagueName)
                         .Limit(limit)
                         .ToListAsync();

            _metrics.Mark("_byleague");
            return(events);
        }
Exemplo n.º 13
0
        public bool SetNumGamesPlayed(int amount)
        {
            lock (padlock)
            {
                userDataProxy.EditUserNumOfGamesPlayed(id, unknowGamesPlay + amount);
                unknowGamesPlay += amount;

                if (unknowGamesPlay > 10 && league == LeagueName.Unknow)
                {
                    league = LeagueName.E;
                    userDataProxy.EditUserLeagueName(id, LeagueName.E);
                }
                return(true);
            }
        }
Exemplo n.º 14
0
        public override bool Equals(object obj)
        {
            if (!(obj is BetRequest))
            {
                return(false);
            }
            var oBetResponse = (BetRequest)obj;

            return(Date == oBetResponse.Date &&
                   Discipline == oBetResponse.Discipline &&
                   LeagueName.EqIgnoreCase(oBetResponse.LeagueName) &&
                   MatchHomeName.EqIgnoreCase(oBetResponse.MatchHomeName) &&
                   MatchAwayName.EqIgnoreCase(oBetResponse.MatchAwayName) &&
                   PickChoice == oBetResponse.PickChoice &&
                   PickValue.Eq(oBetResponse.PickValue));
        }
Exemplo n.º 15
0
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null)
            {
                return(null);
            }

            if (value.GetType() != typeof(string))
            {
                throw new Exception($"Connot convert from type {value.GetType()}");
            }

            var leagueName = new LeagueName(value.ToString());

            return(leagueName);
        }
Exemplo n.º 16
0
        public bool DivideLeague()
        {
            lock (padlock)
            {
                try
                {
                    List <IUser> sorted    = SortByPoint();
                    int          userCount = sorted.Count;
                    int          divideTo;
                    if (userCount == 0)
                    {
                        return(false);
                    }
                    double temp = (userCount / 5);
                    divideTo = (int)Math.Round(temp);
                    if (divideTo < 2)
                    {
                        divideTo = 2;
                    }
                    int        i    = 0;
                    int        k    = 0;
                    LeagueName curr = LeagueName.A;

                    while (i < userCount)
                    {
                        while (k < divideTo && i < userCount)
                        {
                            sorted.ElementAt(i).SetLeague(curr);

                            k++;
                            i++;
                        }
                        k    = 0;
                        curr = GetNextLeague(curr);
                    }
                    return(true);
                }
                catch
                {
                    ErrorLog log = new ErrorLog("Error: while trying to divide the leauge");
                    logControl.AddErrorLog(log);
                    return(false);
                }
            }
        }
Exemplo n.º 17
0
        public User(int id, string name, string memberName, string password, int points, int money,
                    string email, int winNum, int loseNum, int highestCashGainInGame, int totalProfit, string _avatar, int gamesPlayed, bool _isActive, LeagueName _league)
        {
            this.id               = id;
            this.name             = name;
            this.memberName       = memberName;
            this.password         = password;
            this.points           = points;
            this.money            = money;
            this.email            = email;
            WinNum                = winNum;
            LoseNum               = loseNum;
            HighestCashGainInGame = highestCashGainInGame;
            TotalProfit           = totalProfit;

            isActive = _isActive;
            avatar   = _avatar;
            _gamesAvailableToReplay = new List <Tuple <int, int> >();
            activeGameList          = new List <IGame>();
            spectateGameList        = new List <IGame>();
            unknowGamesPlay         = gamesPlayed;
            league = _league;
        }
Exemplo n.º 18
0
 public League(LeagueName name, List <Guid> teamIds)
 {
     Name    = name;
     TeamIds = teamIds;
 }
Exemplo n.º 19
0
        public Decorator CreateDecorator(int minBet, int startingChip, bool canSpectate, int minPlayersInRoom, int maxPlayersInRoom, int enterPayingMoney, GameMode gameModeChosen, LeagueName league)
        {
            Decorator mid    = new MiddleGameDecorator(gameModeChosen, minBet, minBet / 2);
            Decorator before = new BeforeGameDecorator(minBet, startingChip, canSpectate, minPlayersInRoom, maxPlayersInRoom, enterPayingMoney, league);

            before.SetNextDecorator(mid);
            return(before);
        }
Exemplo n.º 20
0
 public void SetLeague(LeagueName league)
 {
     this.league = league;
 }
Exemplo n.º 21
0
 public void Edit(League league, LeagueName newLeagueName, List <Guid> newTeamIds)
 {
     _leagueRepository.Edit(league, newLeagueName, newTeamIds);
 }
Exemplo n.º 22
0
 public void Edit(League league, LeagueName newLeagueName, List <Guid> newTeamIds)
 {
     league.Name    = newLeagueName;
     league.TeamIds = newTeamIds;
     Save(_leaguePath, _leagues);
 }