private bool ValidarInscripcion() { bool flag = true; MyErrorInscripcion.Clear(); if (String.IsNullOrWhiteSpace(ComentarioTextBox.Text)) { MyErrorInscripcion.SetError(ComentarioTextBox, "El campo Comentario no puede estar vacío."); flag = false; } else { if (ComentarioTextBox.Text.Count() > MAXCOMENTARIO) { MyErrorInscripcion.SetError(ComentarioTextBox, "El campo Comentario no puede tener más " + MAXCOMENTARIO + " caracteres."); flag = false; } } if (String.IsNullOrWhiteSpace(DepositoTextBox.Text)) { MyErrorInscripcion.SetError(DepositoTextBox, "El campo Deposito no puede estar vacío."); flag = false; } else { try { decimal deposito = Convert.ToDecimal(DepositoTextBox.Text); } catch (FormatException error) { MyErrorInscripcion.SetError(DepositoTextBox, "El campo Deposito debe tener numeros."); flag = false; } } if (String.IsNullOrWhiteSpace(MontoTextBox.Text)) { MyErrorInscripcion.SetError(MontoTextBox, "El campo Monto no puede estar vacío."); flag = false; } else { try { decimal monto = Convert.ToDecimal(MontoTextBox.Text); } catch (FormatException error) { MyErrorInscripcion.SetError(MontoTextBox, "El campo Monto debe tener numeros."); flag = false; } } return(flag); }
private void LimpiarCamposInscripcion() { EstudianteIDNumericUpDown.Enabled = true; InscripcionIDNumericUpDown.Value = 0; FechaDateTimePicker.Value = DateTime.Now; EstudianteIDNumericUpDown.Value = 0; ComentarioTextBox.Text = string.Empty; MontoTextBox.Text = string.Empty; DepositoTextBox.Text = string.Empty; BalanceTextBox.Text = string.Empty; MyErrorInscripcion.Clear(); }
private void EliminarButton_Click(object sender, EventArgs e) { MyErrorInscripcion.Clear(); int id; id = Convert.ToInt32(InscripcionIDNumericUpDown.Value); int idEstudiante = Convert.ToInt32(EstudianteIDNumericUpDown.Value); LimpiarCamposInscripcion(); if (InscripcionBLL.Eliminar(id, idEstudiante)) { MessageBox.Show("Balance de Inscripción Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("No se puede eliminar, porque no existe."); } }