Created
November 24, 2008 03:42
-
-
Save fitoria/28367 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void rellenarTabla() //not workee | |
{ | |
DataSet ds = new DataSet(); | |
conexion con = new conexion(); | |
//rellena tabla cuando las maquinas estan ocupadas. | |
string query = "select maquinas.id_maquinas, nombre, disponible, hora_entrada, hora_salida from maquinas, tiempo_maquina " + | |
"where maquinas.id_maquinas = tiempo_maquina.id_maquinas or disponible = '0';"; | |
SQLiteCommand comando = new SQLiteCommand(query, con.ConexionSql); | |
SQLiteDataAdapter da = new SQLiteDataAdapter(comando); | |
da.Fill(ds); | |
//ds.Tables[0].Columns.Add("restante"); | |
//ds.Tables[0].Columns.Add("Online"); | |
foreach (DataRow fila in ds.Tables[0].Rows) | |
{ | |
//TimeSpan resta = DateTime.Parse(fila["hora_salida"].ToString()) - DateTime.Now; | |
// fila["restante"] = resta.TotalHours.ToString(); | |
//resta = DateTime.Now - DateTime.Parse(fila["hora_entrada"].ToString()); | |
//fila["online"] = resta.TotalHours.ToString(); | |
} | |
tabla.DataSource = ds; | |
tabla.Refresh(); | |
//TODO: revisar esta mierda | |
//tabla.Columns["id_maquinas"].Visible = false; | |
//agregando las maquinas que no estan ocupadas | |
//query = "select id_maquinas, nombre, disponible from maquinas where disponible = '0';"; | |
//ds = con.ejecutarSelect(query); | |
//foreach (DataRow fila in ds.Tables[0].Rows) | |
//{ | |
// tabla.Rows.Add(fila); | |
//} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment