Ejemplo n.º 1
0
        void FillRounds(Contest C)
        {
            //  Limpiamos la lista
            ListRounds.Items.Clear();

            //  Recorremos todas las rondas para agregarlas a la lista
            for (int i = 0; i < C.Rounds.Length; i++)
            {
                ListViewItem IT = new ListViewItem();

                IT.Text = Round.RoundName(i, C.Rounds.Length);

                IT.SubItems.Add(C.Rounds[i].RequiredPlayers.ToString());
                IT.SubItems.Add(C.Rounds[i].QuestionsByPlayer.ToString());

                //  Agregamos el item
                ListRounds.Items.Add(IT);
            }
        }
Ejemplo n.º 2
0
        private void ContestSelection(object sender = null, EventArgs e = null)
        {
            //  Deshabilitamos y limpiamos la ronda
            ListRounds.Items.Clear();
            ButtonRoundDelete.Enabled   =
                ButtonRoundSave.Enabled = false;

            //  Si se seleccionó algo
            if (ListContest.SelectedItems.Count > 0)
            {
                //  Sacamos el objeto y lo parseamos a Contest
                Contest C = RegistredContests[ListContest.SelectedIndices[0]];

                //  Sacamos las rondas del Contest
                C.Rounds = DataBase.LoadRounds(C.Id);

                //  Llenamos la lista de Rondas
                FillRounds(C);

                //  Mantenemos deshabilitados los botones de save y delete...
            }
        }
Ejemplo n.º 3
0
 public static bool CreateNew(Contest Contest)
 {
     return(Exec("INSERT INTO contest (ContestName) VALUES ('" + Contest.Name + "')"));
 }
Ejemplo n.º 4
0
        void ContestChanged(object sender, EventArgs e)
        {
            //  Limpiamos el dashboard
            ClearDashboard();

            //  Sacamos el indice del contest
            CI = ComboContest.SelectedIndex - 1;
            ComboRounds.Items.Clear();  //  Clear combo

            //  Si el Indice esta en el rando aceptado de contest.length
            if (CI >= 0 && CI < ContestList.Length)
            {
                //  Procedemos al llenado de rondas
                C           = ContestList[CI];
                C.Questions = DataBase.LoadQuestions(C.Id);
                C.Rounds    = DataBase.LoadRounds(C.Id);

                ComboRounds.Items.Add(C.Rounds.Length > 0 ? "(Seleccione)" : "(No hay rondas)");

                for (int i = 0; i < C.Rounds.Length; i++)
                {
                    ComboRounds.Items.Add(Round.RoundName(i, C.Rounds.Length));
                }

                //  Si hay suficientes preguntas para jugar
                if (C.Questions.Length > C.RequiredQuestions)
                {
                    //  Activamos y ya...
                    ComboRounds.Enabled          =
                        ButtonRoundStart.Enabled =
                            true;
                    goto End;
                }

                //  Si no hay suficientes preguntas, mandamos el mensaje.
                MessageBox.Show("No se podrá jugar «" + C.Name + "» ya que requiere de " + C.RequiredQuestions + " preguntas y" +
                                (C.Questions.Length > 0 ? " solo se cuenta con " + C.Questions.Length : " no hay preguntas") +
                                " en el banco.", "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            //  Si no esta en el rando de contest.length
            else
            {
                //  Quitamos todos los comodines
                C = null;
                R = null;
                //P = null; esto no es necesario, porque se quita al momento de terminar la ronda (dos niveles adentro)

                //  Marcamos el combo de rondas
                ComboRounds.Items.Add("(No hay rondas)");
            }

            ComboRounds.Enabled          =
                ButtonRoundStart.Enabled =
                    ButtonConfig.Enabled = false;

            ButtonRoundStart.Text = "Iniciar";

            //  Marcamos el primer elemento...
End:
            ComboRounds.SelectedIndex = 0;
        }