예제 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            PnlCreateUser pnl = new PnlCreateUser();
            int           id  = DAOUser.getLastId();

            pnl.updateUserId(id + 1);
            pnl.Show();
            this.Hide();
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Read user
            int          id   = int.Parse(txtUser.Text);
            User         user = DAOUser.readUser(id);
            PnlReadUser1 pnl  = new PnlReadUser1();

            pnl.user = user;
            pnl.updateData();
            pnl.Show();
            this.Hide();
        }
예제 #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            //            int id = int.Parse(txtUser.Text);
            int id     = user.id;
            int result = DAOUser.delete(id);

            if (result > 0)
            {
                MessageBox.Show("Usuario eliminado con éxito.", "Usuario registrado.", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                MessageBox.Show("No se pudo eliminar el registro", "Error de eliminación.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            pnlPadre.Show();
            this.Hide();
        }
예제 #4
0
        private void button1_Click(object sender, EventArgs e)
        {
            string pwd1 = txtPwd.Text.Trim();
            string pwd2 = txtPwd2.Text.Trim();

            int    id       = int.Parse(txtId.Text.Trim());
            string pwd      = ComputeSha1Hash(txtPwd.Text.Trim());
            string name     = txtName.Text.Trim();
            string lastname = txtLastName.Text.Trim();
            string fb       = txtFb.Text.Trim();
            string email    = txtEmail.Text.Trim();
            string tel      = txtEmail.Text.Trim();
            string nickname = txtNickname.Text.Trim();

            User u = new User(id, pwd, name, lastname, fb, email, tel, nickname);

            int result = 0;

            if (pwd1 == "")
            {
                result = DAOUser.updatWithoutPassword(u);
            }
            else
            {
                if (pwd1 == pwd2)
                {
                    result = DAOUser.updateUser(u);
                }
                else
                {
                    MessageBox.Show("Las contraseñas no coinciden.", "Fallo al ingresar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            //Para todas
            if (result > 0)
            {
                MessageBox.Show("Datos actualizados con éxito.", "Actualizaciones", MessageBoxButtons.OK, MessageBoxIcon.Information);
                pnlPadre.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("No se realizó el registro.", "Fallos en actualizaciones", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Crear los objetos
            int    id       = int.Parse(txtId.Text);
            string pwd      = ComputeSha1Hash(txtPwd.Text);
            string name     = txtName.Text;
            string lastname = txtLastName.Text;
            string fb       = txtFb.Text;
            string email    = txtEmail.Text;
            string tel      = txtTel.Text;
            string nickname = txtNickname.Text;

            string pwd1 = txtPwd.Text;
            string pwd2 = txtPwd2.Text;

            if (IsValidEmail(email))
            {
                if (pwd1 == pwd2)
                {
                    //Insertar
                    int result = DAOUser.create(new User(id, pwd, name, lastname, fb, email, tel, nickname));

                    if (result > 0)
                    {
                        MessageBox.Show("Usuario guardado con éxito.", "Usuario registrado.", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        Form1 form = new Form1();
                        form.Show();
                        this.Hide();
                    }
                    else
                    {
                        MessageBox.Show("No se pudo realizar el registro", "Fallo al ingresar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    MessageBox.Show("Las contraseñas no coinciden.", "Error.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }
            else
            {
                MessageBox.Show("El correo es incorrecto", "Error.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            string user = txtUser.Text.Trim();
            int    id   = int.Parse(user);
            string pwd  = txtPwd.Text.Trim();

            string hash     = ComputeSha1Hash(pwd);
            string registro = DAOUser.getPwd(id);

            if (hash == registro)
            {
                //Mostarr el pnl
                User    u   = DAOUser.readUser(id);
                PnlUser pnl = new PnlUser();
                pnl.user = u;
                pnl.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("Usuario o contraseña incorrecta.", "Error Login", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Read repository
            int id = int.Parse(txtUser.Text.Trim());


            //Comprobar si es suyo o si lo compro
            if (DAOUser.getPermisoVista(user.id, id) == true)
            {
                Repository         repo = DAORepository.read(id);
                PnlReadRepository1 pnl  = new PnlReadRepository1();
                pnl.repo     = repo;
                pnl.user     = this.user;
                pnl.pnlPadre = this.pnlPadre;
                pnl.updateData();
                pnl.Show();
                this.Hide();
            }
            else
            {
                //No tienes permiso
                MessageBox.Show("No tienes permisos.", "Fallo al ingresar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }