private void EliminarButton_Click(object sender, EventArgs e) { MyErrorProvider.Clear(); int id; int.TryParse(IdnumericUpDown.Text, out id); if (IdnumericUpDown.Value == 0) { MyErrorProvider.SetError(IdnumericUpDown, "El campo ID no puede estar vacio"); IdnumericUpDown.Focus(); } else { if (!ExisteEnLaBaseDeDatos()) { MessageBox.Show("No se puede Eliminar un Paciente que no existe", "Fallo", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (PacienteBLL.Eliminar(id)) { MessageBox.Show("Paciente Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); Limpiar(); } else { MyErrorProvider.SetError(IdnumericUpDown, "Id no Existe"); } } }
private bool ValidarEliminar() { bool paso = true; MyerrorProvider.Clear(); if (IdnumericUpDown.Value == 0) { MyerrorProvider.SetError(IdnumericUpDown, "Debes de introducir un ID"); IdnumericUpDown.Focus(); paso = false; } return(paso); }
private bool Validar() { bool paso = true; MyErrorProvider.Clear(); if (IdnumericUpDown.Value == 0) { MyErrorProvider.SetError(IdnumericUpDown, "El campo Id no puede estar vacio"); IdnumericUpDown.Focus(); paso = false; } if (NombreTextBox.Text == string.Empty) { MyErrorProvider.SetError(NombreTextBox, "El campo Nombre no puede estar vacio"); NombreTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(EmailTextBox.Text)) { MyErrorProvider.SetError(EmailTextBox, "El campo Email no puede estar vacio"); EmailTextBox.Focus(); paso = false; } if (UserradioButton.Checked == false && AdminradioButton.Checked == false) { MyErrorProvider.SetError(NivelUsergroupBox, "Debe elegir un tipo de usuario"); NivelUsergroupBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(UsuarioTextBox.Text)) { MyErrorProvider.SetError(UsuarioTextBox, "El campo Cedula no puede estar vacio"); UsuarioTextBox.Focus(); paso = false; } if (string.IsNullOrWhiteSpace(ClaveTextBox.Text)) { MyErrorProvider.SetError(ClaveTextBox, "El campo Clave no puede estar vacio"); ClaveTextBox.Focus(); paso = false; } return(paso); }
private bool VEliminar() { bool paso = true; MyErrorProvider.Clear(); if (IdnumericUpDown.Value == 0) { MyErrorProvider.SetError(IdnumericUpDown, "Debe introducir un id para poder eliminar un producto"); IdnumericUpDown.Focus(); paso = false; } return(paso); }
private void Limpiar() { usuario = null; listaRelaciones = new List <PermisosDetalles>(); listPermisos = new List <Entidades.Permisos>(); nombreUsuarioTextBox.Clear(); IdnumericUpDown.ResetText(); passUsuarioTextBox.Clear(); nombreUsuarioTextBox.Focus(); TipoComboBox.Text = null; dataGridView1.DataSource = null; errorProviderTodo.Clear(); }
private void AgregarenelGridbutton_Click(object sender, EventArgs e) { if (DetalledataGridView.DataSource != null) { this.Horarios = (List <Horarios>)DetalledataGridView.DataSource; } this.Horarios.Add( new Horarios( fechaHorario: (DateTime)HorarioDelEmpleadodateTimePicker.Value, SalidaHorario: (DateTime)HorarioSalidadateTimePicker.Value, HorasExtrasCantidad: (int)CantidadHorasExtrasnumericUpDown.Value, HorasExtrasPrecio: (int)PrecioPorHorasnumericUpDown.Value )); CargarGrid(); IdnumericUpDown.Focus(); }
private void Eliminarbutton_Click(object sender, EventArgs e) { RepositorioBase <Inscripcion> db = new RepositorioBase <Inscripcion>(); Limpiar(); if (IdnumericUpDown.Value > 0) { if (InscripcionBLL.Eliminar((int)IdnumericUpDown.Value)) { MessageBox.Show("Eliminado"); } else { MyerrorProvider.SetError(IdnumericUpDown, "No se puede elimina, porque no existe"); } } else { MyerrorProvider.SetError(IdnumericUpDown, "Selecione a quien quiere eliminar"); IdnumericUpDown.Focus(); } }
private void Eliminarbutton_Click(object sender, EventArgs e) { RepositorioBase <Asignaturas> rp = new RepositorioBase <Asignaturas>(); if (IdnumericUpDown.Value > 0) { if (rp.Eliminar((int)IdnumericUpDown.Value)) { MessageBox.Show("Eliminado", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MyErrorProvider.SetError(IdnumericUpDown, "No se puede eliminar que no existe"); } } else { MyErrorProvider.SetError(IdnumericUpDown, "Selecione a que asignatura eliminar"); IdnumericUpDown.Focus(); } Limpiar(); }