void tournamentUc1_OnTournamentSave(object sender, EventArgs e)
        {
            this.Tournament = tournamentUc1.Tournament;

            this.standingsUc1.OnTournamentSave();

            AllowEdit(IsAllowEdit);
        }
        public void Show(int tournamentID, bool allowEdit)
        {
            this.IsAllowEdit = allowEdit;

            Tournament = SocketClient.GetTournamentByID(tournamentID);

            tabCntrlTournamentDetail.SelectedIndex = 0;

            SelectTab("tournament");

            AllowEdit(allowEdit);

            VisibleTab();
        }
Пример #3
0
        private int ValidateTeam(App.Model.Db.Tournament t)
        {
            int teamID = 0;

            if (t.TournamentTypeIDE == TournamentTypeE.Scheveningen)
            {
                if (cbTeam.Items.Count == 0)
                {
                    MessageForm.Error(this.ParentForm, MsgE.ErrorNoSelection, "team");
                    return(-1);
                }
                return(Convert.ToInt32(cbTeam.SelectedValue));
            }
            return(teamID);
        }
Пример #4
0
        public DialogResult Show(Form owner, App.Model.Db.Tournament Tournament, int tournamentMatchID, string whiteName, string blackName,
                                 int player1, int player2, int round, int parentMatchID, int matchStatusId, int matchTypeId, int statusId)
        {
            MatchEditor frm = new MatchEditor();

            frm.MatchEditorUc1.Tournament        = Tournament;
            frm.MatchEditorUc1.TournamentMatchID = tournamentMatchID;
            frm.MatchEditorUc1.Player1           = player1;
            frm.MatchEditorUc1.Player2           = player2;
            frm.MatchEditorUc1.Round             = round;
            frm.MatchEditorUc1.WhitePlayer       = whiteName;
            frm.MatchEditorUc1.BlackPlayer       = blackName;
            frm.MatchEditorUc1.ParentMatchID     = parentMatchID;
            frm.MatchEditorUc1.MatchStatusID     = matchStatusId;
            frm.MatchEditorUc1.MatchTypeID       = matchTypeId;
            frm.MatchEditorUc1.StatusID          = statusId;

            DialogResult dr = frm.ShowDialog(owner);

            return(dr);
        }
Пример #5
0
        public DialogResult Show(Form owner, App.Model.Db.Tournament Tournament, string whiteName, string blackName,
                                 int player1, int player2, int round, int parentMatchID, int tournamentMatchID)
        {
            TieBreakMatch frm = new TieBreakMatch();

            frm.TieBreakMatchUc1.Tournament        = Tournament;
            frm.TieBreakMatchUc1.Player1           = player1;
            frm.TieBreakMatchUc1.Player2           = player2;
            frm.TieBreakMatchUc1.Round             = round;
            frm.TieBreakMatchUc1.ParentMatchID     = parentMatchID;
            frm.TieBreakMatchUc1.TournamentMatchID = tournamentMatchID;
            frm.TieBreakMatchUc1.WhitePlayer       = whiteName;
            frm.TieBreakMatchUc1.BlackPlayer       = blackName;

            DialogResult dr = frm.ShowDialog(owner);

            if (dr == DialogResult.OK)
            {
                owner.DialogResult = DialogResult.OK;
                //this.Close();
            }
            return(dr);
        }
Пример #6
0
        private void SetTournament(App.Model.Db.Tournament value)
        {
            if (value == null)
            {
                return;
            }

            switch (tournament.TournamentTypeE)
            {
            case TournamentTypeE.RoundRobin:
                roundRobinResultsUc1.Tournament = value;
                roundRobinResultsUc1.Visible    = true;
                roundRobinResultsUc1.Dock       = DockStyle.Fill;
                break;

            case TournamentTypeE.Swiss:
                swissResultsUc1.Tournament = value;
                swissResultsUc1.Visible    = true;
                swissResultsUc1.Dock       = DockStyle.Fill;
                break;

            case TournamentTypeE.Knockout:
                knockOutResultsUc1.Tournament = value;
                knockOutResultsUc1.Visible    = true;
                knockOutResultsUc1.Dock       = DockStyle.Fill;
                break;

            case TournamentTypeE.Scheveningen:
                scheveningenResultsUc1.Tournament = value;
                scheveningenResultsUc1.Visible    = true;
                scheveningenResultsUc1.Dock       = DockStyle.Fill;
                break;

            default:
                break;
            }
        }
Пример #7
0
        private void SaveTournament()
        {
            App.Model.Db.Tournament t = new App.Model.Db.Tournament();

            t.TournamentTypeID = (int)cmbType.SelectedValue;
            t.ChessTypeID      = (int)cmbChessType.SelectedValue;
            t.Round            = (int)cmbRound.SelectedValue;

            t.Rated          = chkRated.Checked;
            t.DoubleRound    = chkDoubleRound.Checked;
            t.IsTieBreak     = chkAllowTieBreak.Checked;
            t.TimeControlMin = (int)cmbMin.SelectedValue;
            t.TimeControlSec = (int)cmbSec.SelectedValue;

            //t.RegistrationStartDate = dtpRegistrationStart.Value;
            //t.RegistrationStartTime
            //t.RegistrationEndDate
            //t.RegistrationEndTime

            t.Name        = txtTitle.Text;
            t.Description = txtInvitation.Text;

            SocketClient.SaveTournament(t.DataRow.Table);
        }
Пример #8
0
 public RegisterPlayerUc(AppTournament Tournament)
 {
     InitializeComponent();
     this.Tournament = Tournament;
 }
Пример #9
0
        private void SaveTournament()
        {
            Kv kv = new Kv();

            if (Tournament != null)
            {
                kv.Set("TournamentID", this.Tournament.TournamentID);
            }

            if (cmbType.SelectedValue != null)
            {
                kv.Set("TournamentTypeID", cmbType.SelectedValue.ToString());
            }

            if (cmbChessType.SelectedValue != null)
            {
                kv.Set("ChessTypeID", cmbChessType.SelectedValue.ToString());
            }

            if (cmbRound.SelectedItem != null)
            {
                kv.Set("Round", cmbRound.SelectedItem.ToString());
            }
            else
            {
                kv.Set("Round", 1);
            }

            if (cmbDblRound.SelectedItem != null)
            {
                kv.Set("DoubleRoundNo", Convert.ToInt32(cmbDblRound.Text));
            }
            else
            {
                kv.Set("DoubleRoundNo", 0);
            }

            if (cmbType.SelectedValue != null && cmbType.SelectedValue.ToString() == "3") // if knock-out tournament.
            {
                chkAllowTieBreak.Checked = numTieBreaks.Value > 0;
            }

            kv.Set("Rated", chkRated.Checked);
            kv.Set("DoubleRound", chkDoubleRound.Checked);
            kv.Set("IsTieBreak", chkAllowTieBreak.Checked);

            if (cmbMin.SelectedItem != null)
            {
                kv.Set("TimeControlMin", cmbMin.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TimeControlMin", 1);
            }

            if (cmbSec.SelectedItem != null)
            {
                kv.Set("TimeControlSec", cmbSec.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TimeControlSec", 1);
            }

            kv.Set("RegistrationStartDate", dtpRegStartDate.Value.ToString());
            kv.Set("RegistrationStartTime", dtpRegStartTime.Value.ToShortTimeString());

            kv.Set("RegistrationEndDate", dtpRegEndDate.Value.ToString());
            kv.Set("RegistrationEndTime", dtpRegEndTime.Value.ToShortTimeString());

            kv.Set("TournamentStartDate", dtpTournamentStartDate.Value.ToString());
            kv.Set("TournamentStartTime", dtpTournamentStartTime.Value.ToShortTimeString());

            kv.Set("TournamentStatusID", (int)TournamentStatusE.Scheduled);
            kv.Set("StatusID", (int)StatusE.Active);
            kv.Set("TournamentStartTime", dtpTournamentStartTime.Value.ToString());

            kv.Set("Name", txtTitle.Text);
            kv.Set("Description", txtInvitation.Text);

            if (cmbTbMin.SelectedItem != null)
            {
                kv.Set("TieBreakMin", cmbTbMin.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TieBreakMin", 1);
            }
            if (cmbTbSec.SelectedItem != null)
            {
                kv.Set("TieBreakSec", cmbTbSec.SelectedItem.ToString());
            }
            else
            {
                kv.Set("TieBreakSec", 1);
            }
            kv.Set("NoOfGamesPerRound", numGames.Value);
            kv.Set("NoOfTieBreaks", numTieBreaks.Value);
            kv.Set("SuddenDeathWhiteMin", cmbWhiteMin.SelectedItem.ToString());
            kv.Set("SuddenDeathBlackMin", cmbBlackMin.SelectedItem.ToString());
            kv.Set("SuddenDeathSec", cmbSdSec.SelectedItem.ToString());

            if (chkAllowMultipleWinners.Checked)
            {
                kv.Set("MaxWinners", numMaxWinners.Value);
            }
            else
            {
                kv.Set("MaxWinners", 0);
            }

            ProgressForm frmProgress = ProgressForm.Show(this, "Saving Tournament...");

            DataSet ds = SocketClient.SaveTournament(kv);

            frmProgress.Close();

            if (ds.Tables.Count > 0)
            {
                if (ds.Tables[0].Rows.Count > 0)
                {
                    kv = new Kv(ds.Tables[0]);
                    this.Tournament = new App.Model.Db.Tournament(Ap.Cxt, ds.Tables[0].Rows[0]);
                }
            }
            else
            {
                return;
            }

            if (this.Tournament == null)
            {
                return;
            }

            if (OnTournamentSave != null)
            {
                OnTournamentSave(this, EventArgs.Empty);
            }

            if (this.Tournament != null)
            {
                if (this.Tournament.TournamentID > 0)
                {
                    MessageForm.Show(this.ParentForm, MsgE.ConfirmTournamentSaved, this.Tournament.Name);
                    cmbChessType.Enabled = false;
                }
            }


            if (OnVisibleTab != null)
            {
                OnVisibleTab(this, EventArgs.Empty);
            }

            ViewStartTournamentButton();
        }