private void btnRegistrarCurso_Click(object sender, EventArgs e)
        {
            int    estadoCurso;
            String nombreCurso;
            double precio;

            if (txtNombreCurso.Text == String.Empty)
            {
                messageError.lblError.Text = "INGRESE UN NOMBRE DE CURSO";
                messageError.ShowDialog();
            }
            else if (txtPrecio.Text == String.Empty)
            {
                messageError.lblError.Text = "INGRESE UN PRECIO";
                messageError.ShowDialog();
            }
            else if (utilidad.isNumeric(txtPrecio.Text))
            {
                nombreCurso = txtNombreCurso.Text;
                precio      = double.Parse(txtPrecio.Text);
                estadoCurso = 1;

                dbConn.PARegistroCursos(nombreCurso, precio, estadoCurso);

                message.lblCheck.Text = "CURSO REGISTRADO";
                message.ShowDialog();

                txtNombreCurso.Clear();
                txtPrecio.Clear();

                actualizarDGV();
            }
            else if (dbConn.obtenerVariableEntera("select [estadoCurso] from [dbo].[cursos]c inner join [dbo].[estados]e on c.estadoCurso = e.id_Estado where [estadoCurso] = 1 and [nombreCurso] = '" + txtNombreCurso.Text + "'") == 1)
            {
                messageError.lblError.Text = "EL CURSO YA EXISTE";
                messageError.ShowDialog();

                utilidad.limpiarTextBox(grbPrincipal);
            }
            else if (dbConn.obtenerVariableEntera("select [estadoCurso] from [dbo].[cursos]c inner join [dbo].[estados]e on c.estadoCurso = e.id_Estado where [estadoCurso] = 2 and [nombreCurso] = '" + txtNombreCurso.Text + "'") == 2)
            {
                estadoCurso = 1;

                dbConn.ejecutarComandoSQL("update [dbo].[cursos] set [estadoCurso] = '" + estadoCurso + "' where [nombreCurso] = '" + txtNombreCurso.Text + "'");

                message.lblCheck.Text = "CURSO REGISTRADO";
                message.ShowDialog();

                utilidad.limpiarTextBox(grbPrincipal);

                actualizarDGVInac();
            }
            else
            {
                messageError.lblError.Text = "INGRESE CORRECTAMENTE LOS DATOS SOLICITADOS";
                messageError.ShowDialog();
            }
        }
        public void EliminarEncargado()
        {
            if (dbConn.ComprobarExistencia("select estado from datosEncargado where identidadEncargado = '" + txtIdentidad.Text + "'"))
            {
                dbConn.ejecutarComandoSQL("update datosEncargado set estado = 2 where identidadEncargado = '" + txtIdentidad.Text + "'");

                message.lblCheck.Text = "ENCARGADO ELIMINADO";
                message.ShowDialog();
            }
            else
            {
                messageError.lblError.Text = "ENCARGADO NO ENCONTRADO";
                messageError.ShowDialog();
            }
        }
Example #3
0
        private void btnFinalizar_Click(object sender, EventArgs e)
        {
            DateTime dateTime;

            if (txtCorreoRecuperacion.Text != string.Empty && txtContraseRecuperacion.Text != string.Empty && txtHost.Text != string.Empty && txtPuerto.Text != string.Empty && utilidad.isNumeric(txtPuerto.Text))
            {
                if (utilidad.verificarCorreo(txtCorreoRecuperacion.Text))
                {
                    messageYesNo.lblError.Text      = "¿HA REVISADO SUS DATOS \r\nY DESEA CONTINUAR?";
                    messageYesNo.lblError.TextAlign = ContentAlignment.MiddleCenter;
                    messageYesNo.ShowDialog();

                    if (IMessageBoxYesCancel.isCodigoForm == true)
                    {
                        if (utilidad.enviarCorreo(" < h1 > VERIFICACI & Oacute; N DE CORREO ELECTR&Oacute; NICO </ h1 > ", txtCorreoRecuperacion.Text, txtCorreoRecuperacion.Text, txtContraseRecuperacion.Text, txtHost.Text, Convert.ToInt32(txtPuerto.Text)) == true)
                        {
                            if (dbConn.PAOperacionEmpleado(txtIdentid, txtNombre1.Text, txtNombre2.Text, txtApellido1.Text, txtApellido2.Text, Convert.ToInt32(txtTel.Text), txtFechaNa.Text,
                                                           txtCorreo.Text, 1, utilidad.EncriptarTexto(txtConfirmContra.Text), 1, -1, 1))
                            {
                                try
                                {
                                    dbConn.ejecutarComandoSQL("INSERT INTO informacionCorreoRecuperacion VALUES('" + txtCorreoRecuperacion.Text + "', '" + utilidad.EncriptarTexto(txtContraseRecuperacion.Text) + "' " +
                                                              ", '" + txtHost.Text + "', '" + Convert.ToInt32(txtPuerto.Text) + "')");
                                    messageOk.lblCheck.Text = "REGISTRADO CORRECTAMENTE";
                                    messageOk.ShowDialog();
                                    this.Close();
                                }
                                catch
                                {
                                    message.lblError.Text      = "ERROR";
                                    message.lblError.Location  = new Point(140, 85);
                                    message.lblError.TextAlign = ContentAlignment.MiddleCenter;
                                    message.ShowDialog();
                                }
                            }
                        }
                        else
                        {
                            message.lblError.Text      = "CREDENCIALES DE CORREO \r\nELECTRONICO INCORRECTAS";
                            message.lblError.Location  = new Point(105, 75);
                            message.lblError.TextAlign = ContentAlignment.MiddleCenter;
                            message.ShowDialog();
                        }
                    }
                }
                else
                {
                    message.lblError.Text      = "VERIFIQUE\n\r CORREO ELECTRÓNICO";
                    message.lblError.TextAlign = ContentAlignment.MiddleCenter;
                    message.lblError.Location  = new Point(130, 75);
                    message.ShowDialog();
                }
            }
            else
            {
                message.lblError.Text     = "VERIFIQUE LOS VALORES";
                message.lblError.Location = new Point(130, 82);
                message.ShowDialog();
            }
        }