private void btnActualizar_Click(object sender, EventArgs e)
        {
            DialogResult Result = MessageBox.Show("¿DESEA GUARDAR LOS CAMBIOS?", "PREGUNTA", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (Result == DialogResult.No)
            {
                return;
            }

            string NumCel = txtNumCel.Text;
            string Dir    = txtDir.Text;
            string Cont   = txtContraseña.Text;

            if (Utileria.ValidaTextoNum(NumCel))
            {
                MessageBox.Show("EN ESTE CAMPO SOLO SE ACEPTAN NUMEROS", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (!(Utileria.IsEmpty(NumCel)))
            {
                AdmEmp.UpdateCel(IDEmp, NumCel);
                MessageBox.Show("NÚMERO CELULAR ACTUALIZADO", "CONFIRMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (!(Utileria.IsEmpty(Dir)))
            {
                AdmEmp.UpdateDir(IDEmp, Dir);
                MessageBox.Show("DIRECCIÓN ACTUALIZADA", "CONFIRMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            if (!(Utileria.IsEmpty(Cont)))
            {
                AdmEmp.UpdatePass(IDEmp, Cont);
                MessageBox.Show("CONTRASEÑA ACTUALIZADA", "CONFIRMACIÓN", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            Limpiar();
        }
Ejemplo n.º 2
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            DialogResult Result = MessageBox.Show("¿DESEA GUARDAR LOS CAMBIOS?", "PREGUNTA", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (Result == DialogResult.No)
            {
                return;
            }

            string NumCel = txtNumCel.Text;
            string Dir    = txtDir.Text;

            if (Utileria.ValidaTextoNum(NumCel))
            {
                MessageBox.Show("EN ESTE CAMPO SOLO SE ACEPTAN NUMEROS", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Utileria.IsEmpty(NumCel))
            {
                MessageBox.Show("NO SE ACEPTAN CAMPOS VACIOS", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (Utileria.IsEmpty(Dir))
            {
                MessageBox.Show("NO SE ACEPTAN CAMPOS VACIOS", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            AdmEmp.UpdateCel(IDEmp, NumCel);
            AdmEmp.UpdateDir(IDEmp, Dir);
            Limpiar();
        }
Ejemplo n.º 3
0
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            DialogResult Result = MessageBox.Show("¿DESEA GUARDAR LOS CAMBIOS?", "PREGUNTA", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (Result == DialogResult.No)
            {
                return;
            }

            int    ID     = AdmEmp.GetIDName(cmbEncargado.SelectedItem.ToString());
            string Nombre = txtNombre.Text;
            string NumCel = txtNumCel.Text;
            string Email  = txtEmail.Text;
            string Dir    = txtDir.Text;


            if (!(Utileria.IsEmpty(Nombre)))
            {
                AdmEmp.UpdateNom(ID, Nombre);
            }
            if (!(Utileria.IsEmpty(NumCel)))
            {
                AdmEmp.UpdateCel(ID, NumCel);
            }
            if (!(Utileria.IsEmpty(Email)))
            {
                AdmEmp.UpdateEmail(ID, Email);
            }
            if (!(Utileria.IsEmpty(Dir)))
            {
                AdmEmp.UpdateDir(ID, Dir);
            }
            if (cmbRol.SelectedIndex >= 0)
            {
                SqlConnection Connection = UsoBD.ConectaBD(Utileria.GetConnectionString());
                int           Rol        = 0;

                if (Connection == null)
                {
                    MessageBox.Show("ERROR DE CONEXIÓN CON LA BASE DE DATOS");

                    foreach (SqlError E in UsoBD.ESalida.Errors)
                    {
                        MessageBox.Show(E.Message);
                    }
                    return;
                }
                SqlDataReader Lector = null;

                string strComandoC = "SELECT ID FROM ROL WHERE NOMBRE LIKE '" + cmbRol.SelectedItem.ToString() + "'";

                Lector = UsoBD.Consulta(strComandoC, Connection);
                if (Lector == null)
                {
                    MessageBox.Show("ERROR AL HACER LA CONSULTA");
                    foreach (SqlError E in UsoBD.ESalida.Errors)
                    {
                        MessageBox.Show(E.Message);
                    }

                    Connection.Close();
                    return;
                }
                if (Lector.HasRows)
                {
                    while (Lector.Read())
                    {
                        Rol = Convert.ToInt32(Lector.GetValue(0).ToString());
                    }
                }
                Connection.Close();

                AdmEmp.UpdateRolID(ID, Rol);
            }
            if (cmbDep.SelectedIndex >= 0)
            {
                int DepID = AdmDept.GetID(cmbDep.SelectedItem.ToString());
                AdmDept.UpdateDep(ID, DepID);
            }
            MessageBox.Show("EMPLEADO ACTUALIZADO EXITOSAMENTE", "AVISO", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }