190 |
this.OnInstanceCreated = OnInstanceCreated; |
this.OnInstanceCreated = OnInstanceCreated; |
191 |
//CreateConnection(database); |
//CreateConnection(database); |
192 |
this.Database = database; |
this.Database = database; |
193 |
|
if (!CreateDatabaseBackup()) |
194 |
|
{ |
195 |
|
gLog.Error.WriteLine("Failed to backup database."); |
196 |
|
return; |
197 |
|
} |
198 |
ConnectionTest(); |
ConnectionTest(); |
199 |
ReadRecodringScheduleData(); |
ReadRecodringScheduleData(); |
200 |
ReadProgrammeData(); |
ReadProgrammeData(); |
259 |
} |
} |
260 |
} |
} |
261 |
} |
} |
262 |
con.Clone(); |
con.Clone(); |
263 |
} |
} |
264 |
OnCreatedInstance(this, new EventArgs()); |
OnCreatedInstance(this, new EventArgs()); |
265 |
} |
} |
269 |
} |
} |
270 |
} |
} |
271 |
|
|
272 |
|
|
273 |
|
private bool CreateDatabaseBackup() |
274 |
|
{ |
275 |
|
try |
276 |
|
{ |
277 |
|
string backup_file = string.Format("{0}.{1}", this.Database, DateTime.Now.ToString("yyyyMMddHHmmss")); |
278 |
|
gLog.Info.WriteLine("Creating Database backup..."); |
279 |
|
gLog.Info.WriteLine("\tSource: {0}", this.Database); |
280 |
|
gLog.Info.WriteLine("\tDestination: {0}", backup_file); |
281 |
|
|
282 |
|
System.IO.File.Copy(this.Database, backup_file); |
283 |
|
return true; |
284 |
|
} |
285 |
|
catch (Exception ex) |
286 |
|
{ |
287 |
|
gLog.Error.WriteLine(ex.ToString()); |
288 |
|
return false; |
289 |
|
} |
290 |
|
} |
291 |
|
|
292 |
private void ReadProgrammeData() |
private void ReadProgrammeData() |
293 |
{ |
{ |
294 |
try |
try |