//[TestMethod] public void D_CreateXMLV3() { var database = new TVTDatabase(); database.Initialize(); var dataRoot = TVTDataRoot.V2InUse; using (var connection = TVTSQLSession.GetSessionNewDB()) { var programmes = TVTCommandsV3.Read <TVTProgramme>(connection, TVTCommandsV3.GetProgrammeSQLDefinition(), "master_id, episode_index, fake_title_de, title_de"); //database.AddProgrammes( programmes.Where( x => (int)x.DataStatus >= (int)TVTDataStatus.OnlyDE ) ); //var yames = programmes.Where( x => x.FakeTitleDE != null && x.FakeTitleDE.StartsWith( "Yams Pond" ) ).ToList(); //var yames2 = yames.Where( x => x.DataRoot == dataRoot ).ToList(); database.AddProgrammes(programmes.Where(x => x.DataRoot == dataRoot)); var ads = TVTCommandsV3.Read <TVTAdvertising>(connection, TVTCommandsV3.GetAdvertisingSQLDefinition(), "fake_title_de, title_de"); database.AddAdvertisings(ads.Where(x => x.DataRoot == dataRoot)); var people = TVTCommandsV3.Read <TVTPerson>(connection, TVTCommandsV3.GetPersonSQLDefinition(), "fake_last_name, fake_first_name, last_name"); database.AddPeople(people.Where(x => x.DataRoot == dataRoot)); var news = TVTCommandsV3.Read <TVTNews>(connection, TVTCommandsV3.GetNewsSQLDefinition(), "news_thread_id, news_type, title_de"); database.AddNews(news.Where(x => x.DataRoot == dataRoot)); database.RefreshReferences(); } var persister = new XmlPersisterV3(); persister.SaveXML(database, "TVTDatabaseV3.xml", DatabaseVersion.V3, DataStructure.FakeData, false); }
public void LoadXMLFile(string filename) { CurrentFilePath = filename; InternalDatabase.Clear(); var persister = new XmlPersisterV3(); persister.LoadXML(filename, InternalDatabase, DataStructure.FakeData); }
private void miImportDB_Click(object sender, EventArgs e) { openFileDialog.InitialDirectory = Environment.CurrentDirectory; if (openFileDialog.ShowDialog() == DialogResult.OK) { XmlPersisterV3 persister = new XmlPersisterV3(); var tempDatabase = new TVTBindingListDatabaseOld(); tempDatabase.Initialize(); persister.LoadXML(openFileDialog.FileName, tempDatabase); database.AddPeople(tempDatabase.GetAllPeople()); database.AddProgrammes(tempDatabase.GetAllProgrammes(true)); } }
public void XMLV3ReadWriteTest() { TVTDatabase initialDatabase = new TVTDatabase(); initialDatabase.Initialize(); var advertising = EntityHelper.GetIconicAdvertising(); initialDatabase.AddAdvertising(advertising); var person = EntityHelper.GetIconicPerson("Wurst", "Hans"); initialDatabase.AddPerson(person); //var programme = EntityHelper.GetIconicProgramme(); //initialDatabase.AddProgramme( programme ); var persister = new XmlPersisterV3(); persister.SaveXML(initialDatabase, "UnitTestXMLV2.xml", DatabaseVersion.V3, DataStructure.FakeData); TVTDatabase loadDatabase = new TVTDatabase(); loadDatabase.Initialize(); persister.LoadXML("UnitTestXMLV2.xml", loadDatabase, DataStructure.FakeData); Assert.AreEqual(1, loadDatabase.GetAllAdvertisings().Count()); var loadAdvertising = loadDatabase.GetAllAdvertisings().First(); AssertAdvertisings(advertising, loadAdvertising, TestMode.XMLV3); Assert.AreEqual(1, loadDatabase.GetAllPeople().Count()); var loadPerson = loadDatabase.GetAllPeople().First(); AssertPeople(person, loadPerson, TestMode.XMLV3, true); //Assert.AreEqual( 1, loadDatabase.GetAllProgrammes().Count() ); //var loadProgrammes = loadDatabase.GetAllProgrammes().First(); //AssertProgrammes( programme, loadProgrammes, TestMode.XMLV3 ); }
public void SaveXMLFile( ) { var persister = new XmlPersisterV3(); persister.SaveXML(InternalDatabase, CurrentFilePath, DatabaseVersion.V3, DataStructure.FakeData, false); }
private void btnExcelExport_Click(object sender, EventArgs e) { XmlPersisterV3 persister = new XmlPersisterV3(); persister.SaveXML(database, "ExportDatabaseFull.xml", DatabaseVersion.V3, DataStructure.Full); }
private void miExportV2Fake_Click(object sender, EventArgs e) { XmlPersisterV3 persister = new XmlPersisterV3(); persister.SaveXML(database, "ExportTVTDatabaseV2Fake.xml", DatabaseVersion.V2, DataStructure.FakeData); }
private void miExportV3Original_Click(object sender, EventArgs e) { XmlPersisterV3 persister = new XmlPersisterV3(); persister.SaveXML(database, "ExportTVTDatabaseV3Original.xml", DatabaseVersion.V3, DataStructure.OriginalData); }
private void miSaveAll_Click(object sender, EventArgs e) { XmlPersisterV3 persister = new XmlPersisterV3(); persister.SaveXML(database, "TVTDatabaseV3Full.xml", DatabaseVersion.V3, DataStructure.Full); }
private void btnSaveOldFormat_Click(object sender, EventArgs e) { XmlPersisterV3 persister = new XmlPersisterV3(); persister.SaveXML(database, "ExportDatabaseFakeDataOldFormat.xml", DatabaseVersion.V2, DataStructure.FakeData); }
public void C_ReadXMLV2AndMergeAdChanges() { System.Diagnostics.Trace.WriteLine(Directory.GetCurrentDirectory()); Assert.IsTrue(File.Exists("ads-changes.xml")); var databaseV3 = new TVTDatabase(); databaseV3.Initialize(); var persister = new XmlPersisterV3(); persister.LoadXMLV3Beta("ads-changes.xml", databaseV3); var sqlDB = new TVTDatabase(); sqlDB.Initialize(); sqlDB.Clear(); using (var connection = TVTSQLSession.GetSessionNewDB()) { string myConnectionString = "SERVER=localhost;" + "DATABASE=tvtower_new;" + "UID=TVTowerUser;" + "PASSWORD=123;"; var mvSQLDatabase = new TVTSQLDatabase(myConnectionString); mvSQLDatabase.FillTVTDatabase(sqlDB); } var merging = new DatabaseMerging(sqlDB); { foreach (var currAd in databaseV3.GetAllAdvertisings()) { var found = merging.FindAdMatchWithV2(currAd); if (found != null) { merging.CopyPropertyValues <TVTAdvertising>(found, currAd); found.DataRoot = TVTDataRoot.V2InUse; found.IsChanged = true; } else { var newAd = new TVTAdvertising(); newAd.GenerateGuid(); merging.CopyPropertyValues <TVTAdvertising>(newAd, currAd); newAd.DataRoot = TVTDataRoot.V2InUse; newAd.IsNew = true; newAd.IsChanged = true; sqlDB.AddAdvertising(newAd); } } } using (var connection = TVTSQLSession.GetSessionNewDB()) { string myConnectionString = "SERVER=localhost;" + "DATABASE=tvtower_new;" + "UID=TVTowerUser;" + "PASSWORD=123;"; var mvSQLDatabase = new TVTSQLDatabase(myConnectionString); mvSQLDatabase.WriteChangesToDatabase(sqlDB); } }