Example #1
0
        public void AssignDropinSpotToWaiting(Pool thePool, Game theGame)
        {
            if (IsReservationLocked(theGame.Date) || theGame.WaitingList.Count == 0 || !IsSpotAvailable(thePool, theGame.Date))
            {
                return;
            }
            Waiting waiting  = theGame.WaitingList[0];
            String  playerId = waiting.PlayerId;
            Player  player   = Manager.FindPlayerById(playerId);

            ReserveSpot(thePool, theGame, player);
            Manager.ReCalculateFactor(thePool, theGame.Date);
            theGame.WaitingList.Remove(playerId);
            Manager.AddReservationNotifyWechatMessage(playerId, null, Constants.WAITING_TO_RESERVED, thePool, thePool, theGame.Date);
            LogHistory log = CreateLog(Manager.EastDateTimeNow, theGame.Date, GetUserIP(), thePool.Name, Manager.FindPlayerById(playerId).Name, "Reserved", "Admin");

            Manager.Logs.Add(log);
            theGame.WaitingList.Remove(playerId);
            //Cancel the member spot in another pool on same day
            Pool sameDayPool = Manager.Pools.Find(pool => pool.Name != thePool.Name && pool.DayOfWeek == thePool.DayOfWeek);

            if (CancelSpot(sameDayPool, sameDayPool.FindGameByDate(theGame.Date), player))
            {
                Manager.ReCalculateFactor(sameDayPool, theGame.Date);
                Manager.AddReservationNotifyWechatMessage(playerId, null, Constants.CANCELLED, sameDayPool, sameDayPool, theGame.Date);
                AssignDropinSpotToWaiting(sameDayPool, sameDayPool.FindGameByDate(theGame.Date));
            }
        }
Example #2
0
        public void AddToWaitingList(Pool pool, Game game, Player player)
        {
            Waiting waiting = new Waiting(player.Id);

            waiting.OperatorId = CurrentUser == null? null : CurrentUser.Id;
            game.WaitingList.Add(waiting);
            //Manager.AddReservationNotifyWechatMessage(player.Id, waiting.OperatorId, Constants.WAITING, pool, pool, game.Date);
            //LogHistory log = CreateLog(Manager.EastDateTimeNow, game.Date, GetUserIP(), pool.Name, player.Name, "Add to Waiting List");
            // Manager.Logs.Add(log);
        }