예제 #1
0
        /// <summary>
        /// sirve para acceder al juego
        /// </summary>
        private void entrar()
        {
            bool correcto = false;

            try
            {
                this.progressRing = true;
                NotifyPropertyChanged("ProgressRing");
                correcto = new ClsManejadoraJugadorBL().ComprobarNickYContraseñaCorrectosBL(this.nickLogIn, this.contraseniaLogIn);
                if (correcto)
                {
                    this.progressRing = false;
                    NotifyPropertyChanged("ProgressRing");
                    acceder();
                }
                else
                {
                    this.progressRing = false;
                    NotifyPropertyChanged("ProgressRing");
                    mensajeErrorNickOContraseniaIncorrectos = "Nick o contraseña incorrectos";
                    NotifyPropertyChanged("MensajeErrorNickOContraseniaIncorrectos");
                }
            }
            catch (Exception)
            {
                //por si no hay conexion o la cadena esta mal puesta
                var dlg = new MessageDialog("Problemas de conexión. Inténtalo más tarde por favor");
                var res = dlg.ShowAsync();
            }
        }
예제 #2
0
        /// <summary>
        /// sirve para registrar a un jugador
        /// </summary>
        private void registrar()
        {
            int exito = 0;

            try
            {
                if (!new ClsManejadoraJugadorBL().ExisteNickDAL(this.nick) && this.nick != null)
                {
                    if (this.contraseña != null && this.segundaContraseña != null && this.contraseña.Equals(this.segundaContraseña))
                    {
                        exito = new ClsManejadoraJugadorBL().RegistrarJugadorBL(this.nick, this.contraseña);
                        this.registradoCorrectamente = "Se ha registrado correctamente";
                        NotifyPropertyChanged("RegistradoCorrectamente");
                        if (exito > 0)
                        {
                            this.nick              = "";
                            this.contraseña        = "";
                            this.segundaContraseña = "";
                            NotifyPropertyChanged("Nick");
                            NotifyPropertyChanged("Contraseña");
                            NotifyPropertyChanged("SegundaContraseña");
                        }
                    }
                    else if (this.contraseña == null || this.segundaContraseña == null)
                    {
                        this.mensajeContraseñasNoCoinciden = "Los campos de las contraseñas son obligatorios";
                        NotifyPropertyChanged("MensajeContraseñasNoCoinciden");
                    }
                    else
                    {
                        this.mensajeContraseñasNoCoinciden = "Las contraseñas no coinciden";
                        NotifyPropertyChanged("MensajeContraseñasNoCoinciden");
                    }
                }
                else if (this.nick == null)
                {
                    this.mensajeNickExiste = "El campo nick es obligatorio";
                    NotifyPropertyChanged("MensajeNickExiste");

                    if (this.contraseña == null || this.segundaContraseña == null)
                    {
                        this.mensajeContraseñasNoCoinciden = "Las contraseñas son obligatorios";
                        NotifyPropertyChanged("MensajeContraseñasNoCoinciden");
                    }
                }
                else
                {
                    this.mensajeNickExiste = "El nick ya exitse";
                    NotifyPropertyChanged("MensajeNickExiste");
                }
            }
            catch (Exception)
            {
                //por si no hay conexion o la cadena esta mal puesta
                var dlg = new MessageDialog("Problemas de conexión. Inténtalo más tarde por favor");
                var res = dlg.ShowAsync();
            }
        }
예제 #3
0
        public ClsProgresoVM(string nick)
        {
            try
            {
                if (nick != null)
                {
                    this.nick = nick;
                }

                int id = new ClsManejadoraJugadorBL().ObtenerIdJugadorPorNickDAL(this.nick);
                this.listadoProgresosPorJugador = new ClsListadoProgresosBL().ObtenerProgresosPorJugadorBL(id);

                if (this.listadoProgresosPorJugador.Count == 0)
                {
                    var dlg = new MessageDialog("No has hecho ningún progreso aún");
                    var res = dlg.ShowAsync();
                }
            }
            catch (SqlException)
            {
                var dlg = new MessageDialog("Problemas de conexión. Inténtalo más tarde por favor");
                var res = dlg.ShowAsync();
            }
        }