private void btnGuardarHistorial_Click(object sender, EventArgs e) { try { string aaa = ""; PericiaHistoriaWF periciaForm = new PericiaHistoriaWF(aaa); periciaForm.Enabled = false; Entidades.Pericias _pericia = CargarEntidad(); bool Exito = PericiaNeg.GurdarHistorialPericia(_pericia); if (Exito == true) { ProgressBar(); const string message2 = "Se registro el nuevo estadio exitosamente."; const string caption2 = "Éxito"; var result2 = MessageBox.Show(message2, caption2, MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LimpiarCampos(); ListaPericias = PericiaNeg.BuscarHistorialPericia(idPericiaSeleccionada); groupBox2.Visible = false; btnNuevaHistoria.Visible = true; btnVolver.Visible = true; periciaForm.Enabled = true; } else { } } catch (Exception ex) { } }
private void PericiaHistoriaWF_Load(object sender, EventArgs e) { List <Pericias> objListOrder = new List <Pericias>(); objListOrder = PericiaNeg.BuscarHistorialPericia(idPericiaSeleccionada); List <Pericias> SortedList = objListOrder.OrderByDescending(o => o.Fecha).ToList(); ListaPericias = SortedList; var lista = SortedList.First(); cmbEstado.Text = lista.Estado; List <string> listaArchivos = new List <string>(); listaArchivos = Dao.PericiaDao.CargarArchivos(idPericiaSeleccionada); int contador = 0; if (listaArchivos.Count > 0) { if (listaArchivos.Count > contador) { txtAdjunto1.Text = listaArchivos[0].ToString(); txtAdjunto1.Visible = true; btnAbrir1.Visible = true; lblAdjunto1.Visible = true; contador = 1; } if (listaArchivos.Count > contador) { txtAdjunto2.Text = listaArchivos[1].ToString(); txtAdjunto2.Visible = true; btnAbrir2.Visible = true; lblAdjunto2.Visible = true; contador = 2; } if (listaArchivos.Count > contador) { txtAdjunto3.Text = listaArchivos[2].ToString(); txtAdjunto3.Visible = true; btnAbrir3.Visible = true; lblAdjunto3.Visible = true; contador = 3; } if (listaArchivos.Count > contador) { txtAdjunto4.Text = listaArchivos[3].ToString(); txtAdjunto4.Visible = true; btnAbrir4.Visible = true; lblAdjunto4.Visible = true; contador = 4; } if (listaArchivos.Count > contador) { txtAdjunto5.Text = listaArchivos[4].ToString(); txtAdjunto5.Visible = true; btnAbrir5.Visible = true; lblAdjunto5.Visible = true; contador = 5; } if (listaArchivos.Count > contador) { txtAdjunto6.Text = listaArchivos[5].ToString(); txtAdjunto6.Visible = true; btnAbrir6.Visible = true; lblAdjunto6.Visible = true; contador = 6; } if (listaArchivos.Count > contador) { txtAdjunto7.Text = listaArchivos[6].ToString(); txtAdjunto7.Visible = true; btnAbrir7.Visible = true; lblAdjunto7.Visible = true; contador = 7; } if (listaArchivos.Count > contador) { txtAdjunto8.Text = listaArchivos[7].ToString(); txtAdjunto8.Visible = true; btnAbrir8.Visible = true; lblAdjunto8.Visible = true; contador = 8; } if (listaArchivos.Count > contador) { txtAdjunto9.Text = listaArchivos[8].ToString(); txtAdjunto9.Visible = true; btnAbrir9.Visible = true; lblAdjunto9.Visible = true; contador = 9; } if (listaArchivos.Count > contador) { txtAdjunto10.Text = listaArchivos[9].ToString(); txtAdjunto10.Visible = true; btnAbrir10.Visible = true; lblAdjunto10.Visible = true; contador = 10; } groupBox3.Visible = true; } }