예제 #1
0
파일: DataBase.cs 프로젝트: pleyus/tinyq
 public static bool Delete(Round Round)
 {
     return(Exec("DELETE FROM rounds WHERE Id = " + Round.Id));
 }
예제 #2
0
파일: DataBase.cs 프로젝트: pleyus/tinyq
 public static bool CreateNew(Round Round, int ContestId)
 {
     return(Exec("INSERT INTO rounds (ContestId, RequiredPlayers, QuestionsByPlayer) VALUES (" + ContestId + ", " + Round.RequiredPlayers + ", " + Round.QuestionsByPlayer + ")"));
 }
예제 #3
0
파일: DataBase.cs 프로젝트: pleyus/tinyq
 public static bool Update(Round Round)
 {
     return(Exec("UPDATE rounds SET RequiredPlayers = " + Round.RequiredPlayers +
                 ", QuestionsByPlayer = " + Round.QuestionsByPlayer + " WHERE Id = " + Round.Id));
 }
예제 #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;
        }