public void Listar_Vacunas(int serie_mascota) { List<Vacuna> lista_vacuna = new NVacuna().N_Listar_Vacunas(serie_mascota); this.grilla_vacuna.Rows.Clear(); for (int i = 0; i < lista_vacuna.Count; i++) { int reglon = this.grilla_vacuna.Rows.Add(); this.grilla_vacuna.Rows[reglon].Cells["ID_VACUNA"].Value = lista_vacuna[i].Id.ToString(); this.grilla_vacuna.Rows[reglon].Cells["NUMERO_VACUNA"].Value = lista_vacuna[i].Numero_vacuna; this.grilla_vacuna.Rows[reglon].Cells["FECH_VACUNA"].Value = lista_vacuna[i].Fecha.ToShortDateString(); this.grilla_vacuna.Rows[reglon].Cells["OBSERVACION"].Value = lista_vacuna[i].Observacion; this.grilla_vacuna.Rows[reglon].Cells["PRECIO_VACUNA"].Value = lista_vacuna[i].Precio_Vacuna; } }
private void btn_Eliminar_vacunas_Click(object sender, EventArgs e) { if (MessageBox.Show("Seguro que dese Eliminar?", "Salir", MessageBoxButtons.YesNo) == DialogResult.Yes) { int id_vacunas = Convert.ToInt32(lb_id_vacuna.Text); int serie = int.Parse(lb_serie_mascota.Text); int respuesta2 = new NVacuna().N_eliminar_vacuna(id_vacunas); if (respuesta2 == 0) { MessageBox.Show("Error Al Eliminar Por favor intente nuevamente"); } else { MessageBox.Show("Eliminado Correctamente"); Listar_Vacunas(serie); limpiar_cajas_vacuna(); btn_registrar_vacunas.Enabled = false; btn_cancelar_vacuna.Enabled = false; btn_nueva_vacuna.Enabled = true; inhabilitar_cajas_Vacuna(); this.lb_id_vacuna.Text = ""; btn_modificar_vacunas.Text = "Editar"; btn_modificar_vacunas.Enabled = false; btn_Eliminar_vacunas.Enabled = false; } } }
private void btn_registrar_vacunas_Click(object sender, EventArgs e) { Boolean band1 = false, band2 = false; String mensaje = "Por Favor Complete los campos obligatorios : \n"; int Numero_vacuna = 0; String observacion = ""; Decimal precio_vacuna; DateTime fecha_vacu = Convert.ToDateTime(fecha_vacuna.Text); if (!String.IsNullOrEmpty(text_observacion_vacuna.Text)) { observacion = text_observacion_vacuna.Text; } else { mensaje = mensaje + "\n - Casilla de Descripcion"; band1 = true; } if (!String.IsNullOrEmpty(text_precio_vacuna.Text)) { precio_vacuna = Convert.ToDecimal(this.text_precio_vacuna.Text); } else { precio_vacuna = 0; } if (!String.IsNullOrEmpty(text_numero_vacuna.Text)) { Numero_vacuna = Convert.ToInt32(text_numero_vacuna.Text); } else { mensaje = mensaje + "\n - Casilla de N°Vacuna"; band2 = true; } if (band1 == true || band2 == true) { MessageBox.Show(mensaje); } else { if (!String.IsNullOrEmpty(this.lb_serie_mascota.Text)) { int serie_mascota = int.Parse(lb_serie_mascota.Text); int respuesta2 = new NVacuna().N_Registrar_vacuna(serie_mascota, Numero_vacuna, fecha_vacu, observacion, precio_vacuna); if (respuesta2 == 0) { MessageBox.Show("Error Al Registrar Por favor intente nuevamente"); } else { MessageBox.Show("Registrado Correctamente"); limpiar_cajas_vacuna(); inhabilitar_cajas_Vacuna(); btn_registrar_vacunas.Enabled = false; btn_cancelar_vacuna.Enabled = false; btn_nueva_vacuna.Enabled = true; int serie = Convert.ToInt32(this.lb_serie_mascota.Text); Listar_Vacunas(serie); } } else { MessageBox.Show("Ocurrio Un Error - Intente Nuevamente"); } } }