Ejemplo n.º 1
0
 private void JogarRodada()
 {
     Negocio.NParticipante NParticipante = new Negocio.NParticipante();
     NParticipante.SetJogadorVez();
     Modelo.Participante JogadorVez = NParticipante.GetJogadorVez();
     txtJogador.Text = JogadorVez.nome + " " + JogadorVez.placar.ToString();
 }
Ejemplo n.º 2
0
 public void agregarParticipante(Modelo.Participante participante)
 {
     try
     {
         Abrir();
         SqlCommand command = new SqlCommand("agregarParticipante", conn);
         command.CommandType = CommandType.StoredProcedure;
         command.Parameters.Add(new SqlParameter("@ActividadId", participante.getIdActividad()));
         command.Parameters.Add(new SqlParameter("@CursoId", participante.getIdCurso()));
         command.Parameters.Add(new SqlParameter("@TipoPId", participante.getIdTipoParticipante()));
         command.Parameters.Add(new SqlParameter("@Apellido1", participante.getPrimerApellidoP()));
         command.Parameters.Add(new SqlParameter("@Apellido2", participante.getSegundoApellidoP()));
         command.Parameters.Add(new SqlParameter("@Nombre", participante.getNombreP()));
         command.Parameters.Add(new SqlParameter("@Identificacion", participante.getIdentificacion()));
         command.Parameters.Add(new SqlParameter("@Correo", participante.getCorreo()));
         command.Parameters.Add(new SqlParameter("@Campus", participante.getCampus()));
         command.ExecuteNonQuery();
         if (conn.State != ConnectionState.Closed)
         {
             Cerrar();
         }
         System.Diagnostics.Debug.WriteLine("Participante agregado correctamente");
     }
     catch (SqlException ex)
     {
         Console.Write(ex);
         System.Diagnostics.Debug.WriteLine("Error al insertar participante");
     }
 }
Ejemplo n.º 3
0
 public PageMediador()
 {
     InitializeComponent();
     Negocio.NParticipante NParticipante = new Negocio.NParticipante();
     NParticipante.NovaRodada();
     Modelo.Participante mediador = NParticipante.GetMediador();
     txtMediador.Text = mediador.nome;
 }
Ejemplo n.º 4
0
 public void TestCriarRodada1()
 {
     Negocio.NPerfil NPerfil = new Negocio.NPerfil();
     NPerfil.PerfisInciais();
     Negocio.NParticipante NParticipante = new Negocio.NParticipante();
     Negocio.NDica         NDica         = new Negocio.NDica();
     NParticipante.CriarPartida("2", "Teste1", "Teste2", "Teste3", "Teste4");
     NParticipante.NovaRodada();
     Modelo.Participante p1 = NParticipante.GetMediador();
     NParticipante.NovaRodada();
     Modelo.Participante p2 = NParticipante.GetMediador();
     Assert.AreNotEqual(p1.nome, p2.nome);
 }
Ejemplo n.º 5
0
        public PageJogadorVez()
        {
            InitializeComponent();

            Negocio.NParticipante NParticipante = new Negocio.NParticipante();
            Modelo.Participante   p             = NParticipante.GetJogadorVez();
            txtParticipanteVez.Text = p.nome;

            //Timer

            dispatcherTimer.Tick    += new EventHandler(dispatcherTimer_Tick);
            dispatcherTimer.Interval = new TimeSpan(0, 0, 1);
            dispatcherTimer.Start();
        }
Ejemplo n.º 6
0
 public PagePerfil()
 {
     InitializeComponent();
     Negocio.NPerfil NPerfil     = new Negocio.NPerfil();
     Modelo.Perfil   perfilvazio = new Modelo.Perfil();
     Modelo.Perfil   perfil      = NPerfil.PerfilAleatorio();
     Negocio.NDica.IniciarDicas();
     Negocio.NParticipante NParticipante = new Negocio.NParticipante();
     Modelo.Participante   Mediador      = NParticipante.GetMediador();
     txtMediador.Text  = Mediador.nome + " " + Mediador.placar;
     txtCategoria.Text = perfil.categoria;
     txtPerfil.Text    = perfil.nome;
     JogarRodada();
 }
Ejemplo n.º 7
0
 private void BtnErrado_Click(object sender, RoutedEventArgs e)
 {
     setWrong();
     JogarRodada();
     if (PontosMediador() == 10)
     {
         Negocio.NParticipante NParticipante = new Negocio.NParticipante();
         Modelo.Participante   Mediador      = NParticipante.GetMediador();
         NParticipante.UpdatePontos(Mediador.id, PontosMediador());
         if ((Mediador.placar + PontosMediador()) >= 20)
         {
             Modelo.Participante.SetGanhador(Mediador.nome);
             NavigationService.Navigate(new Uri("/PageVencedor.xaml", UriKind.Relative));
         }
         else
         {
             NavigationService.Navigate(new Uri("/PageMediador.xaml", UriKind.Relative));
         }
     }
 }
Ejemplo n.º 8
0
        private void BtnCerto_Click(object sender, RoutedEventArgs e)
        {
            int pontos = PontosMediador();

            Negocio.NParticipante NParticipante = new Negocio.NParticipante();
            Modelo.Participante   Mediador      = NParticipante.GetMediador();
            Modelo.Participante   JogadorVez    = NParticipante.GetJogadorVez();
            NParticipante.UpdatePontos(JogadorVez.id, 10 - pontos);
            if ((JogadorVez.placar + 10 - pontos) >= 10)
            {
                Modelo.Participante.SetGanhador(JogadorVez.nome);
                NavigationService.Navigate(new Uri("/PageVencedor.xaml", UriKind.Relative));
            }
            NParticipante.UpdatePontos(Mediador.id, pontos);
            if ((Mediador.placar + pontos) >= 10)
            {
                Modelo.Participante.SetGanhador(Mediador.nome);
                NavigationService.Navigate(new Uri("/PageVencedor.xaml", UriKind.Relative));
            }
            if ((JogadorVez.placar + 10 - pontos) < 10 && (Mediador.placar + pontos < 10))
            {
                NavigationService.Navigate(new Uri("/PageMediador.xaml", UriKind.Relative));
            }
        }