Example #1
0
        /// <summary>
        /// Below function is used for single challenge created when tie break occurs
        /// </summary>
        /// <param name="tournamentMatch"></param>
        /// <returns></returns>
        public static Challenge CreateChallenge(TournamentMatch tournamentMatch)
        {
            matchID = tournamentMatch.TournamentMatchID;
            Challenge Challenge = new Challenge(tournamentMatch.Cxt, 0);

            Challenge.ChallengerUserID = tournamentMatch.WhiteUserID;
            Challenge.OpponentUserID   = tournamentMatch.BlackUserID;
            Challenge.RoomID           = 7;

            Challenge.ChessTypeIDE = tournamentMatch.Tournament.ChessTypeIDE;

            Challenge.ChallengeTypeIDE      = ChallengeTypeE.Challenge;
            Challenge.ChallengeStatusIDE    = ChallengeStatusE.Accepted;
            Challenge.StatusIDE             = StatusE.Inactive;
            Challenge.ChallengeStatusIDE    = ChallengeStatusE.Seeking;
            Challenge.StatusIDE             = StatusE.Active;
            Challenge.IsRated               = tournamentMatch.Tournament.Rated;
            Challenge.WithClock             = true;
            Challenge.IsChallengerSendsGame = false;
            Challenge.GameTypeIDE           = Game.GetGameType(tournamentMatch.TimeMin, tournamentMatch.TimeSec);
            Challenge.TimeMin               = tournamentMatch.TimeMin;
            Challenge.GainPerMoveMin        = tournamentMatch.TimeSec;
            Challenge.ColorIDE              = ColorE.White;
            Challenge.TournamentMatchID     = tournamentMatch.TournamentMatchID;
            Challenge.Cxt = tournamentMatch.Cxt;

            return(Challenge);
        }
Example #2
0
        public static Challenge CreateChallenge(TournamentMatch m)
        {
            Challenge c = new Challenge(m.Cxt, BaseCollection.SelectItem(InfiChess.Challenge, "TournamentMatchID", m.TournamentMatchID));

            c.ChallengerUserID      = m.WhiteUserID;
            c.OpponentUserID        = m.BlackUserID;
            c.ChessTypeIDE          = m.Tournament.ChessTypeIDE;
            c.ChallengeTypeIDE      = ChallengeTypeE.Challenge;
            c.IsRated               = m.Tournament.Rated;
            c.WithClock             = true;
            c.IsChallengerSendsGame = false;
            c.GameTypeIDE           = Game.GetGameType(m.TimeMin, m.TimeSec);
            c.ColorIDE              = ColorE.White;
            c.TournamentMatchID     = m.TournamentMatchID;

            if (m.TournamentMatchTypeE == TournamentMatchTypeE.SuddenDeath)
            {
                Tournament t = new Tournament(m.Cxt, m.TournamentID);
                c.TimeMin        = t.SuddenDeathWhiteMin;
                c.GainPerMoveMin = t.SuddenDeathSec;
            }
            else
            {
                c.TimeMin        = m.TimeMin;
                c.GainPerMoveMin = m.TimeSec;
            }

            if (m.Tournament.RoomID > 0)
            {
                c.RoomID = m.Tournament.RoomID;
            }

            if (m.IsNotBye)
            {
                c.ChallengeStatusIDE = ChallengeStatusE.Seeking;
                c.StatusIDE          = StatusE.Active;
            }
            else
            {
                c.ChallengeStatusIDE = ChallengeStatusE.Accepted;
                c.StatusIDE          = StatusE.Inactive;
            }

            return(c);
        }