public dsEliteDB.vilogRow GetLogByTimestamp(DateTime timeStamp)
{
try
{
dsEliteDB.vilogDataTable data = new dsEliteDB.vilogDataTable();
// the query is the vilog, but with the added 'where' clause to improve the query speed
String sqlString = "select `l`.`time` AS `time`,`s`.`systemname` AS `systemname`,`st`.`stationname` AS `stationname`,`e`.`eventtype` AS `eevent`,`c`.`cargoaction`" +
" AS `action`,`co`.`loccommodity` AS `loccommodity`,`l`.`cargovolume` AS `cargovolume`,`l`.`credits_transaction` " +
" AS `credits_transaction`,`l`.`credits_total` AS `credits_total`, `l`.`distance` AS `distance`, `l`.`notes` AS `notes` from (((((`tblog` `l` " +
" left join `tbeventtype` `e` on((`l`.`event_id` = `e`.`id`))) left join `tbcargoaction` `c` on((`l`.`cargoaction_id` = `c`.`id`))) " +
" left join `tbsystems` `s` on((`l`.`system_id` = `s`.`id`))) left join `tbstations` `st` on((`l`.`station_id` = `st`.`id`))) " +
" left join `tbcommodity` `co` on((`l`.`commodity_id` = `co`.`id`))) " +
" where time = " + DBConnector.SQLDateTime(timeStamp);
if(Program.DBCon.Execute(sqlString, data) > 0)
return (dsEliteDB.vilogRow)data.Rows[0];
else
return null;
}
catch (Exception ex)
{
throw new Exception("Error while getting a stationname from a station id", ex);
}
}