//[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); }
//[TestMethod] public void A_ConvertOldToNewData() { var database = new TVTDatabase(); database.Initialize(); using (var connection = TVTSQLSession.GetSession()) { var movies = TVTCommandsV2.LoadMoviesOldV2(connection); OldV2Converter.Convert(movies, database, TVTDataRoot.V2InStorage); TVTCommandsV2.LoadFakesForPeople(connection, database.GetAllPeople()); OldV2Converter.RefreshMovieDescriptions(database); OldV2Converter.FakePersonNames(database); var ads = TVTCommandsV2.LoadAdsOldV2(connection); OldV2Converter.Convert(ads, database, TVTDataRoot.V2InStorage); var news = TVTCommandsV2.LoadNewsOldV2(connection); var tt = news.FirstOrDefault(x => x.title.StartsWith("Programmierer")); OldV2Converter.Convert(news, database, TVTDataRoot.V2InStorage); database.RefreshPersonProgrammeCount(); database.RefreshReferences(); database.RefreshStatus(); } using (var connection = TVTSQLSession.GetSessionNewDB()) { TVTCommandsV3.Insert <TVTPerson>(connection, TVTCommandsV3.GetPersonSQLDefinition(), database.GetAllPeople()); TVTCommandsV3.Insert <TVTProgramme>(connection, TVTCommandsV3.GetProgrammeSQLDefinition(), database.GetAllProgrammes(true, true)); //TVTCommandsV3.Insert<TVTEpisode>( connection, TVTCommandsV3.GetEpisodeSQLDefinition(), database.GetAllEpisodes() ); TVTCommandsV3.Insert <TVTAdvertising>(connection, TVTCommandsV3.GetAdvertisingSQLDefinition(), database.GetAllAdvertisings()); TVTCommandsV3.Insert <TVTNews>(connection, TVTCommandsV3.GetNewsSQLDefinition(), database.GetAllNews()); } }