Sub IniciaCargaDatos
'Son tareas previstas cuando horaInicio == horaPrevista
Private TaskList As List
TaskList.Initialize
Dim Cursor, Cursor2, Cursor3 As ResultSet
Cursor = SQL1.ExecQuery("Select DISTINCT sector, color FROM cards WHERE horaInicio = horaPrevista ORDER BY rowid")
Do While Cursor.NextRow
Log(Cursor.GetString("sector"))
If Cursor.GetString("sector") <> Null Then
FireIncidents.AddGroup(Cursor.GetString("sector") & "-P", Cursor.GetString("sector"), TaskList, Cursor.GetInt("color"))
Cursor2 = SQL1.ExecQuery2("SELECT DISTINCT recurso FROM cards WHERE sector = ? AND horaInicio = horaPrevista ORDER BY recurso", Array As String(Cursor.GetString("sector")))
Do While Cursor2.NextRow
TaskList.Add(Cursor2.GetString("recurso"))
Loop
Cursor3 = SQL1.ExecQuery2("SELECT * FROM cards WHERE sector = ? AND horaInicio = horaPrevista ORDER BY recurso", Array As String(Cursor.GetString("sector")))
Do While Cursor3.NextRow
'pONE COMO FIN 3 HORAS MÁS DE LA ACTUAL
FireIncidents.AddTask(Cursor3.GetString("recurso"), Cursor3.GetString("tareatxt"), "Manuel", Cursor3.GetString("horaPrevista"),DateTime.Date(DateTime.Now + DateTime.TicksPerHour*3), Cursor3.GetString("color"))
Loop
End If
Loop
'Son tareas en Curso cuando horaInicio == horaCurso
FireIncidents.AddEmpty
Cursor = SQL1.ExecQuery("Select DISTINCT sector, color FROM cards WHERE horaInicio = horaCurso ORDER BY rowid")
Do While Cursor.NextRow
Log(Cursor.GetString("sector"))
If Cursor.GetString("sector") <> Null Then
FireIncidents.AddGroup(Cursor.GetString("sector") & "-C", Cursor.GetString("sector"), TaskList, Cursor.GetInt("color"))
Cursor2 = SQL1.ExecQuery2("SELECT DISTINCT recurso FROM cards WHERE sector = ? AND horaInicio = horaCurso ORDER BY recurso", Array As String(Cursor.GetString("sector")))
Do While Cursor2.NextRow
TaskList.Add(Cursor2.GetString("recurso"))
Loop
Cursor3 = SQL1.ExecQuery2("SELECT * FROM cards WHERE sector = ? AND horaInicio = horaCurso ORDER BY recurso", Array As String(Cursor.GetString("sector")))
Do While Cursor3.NextRow
'pONE COMO FIN 3 HORAS MÁS DE LA ACTUAL
FireIncidents.AddTask(Cursor3.GetString("recurso"), Cursor3.GetString("tareatxt"), "Manuel", Cursor3.GetString("horaCurso"),DateTime.Date(DateTime.Now + DateTime.TicksPerHour*3), Cursor3.GetString("color"))
Loop
End If
Loop
'Son tareas en Finalizadas cuando horaInicio == horaFin
FireIncidents.AddEmpty
Cursor = SQL1.ExecQuery("Select DISTINCT sector, color FROM cards WHERE horaInicio = horaFin ORDER BY rowid")
Do While Cursor.NextRow
Log(Cursor.GetString("sector"))
If Cursor.GetString("sector") <> Null Then
FireIncidents.AddGroup(Cursor.GetString("sector") & "-F", Cursor.GetString("sector"), TaskList, Cursor.GetInt("color"))
Cursor2 = SQL1.ExecQuery2("SELECT DISTINCT recurso FROM cards WHERE sector = ? AND horaInicio = horaFin ORDER BY recurso", Array As String(Cursor.GetString("sector")))
Do While Cursor2.NextRow
TaskList.Add(Cursor2.GetString("recurso"))
Loop
Cursor3 = SQL1.ExecQuery2("SELECT * FROM cards WHERE sector = ? AND horaInicio = horaFin ORDER BY recurso", Array As String(Cursor.GetString("sector")))
Do While Cursor3.NextRow
FireIncidents.AddTask(Cursor3.GetString("recurso"), Cursor3.GetString("tareatxt"), "Manuel", Cursor3.GetString("horaPrevista"), Cursor3.GetString("horaFin"), Cursor3.GetString("color"))
Loop
End If
Loop
Cursor.Close
Cursor2.Close
Cursor3.close
End Sub