示例#1
0
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            if (txtapellido.MaxLength > 50 || txtnombre.MaxLength > 50)
            {
                MessageBox.Show("Cantidad de Caracteres excedida!");
                txtcontra.Clear();
                txtccontra.Clear();
                txtapellido.Clear();
                txtnombre.Clear();
                txtusu.Clear();
            }
            else
            {
                string usuario = bd.selectstring("select  usuario from login where usuario = '" + txtusu.Text + "'");
                if (usuario == txtusu.Text)
                {
                    MessageBox.Show("Este Usuario ya ha sido registrado, porfavor elija otro nombre de usuario.");
                }
                else
                {
                    if (rbnfem.Checked)
                    {
                        genero = "femenino";
                    }
                    if (rbnmas.Checked)
                    {
                        genero = "masculino";
                    }
                    if (image64 == null)
                    {
                        MessageBox.Show("Porfavor debe usar una imagen como muestra de su perfil, selecciona una imagen.");
                    }
                    encriptar en      = new encriptar();
                    DateTime  d       = Convert.ToDateTime(dateTimePicker1.Text);
                    string    agregar = "insert login (usuario, contraseña, nombre, apellido, genero, fech, img) values ('" + txtusu.Text + "','" + en.encripta(txtcontra.Text) + "','" + txtnombre.Text + "','" +
                                        txtapellido.Text + "','" + genero + "','" + d + "','" + image64 + "')";

                    if (txtcontra.Text == txtccontra.Text & CheckBox1.Checked == true)
                    {
                        if (bd.executecommand(agregar))
                        {
                            MessageBox.Show("Usted ha sido registrado correctamente, está apto para Adoptar.");
                            this.Hide();
                            Login l = new Login();
                            l.Show();
                        }
                        else
                        {
                            MessageBox.Show("Error al agregar, porfavor reporte su error para solucionarlo.");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Las contraseñas no coinciden o los términos no han sido aceptados.");
                        txtcontra.Clear();
                        txtccontra.Clear();
                    }
                }
            }
        }
示例#2
0
        private void materialRaisedButton1_Click(object sender, EventArgs e)
        {
            encriptar en         = new encriptar();
            string    usuario    = bd.selectstring("select  usuario from login where usuario = '" + txtusu.Text + "'");
            string    contraseña = bd.selectstring("select contraseña from login where contraseña = '" + en.encripta(txtcontra.Text) + "'");
            int       id_usuario = Int32.Parse(bd.selectstring("select id_usuario from login where usuario = '" + txtusu.Text + "'"));

            if (usuario == txtusu.Text && contraseña == en.encripta(txtcontra.Text))
            {
                string nombre   = bd.selectstring("select nombre from login where usuario = '" + txtusu.Text + "'");
                string apellido = bd.selectstring("select apellido from login where usuario = '" + txtusu.Text + "'");
                string image    = bd.selectstring("select img from login where usuario = '" + txtusu.Text + "'");
                Panel  p        = new Panel(id_usuario);
                p.pictureBox36.Image   = Base64ToImage(image);
                p.materialLabel16.Text = nombre + " " + apellido;
                p.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("El Usuario o Contraseña ingresados son incorrectos.");
            }
        }