Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Validar usuario
            string usuario    = textBox1.Text;
            string contrasena = textBox2.Text;

            Practica2.ServiceReference4.Service1Client try1 = new  Practica2.ServiceReference4.Service1Client();
            Practica2.ServiceReference4.Usuario        returnString;
            returnString = try1.buscarUsuario(usuario);

            if (returnString == null)
            {
                this.errorLabel.Text    = "Usuario Invalido";
                this.errorLabel.Visible = true;
            }
            else
            {
                if (returnString.Pass == contrasena)
                {
                    this.logged        = 1;
                    this.usuarioActual = returnString;
                    this.Close();
                }
                else
                {
                    this.errorLabel.Text    = "Contraseña Invalida";
                    this.errorLabel.Visible = true;
                }
            }

            /*foreach(Usuario u in listaUsuarios)
             * {
             *  if (u.pass == contrasena && u.user == usuario)
             *  {
             *      this.logged = 1;
             *      this.usuarioActual = u;
             *      this.Close();
             *      break;
             *
             *  }
             * }*/

            if (this.logged == 0)
            {
                this.errorLabel.Text    = "Data Incorrecta";
                this.errorLabel.Visible = true;
            }
        }
Пример #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Validar usuario
            string usuario = textBox1.Text;
            string contrasena = textBox2.Text;
            Practica2.ServiceReference4.Service1Client try1 =new  Practica2.ServiceReference4.Service1Client();
            Practica2.ServiceReference4.Usuario returnString;
            returnString = try1.buscarUsuario(usuario);

            if (returnString == null)
            {
                this.errorLabel.Text = "Usuario Invalido";
                this.errorLabel.Visible = true;
            }
            else
            {
                if (returnString.Pass == contrasena)
                {
                    this.logged = 1;
                    this.usuarioActual = returnString;
                    this.Close();

                }
                else
                {
                    this.errorLabel.Text = "Contraseña Invalida";
                    this.errorLabel.Visible = true;
                }
            }

            /*foreach(Usuario u in listaUsuarios)
            {
                if (u.pass == contrasena && u.user == usuario)
                {
                    this.logged = 1;
                    this.usuarioActual = u;
                    this.Close();
                    break;

                }
            }*/

            if (this.logged == 0)
            {
                this.errorLabel.Text = "Data Incorrecta";
                this.errorLabel.Visible = true;
            }
        }