private void btnAgregar_Click(object sender, EventArgs e) { if (txtNombre.Text != "" && cbCarrera.SelectedIndex != -1) { string estado = ""; if (cbCarrera.SelectedIndex == 0) { estado = "Activo"; } else { if (cbCarrera.SelectedIndex == 1) { estado = "Inactivo"; } } bool success = proyecto.agregarProyecto(txtNombre.Text, estado); if (success) { VentanasEmergentes.Satisfactorio satisfactorio = new VentanasEmergentes.Satisfactorio("El proyecto ha sido guardado con éxito"); satisfactorio.Show(); } else { VentanasEmergentes.VentanaError error = new VentanasEmergentes.VentanaError("Ha ocurrido un problema"); error.Show(); } limpiar(); } else { VentanasEmergentes.VentanaError ventana = new VentanasEmergentes.VentanaError("Tiene que completar todos los espacios para poder agregar el proyecto"); ventana.Show(); } }
private void btnEditar_Click(object sender, EventArgs e) { if (txtNombre.Text != "" && txtApellido1.Text != "" && txtApellido2.Text != "" && txtEmail.Text != "" && txtTelefono.Text != "" && txtCarne.Text != "" && txtCedula.Text != "" && cbCarrera.SelectedIndex != -1) { bool success = empleado.editarPerfil(txtNombre.Text, txtApellido1.Text, txtApellido2.Text, txtEmail.Text, this.asistente.usuarioActual, cbCarrera.Text, txtCarne.Text, txtCedula.Text, txtTelefono.Text); if (success) { VentanasEmergentes.Satisfactorio satisfactorio = new VentanasEmergentes.Satisfactorio("El perfil se ha editado con éxito"); satisfactorio.Show(); this.asistente.usuarioActual = txtEmail.Text; this.asistente.cargarInicio(); this.asistente.cargarPerfil(); } else { VentanasEmergentes.VentanaError error = new VentanasEmergentes.VentanaError("Ha ocurrido un problema"); error.Show(); } limpiar(); } else { VentanasEmergentes.VentanaError ventana = new VentanasEmergentes.VentanaError("Tiene que completar todos los espacios para poder editar el perfil."); ventana.Show(); } }
private void btnNombrar_Click(object sender, EventArgs e) { Console.WriteLine(cbEntidad.Text); if (txtID.Text != "" && cbEntidad.SelectedIndex != -1 && cbAsistentes.SelectedIndex != -1 && cbTipoAsistente.SelectedIndex != -1 && txtCantidadHoras.Text != "" && cbPeriodo.SelectedIndex != -1) { string[] periodo = cbPeriodo.Text.Split(' '); string ciclo = periodo[0]; int anno = Int32.Parse(periodo[1]); bool success = empleado.agregarNombramiento(cbAsistentes.Text, txtID.Text, ciclo, anno, Int32.Parse(txtCantidadHoras.Text), cbEntidad.Text, Int32.Parse(cbTipoAsistente.Text)); if (success) { VentanasEmergentes.Satisfactorio satisfactorio = new VentanasEmergentes.Satisfactorio("El nombramiento ha sido guardado con éxito"); satisfactorio.Show(); } else { VentanasEmergentes.VentanaError error = new VentanasEmergentes.VentanaError("Ha ocurrido un problema"); error.Show(); } limpiar(); } else { VentanasEmergentes.VentanaError ventana = new VentanasEmergentes.VentanaError("Tiene que completar todos los espacios para poder agregar el nombramiento"); ventana.Show(); } }
private void btnAgregar_Click(object sender, EventArgs e) { string nombre = txtNombre.Text; string apellido1 = txtApellido1.Text; string apellido2 = txtApellido2.Text; string cedula = txtCedula.Text; string carne = txtCarne.Text; string email = txtEmail.Text; string carrera = cbCarrera.Text; string password1 = txtPassword1.Text; string password2 = txtPassword2.Text; string sexo = "M"; if (email != "" && password1 != "" && nombre != "" && apellido1 != "" && apellido2 != "" && carne != "" && cedula != "" && carrera != "" && txtHorasAcumuladas.Text != "") { int horasAcumuladas1 = Int32.Parse(txtHorasAcumuladas.Text); if (rbF.Checked == true) { sexo = "F"; } else if (rbO.Checked == true) { sexo = "O"; } if (password1 == password2) { bool success = empleado.agregarAsistentes(email, password1, nombre, apellido1, apellido2, carne, cedula, carrera, "83096579", horasAcumuladas1, sexo); if (success) { VentanasEmergentes.Satisfactorio exito = new VentanasEmergentes.Satisfactorio("El asistente fue agregado satisfactoriamente"); exito.Show(); } else { VentanasEmergentes.VentanaError error = new VentanasEmergentes.VentanaError("Ha ocurrido un error."); error.Show(); } } else { VentanasEmergentes.VentanaError mismatch = new VentanasEmergentes.VentanaError("Las contraseñas no coinciden."); mismatch.Show(); } } cleanTextFields(); }
private void btnCambiarContraseña_Click(object sender, EventArgs e) { lblError.Visible = false; if (txtPassword.Text != "" && txtPasswordConfirmarcion.Text != "") { string password1 = txtPassword.Text; string passwordConfi = txtPasswordConfirmarcion.Text; if (password1 == passwordConfi) { bool retorno = empleado.cambiarPassword(this.asistente.usuarioActual, password1); if (retorno == true) { VentanasEmergentes.Satisfactorio mensaje = new VentanasEmergentes.Satisfactorio("La contraseña ha sido cambiada con éxito"); mensaje.Show(); txtPassword.Clear(); txtPasswordConfirmarcion.Clear(); } else { VentanasEmergentes.VentanaError mensaje = new VentanasEmergentes.VentanaError("La contraseña no ha sido cambiada"); mensaje.Show(); } } else { lblError.Visible = true; lblError.Text = "Las contraseñas ingresadas no coinciden"; } } else { VentanasEmergentes.VentanaError ventanaError = new VentanasEmergentes.VentanaError("Hay espacios vacíos, por favor complételos"); ventanaError.StartPosition = FormStartPosition.Manual; ventanaError.Location = new Point(this.ClientSize.Width / 2, this.ClientSize.Height / 2); ventanaError.Show(); } }