private void Cargar_Registros_Lote() { var lote = new LoteControlAcceso(Lote_Id); if (lote.Cargar_Registros_Del_Lote()) { dgvLote.DataSource = lote.Get_Registos_DataTable(this.Dot, this.Edif); } }
private List <LoteControlAcceso> Cargar_Lotes_No_Informados() { var lst_lotes = new List <LoteControlAcceso>(); foreach (DataGridViewRow row in dgvLotes.Rows) { if (!row.Cells[0].Value.ToString().Contains("<")) { try { var lote = new LoteControlAcceso(); lote.id = row.Cells[0].Value.ToString(); if (lote.Cargar_Registros_Del_Lote()) { lst_lotes.Add(lote); txtBitcora.Text += "Se cargaron los registros del lote " + lote.id + "." + System.Environment.NewLine; } else { txtBitcora.Text += "No fue posible cargar los registros del lote " + lote.id + " (Error 1)." + System.Environment.NewLine; } } catch { txtBitcora.Text += "No fue posible cargar los registros del lote " + row.Cells[0].Value.ToString() + " (Error 2)." + System.Environment.NewLine; } this.Refresh(); } else { do { var nuevo_lote = Crear_Nuevo_Lote(); if (nuevo_lote != null) { lst_lotes.Add(nuevo_lote); txtBitcora.Text += "El nuevo lote generado es el " + nuevo_lote.id + System.Environment.NewLine; } else { txtBitcora.Text += "No fue posible crear un nuevo lote (Error 4)." + System.Environment.NewLine; } this.Refresh(); } while (LoteControlAcceso.Cantidad_De_Reg_Para_Informar() > 0); } } return(lst_lotes); }
private LoteControlAcceso Crear_Nuevo_Lote() { LoteControlAcceso lote; try { txtBitcora.Text = string.Empty; btnInformar.Enabled = false; lote = new LoteControlAcceso(); if (!lote.Marcar_Registros_No_Informados()) { txtBitcora.Text += "No fue posible marcar los registros para generar el lote a informar (Error 3.1)." + System.Environment.NewLine; this.Refresh(); return(null); } txtBitcora.Text += "Se marcaron registros para generar un nuevo lote." + System.Environment.NewLine; if (!lote.Cargar_Registros_Del_Lote()) { if (lote.registros != null) { if (lote.registros.Count == 0) { txtBitcora.Text += "No se encontraron nuevos registros para informar (Error 3.2)." + System.Environment.NewLine; } else { txtBitcora.Text += "No fue posible recuperar la totalidad de los regisros para informar (Error 3.3)." + System.Environment.NewLine; } } else { txtBitcora.Text += "No fue posible cargar nuevos registros a informar (Error 3.4)." + System.Environment.NewLine; } this.Refresh(); return(null); } txtBitcora.Text += "Se cargaron los registros del nuevo lote." + System.Environment.NewLine; this.Refresh(); return(lote); } catch { this.Refresh(); return(null); } }