private List <ExportHistory> GetFilteredExportHistory(ExportDatabase database) { var beginTime = ToValidDateTime(dateBegin.DateTime); var endTime = ToValidDateTime(dateEnd.DateTime); if (endTime == ToValidDateTime(new DateTime())) { endTime = DateTime.MaxValue; } var place = inputPlace.Text; return(database.exportHistoryTable .Where(x => (x.Datetime >= beginTime)) .Where(x => (x.Datetime <= endTime)) .Where(x => place != "" ? (x.Place.IndexOf(place) >= 0) : true).ToList()); }
public async Task Run() { Log.Information("Starting Application.Run()"); var exportP1Consumption = new ExportP1Consumption(_houseDBSettings, _domoticzSettings); var exportKwhDeviceValues = new ExportKwhDeviceValues(_houseDBSettings, _domoticzSettings); var exportValuesForCaching = new ExportValuesForCaching(_houseDBSettings, _domoticzSettings); var exportDatabase = new ExportDatabase(_houseDBSettings, _domoticzSettings); var exportMotionDetection = new ExportMotionDetection(_houseDBSettings, _domoticzSettings); while (true) { await Task.WhenAll( exportP1Consumption.DoExport(), exportKwhDeviceValues.DoExport(), exportValuesForCaching.DoExport(), exportDatabase.DoExport(), exportMotionDetection.DoExport(), Task.Delay(5000)); } }
private void LoadButton_Click(object sender, EventArgs e) { try { var database = new ExportDatabase(ConfigurationManager.ConnectionStrings["ExportDB"].ConnectionString); var beginTime = ToValidDateTime(dateBegin.DateTime); var endTime = ToValidDateTime(dateEnd.DateTime); var place = inputPlace.Text; gridControl1.DataSource = GetFilteredExportHistory(database); gridControl1.RefreshDataSource(); } catch (Exception except) { string message = "Błąd przy pobieraniu danych z bazy!\n\n" + except.ToString(); string caption = "Błąd"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } }
/// <summary> /// Export database for Online and create new database file for Online connection /// </summary> /// <param name="userSelection"></param> /// <param name="areaLevel"></param> /// <param name="sourceDBConnection"></param> /// <param name="sourceDBQueries"></param> /// <param name="maintainTemplate"></param> /// <param name="destinationDBNameWPath"></param> /// <param name="tempFolderPath"></param> /// <param name="createNewDatabaseForOnline"></param> /// <returns></returns> public static bool ExportDatabase(UserSelection userSelection, int areaLevel, DIConnection sourceDBConnection, DIQueries sourceDBQueries, bool maintainTemplate, string destinationDBNameWPath, string tempFolderPath,bool createNewDatabaseForOnline) { bool RetVal = false; if (sourceDBConnection != null) { switch (sourceDBConnection.ConnectionStringParameters.ServerType) { case DIServerType.Excel: break; case DIServerType.MsAccess: //-- Export database into Access (mdb). Export.ExportDatabase ExportDB = new ExportDatabase(userSelection, sourceDBConnection); ExportDB.AreaLevel = areaLevel; RetVal = ExportDB.ExportMDB(maintainTemplate, destinationDBNameWPath, tempFolderPath); break; case DIServerType.Oracle: break; case DIServerType.SqlServer: case DIServerType.MySql: case DIServerType.SqlServerExpress: Export.ExportOnlineDatabase ExportOnlineDB = new ExportOnlineDatabase(userSelection, sourceDBConnection, sourceDBQueries); RetVal = ExportOnlineDB.ExportMDB(destinationDBNameWPath, tempFolderPath, createNewDatabaseForOnline); break; default: break; } } return RetVal; }