예제 #1
0
 private void btnGUARDAR_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txtPASSWORD.Text))
     {
         MessageBox.Show("Debe ingresar la nueva contraseña del usuario", "ATENCION!!");
         return;
     }
     if (txtPASSWORD.Text != txtPASSWORD2.Text)
     {
         MessageBox.Show("Las contraseñas ingresadas no coinciden", "ATENCION!!");
         return;
     }
     oUSUARIO.CLAVE          = CONTROLADORA.funciones_compartidas.EncriparClave(txtPASSWORD.Text);
     oUSUARIO.RESETEAR_CLAVE = chkRESETEAR_CLAVE.Checked;
     cUSUARIOS.MODIFICAR_USUARIO(oUSUARIO);
     if (chkEMAIL.Checked)
     {
         if (CONTROLADORA.funciones_compartidas.EnviarEmail(txtEMAIL.Text, "CAMBIO DE CONTRASEÑA", "Estimado " + oUSUARIO.NOMBRE + ":\n Por medio del presente le enviamos su nueva contraseña de acceso al sistema.\n La misma es: " + txtPASSWORD.Text + ". \n Atte.\nAdministrador del Sistema", ""))
         {
             MessageBox.Show("Se ha enviado la nueva contraseña por correo electrónico", "EMAIL", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
         else
         {
             MessageBox.Show("NO se ha enviado la nueva contraseña por correo electrónico. Revise la configuración del sistema", "EMAIL", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
 }
예제 #2
0
        private void btnGUARDAR_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNOMBRE_USUARIO.Text))
            {
                MessageBox.Show("Debe ingresar el nombre de usuario para el acceso al sistema", "ATENCION!!");
                return;
            }

            if (cUSUARIOS.VALIDA_NOMBRE_USUARIO(txtNOMBRE_USUARIO.Text, oUSUARIO.CODIGO))
            {
                MessageBox.Show("El nombre de usuario para el acceso al sistema ya se encuentra asignado a otro usuario", "ATENCION!!");
                return;
            }
            if (string.IsNullOrEmpty(txtNOMBRE.Text))
            {
                MessageBox.Show("Debe ingresar el nombre del usuario", "ATENCION!!");
                return;
            }
            if (string.IsNullOrEmpty(txtEMAIL.Text))
            {
                MessageBox.Show("Debe ingresar el email del usuario", "ATENCION!!");
                return;
            }
            if (!CONTROLADORA.funciones_compartidas.ValidarEmail(txtEMAIL.Text))
            {
                MessageBox.Show("El email ingresado no tiene el formato correcto", "ATENCION!!");
                return;
            }
            if (cUSUARIOS.VALIDA_EMAIL_USUARIO(txtEMAIL.Text, oUSUARIO.CODIGO))
            {
                MessageBox.Show("El email ingresado ya se encuentra asignado a otro usuario", "ATENCION!!");
                return;
            }
            if (string.IsNullOrEmpty(txtTELEFONO.Text))
            {
                MessageBox.Show("Debe ingresar el telefono del usuario", "ATENCION!!");
                return;
            }

            oUSUARIO.NOMBRE_USUARIO = txtNOMBRE_USUARIO.Text;
            oUSUARIO.NOMBRE         = txtNOMBRE.Text;
            oUSUARIO.EMAIL          = txtEMAIL.Text;
            oUSUARIO.TELEFONO       = txtTELEFONO.Text;
            oUSUARIO.IMAGEN         = lblIMAGEN.Text;
            CONTROLADORA.funciones_compartidas.copiar_archivo(lblDIR_IMAGEN.Text, lblIMAGEN.Text);
            cUSUARIOS.MODIFICAR_USUARIO(oUSUARIO);

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
예제 #3
0
        private void btnGUARDAR_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txtNOMBRE_USUARIO.Text))
            {
                MessageBox.Show("Debe ingresar el nombre de usuario para el acceso al sistema", "ATENCION!!");
                return;
            }
            int codigo_usuario;

            if (!int.TryParse(txtCODIGO.Text, out codigo_usuario))
            {
                codigo_usuario = 0;
            }

            if (cUSUARIOS.VALIDA_NOMBRE_USUARIO(txtNOMBRE_USUARIO.Text, codigo_usuario))
            {
                MessageBox.Show("El nombre de usuario para el acceso al sistema ya se encuentra asignado a otro usuario", "ATENCION!!");
                return;
            }
            if (string.IsNullOrEmpty(txtNOMBRE.Text))
            {
                MessageBox.Show("Debe ingresar el nombre del usuario", "ATENCION!!");
                return;
            }
            if (string.IsNullOrEmpty(txtEMAIL.Text))
            {
                MessageBox.Show("Debe ingresar el email del usuario", "ATENCION!!");
                return;
            }
            if (!CONTROLADORA.funciones_compartidas.ValidarEmail(txtEMAIL.Text))
            {
                MessageBox.Show("El email ingresado no tiene el formato correcto", "ATENCION!!");
                return;
            }
            if (cUSUARIOS.VALIDA_EMAIL_USUARIO(txtEMAIL.Text, codigo_usuario))
            {
                MessageBox.Show("El email ingresado ya se encuentra asignado a otro usuario", "ATENCION!!");
                return;
            }
            if (string.IsNullOrEmpty(txtTELEFONO.Text))
            {
                MessageBox.Show("Debe ingresar el telefono del usuario", "ATENCION!!");
                return;
            }

            oUSUARIO.NOMBRE_USUARIO = txtNOMBRE_USUARIO.Text;
            oUSUARIO.NOMBRE         = txtNOMBRE.Text;
            oUSUARIO.EMAIL          = txtEMAIL.Text;
            oUSUARIO.TELEFONO       = txtTELEFONO.Text;
            oUSUARIO.ACTIVO         = chkEstado.Checked;
            oUSUARIO.IMAGEN         = lblIMAGEN.Text;
            if (lblIMAGEN.Text == "") //Selecciona imagen por defecto
            {
                oUSUARIO.IMAGEN = "272.png";
            }
            else
            {
                CONTROLADORA.funciones_compartidas.copiar_archivo(lblDIR_IMAGEN.Text, lblIMAGEN.Text);
            }

            if (ACCION == "A")
            {
                oUSUARIO.CLAVE          = CONTROLADORA.funciones_compartidas.EncriparClave(txtNOMBRE_USUARIO.Text);
                oUSUARIO.RESETEAR_CLAVE = true;
                cUSUARIOS.AGREGAR_USUARIO(oUSUARIO);
                CONTROLADORA.funciones_compartidas.EnviarEmail(oUSUARIO.EMAIL, "Nueva clave", "Su clave es: ", "");
            }
            else
            {
                cUSUARIOS.MODIFICAR_USUARIO(oUSUARIO);
            }

            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }