Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Data.SqlClient;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Excel = Microsoft.Office.Interop.Excel;
- namespace ConsoleApplication2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string connectionString = "server=localhost;database=IGP;pooling=false;Connect Timeout=60;Integrated Security=SSPI;";
- Excel.Application xlApp = new Excel.Application();
- Excel.Workbook xlWorkbook = xlApp.Workbooks.Open(@"C:\Users\dominikb.CT\Desktop\Templates.ods");
- Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1];
- Excel.Range xlRange = xlWorksheet.UsedRange;
- #region Games
- //List<string> ExternalGameId = new List<string>
- //{
- // "blackjack3_mobile_html_sw",
- // "blackjack3-1h_mobile_html_sw",
- // "blackjack3_not_mobile_sw",
- // "bloodsuckers_mobile_html_sw",
- // "bloodsuckers_not_mobile_sw",
- // "dazzle_not_mobile_sw",
- // "deadoralive_not_mobile_sw",
- // "deadoralive_mobile_html_sw",
- // "dracula_sw",
- // "multipliermayhem_not_mobile_sw",
- // "elements_sw",
- // "europeanroulette3_sw",
- // "fairyred_not_mobile_sw",
- // "fairyred_mobile_html_sw",
- // "flowers_not_mobile_sw",
- // "football_not_mobile_sw",
- // "fruitshop_not_mobile_sw",
- // "glow_mobile_html_sw",
- // "eldorado_not_mobile_sw",
- // "gunsnroses_not_mobile_sw",
- // "hooksheroes_not_mobile_sw",
- // "jackhammer2_not_mobile_sw",
- // "jackhammer2_mobile_html_sw",
- // "jackhammer_mobile_html_sw",
- // "jackhammer_not_mobile_sw",
- // "jimihendrix_not_mobile_sw",
- // "jokerpro_mobile_html_sw",
- // "jokerpro_not_mobile_sw",
- // "junglespirit_not_mobile_sw",
- // "koiprincess_mobile_html_sw",
- // "koiprincess_not_mobile_sw",
- // "fireflies_not_mobile_sw",
- // "luckyangler_not_mobile_sw",
- // "magicportals_not_mobile_sw",
- // "magicportals_mobile_html_sw",
- // "motorhead_not_mobile_sw",
- // "mythicmaiden_mobile_html_sw",
- // "mythicmaiden_not_mobile_sw",
- // "neonstaxx_not_mobile_sw",
- // "piggyriches_mobile_html_sw",
- // "piggyriches_not_mobile_sw",
- // "pyramid_not_mobile_sw",
- // "reelrush_mobile_html_sw",
- // "reelrush_not_mobile_sw",
- // "scruffyduck_not_mobile_sw",
- // "highlights_mobile_html_sw",
- // "highlights_not_mobile_sw",
- // "secretsofchristmas_not_mobile_sw",
- // "secretsofchristmas_mobile_html_sw",
- // "sparks_mobile_html_sw",
- // "sparks_not_mobile_sw",
- // "colossalpinatas_not_mobile_sw",
- // "colossalpinatas_mobile_html_sw",
- // "starburst_not_mobile_sw",
- // "stickers_mobile_html_sw",
- // "stickers_not_mobile_sw",
- // "invisibleman_not_mobile_sw",
- // "invisibleman_mobile_html_sw",
- // "shangrila_not_mobile_sw",
- // "themepark_not_mobile_sw",
- // "twinspin_not_mobile_sw",
- // "victorious_mobile_html_sw",
- // "victorious_not_mobile_sw",
- // "warlords_not_mobile_sw",
- // "warlords_mobile_html_sw",
- // "wildwater_not_mobile_sw",
- // "wildwildwest_mobile_html_sw",
- // "wildwildwest_not_mobile_sw",
- // "wolfcub_not_mobile_sw"
- //};
- //List<string> MobileGameIds = new List<string>()
- //{
- // "blackjack3_mobile_html_sw",
- // "bloodsuckers_mobile_html_sw",
- // "deadoralive_mobile_html_sw",
- // "fairyred_mobile_html_sw",
- // "glow_mobile_html_sw",
- // "jackhammer2_mobile_html_sw",
- // "jackhammer_mobile_html_sw",
- // "jokerpro_mobile_html_sw",
- // "koiprincess_mobile_html_sw",
- // "magicportals_mobile_html_sw",
- // "mythicmaiden_mobile_html_sw",
- // "piggyriches_mobile_html_sw",
- // "reelrush_mobile_html_sw",
- // "highlights_mobile_html_sw",
- // "secretsofchristmas_mobile_html_sw",
- // "sparks_mobile_html_sw",
- // "colossalpinatas_mobile_html_sw",
- // "stickers_mobile_html_sw",
- // "invisibleman_mobile_html_sw",
- // "victorious_mobile_html_sw",
- // "warlords_mobile_html_sw",
- // "wildwildwest_mobile_html_sw",
- // "blackjack3-1h_mobile_html_sw"
- //};
- //List<string> NonTmMobileGames = new List<string>()
- //{
- // "BlackJack Classic TouchT",
- // "Blackjack Touch - Single DeckT",
- // "BlackJackT",
- // "Blood Suckers TouchT",
- // "Blood SuckersT",
- // "Dazzle MeT",
- // "Dead or AliveT",
- // "Dead or Alive TouchT",
- // "DraculaT",
- // "Drive: Multiplayer MayhemT",
- // "Elements: The AwakeningT",
- // "European Roulette 3T",
- // "Fairytale Legends: Red Riding HoodT",
- // "Fairytale Legends: Red Riding Hood TouchT",
- // "FlowersT",
- // "Football Champions CupT",
- // "Fruit ShopT",
- // "Glow (only Touch)",
- // "Gonzo's QuestT",
- // "Guns N' RosesT",
- // "Hook's HeroesT",
- // "Jack Hammer 2T",
- // "Jack Hammer Touch 2T",
- // "Jack Hammer TouchT",
- // "Jack HammerT",
- // "Jimi HendrixT",
- // "Joker Pro TouchT",
- // "Joker ProT",
- // "Jungle SpiritT",
- // "Koi Princess TouchT",
- // "Koi PrincessT",
- // "LightsT",
- // "Lucky AnglerT",
- // "Magic PortalsT",
- // "Magic Portals TouchT",
- // "MotorheadT",
- // "Mythic Maiden TouchT",
- // "Mythic MaidenT",
- // "Neon StaxxT",
- // "Piggy Riches TouchT",
- // "Piggy RichesT",
- // "Pyramid: Quest for ImmortalityT",
- // "Reel Rush TouchT",
- // "Reel RushT",
- // "Scruffy DuckT",
- // "Secrets of Atlantis TouchT",
- // "Secrets of AtlantisT",
- // "Secrets of ChristmasT",
- // "Secrets of Christmas TouchT",
- // "Sparks TouchT",
- // "SparksT",
- // "Spinata GrandeT",
- // "Spinata Grande TouchT",
- // "StarburstT",
- // "Stickers TouchT",
- // "StickersT",
- // "The InvisibleManT",
- // "The InvisibleManTouchT",
- // "The Legend of Shangri-La: CLuster PaysT",
- // "Theme ParkT",
- // "Twin SpinT",
- // "Victorious TouchT",
- // "VictoriousT",
- // "Warlords-Crystals of PowerT",
- // "Warlords-Crystals of Power TouchT",
- // "Wild WaterT",
- // "Wild Wild West: The Great Train Heist TouchT",
- // "Wild Wild West: The Great Train HeistT",
- // "Wolf ClubT",
- // "FairyTale Legends: Red Riding HoodT",
- // "Blackjack Classic TouchT",
- // "Glow TouchT",
- // "Gonzo''s QuestT",
- // "Guns N'' Roses Video SlotsT",
- // "Guns N'' RosesT",
- // "NetEntT",
- // "Hook''s HeroesT",
- // "Jack Hammer 2 TouchT",
- // "Sticky WinT",
- // "Jimi Hendrix Online SlotT",
- // "Jungle Spirit: Call of the WildT",
- // "Lucky Angler: A Snowy CatchT",
- // "Motörhead Video SlotT",
- // "Spiñata GrandeT",
- // "Spiñata Grande TouchT",
- // "The Invisible ManT",
- // "Shangri-La: Cluster PaysT",
- // "Theme Park: Tickets of FortuneT",
- // "Warlords - Crystals of PowerT",
- // "Warlords - Crystals of Power TouchT",
- // "Wolf CubT",
- // "Drive: Multiplier MayhemT",
- // "MotörheadT",
- // "Bloodsuckers TouchT",
- // "AvalancheT",
- // "FairyTale Legends: Red Riding Hood TouchT",
- // "Football: Champions CupT",
- // "Sticky WinsT",
- // "Smart RangeT",
- // "Netent RocksT",
- // "SuperStaxxT",
- // "TouchT",
- // "The Invisible Man TouchT",
- // "Cluster PaysT"
- //};
- //List<string> Long_Description = new List<string>();
- //for (int i = 2; i <= 70; i++)
- //{
- // try
- // {
- // Long_Description.Add(xlRange.Cells[i, 2].Value2);
- // }
- // catch
- // {
- // Console.WriteLine("Error:{0}", i.ToString());
- // }
- //}
- //string text = File.ReadAllText(@"C:\Users\dominikb.CT\Desktop\gamestm.txt");
- ////string[] words = text.Split(' ');
- //foreach(string item in NonTmMobileGames)
- //{
- // text = text.Replace(item, item + "@@TMPLACEHOLDER@@");
- // File.WriteAllText(@"C:\Users\dominikb.CT\Desktop\gamestm1.txt", text);
- //}
- //Console.WriteLine("Finished");
- //for (int i = 0; i < words.Length; i++)
- // if (words[i] != "INSERT" || !string.IsNullOrEmpty(words[i]))
- // {
- // if (words[i].EndsWith("T"))
- // {
- // Console.WriteLine(words[i]);
- // words[i] = words[i].Replace('T', '™');
- // }
- // }
- //text = text.Replace(item, item+"@@TMPLACEHOLDER@@");
- //File.WriteAllText(@"C:\Users\dominikb.CT\Desktop\gamestm1.txt", text);
- //Console.WriteLine("Finished");
- //for (int i = 1; i < 70; i++)
- //{
- // if (MobileGameIds.Contains(ExternalGameId[i - 1]))
- // {
- // Console.WriteLine("SELECT @GameId = [Id] FROM [IGP].[ProdGameManagement].[Game] WHERE [ExternalGameId] = '{0}'", ExternalGameId[i - 1]);
- // Console.WriteLine("INSERT INTO [Globalization].[Translation] ([LanguageId],[Key],[Value]) VALUES");
- // Console.WriteLine(@"(83, 'PGM_GAME_LD_' + CONVERT(VARCHAR(100), @GameId) + '_2' , '{0}')", Long_Description[i - 1]);
- // Console.WriteLine();
- // }
- // else
- // {
- // Console.WriteLine("SELECT @GameId = [Id] FROM [IGP].[ProdGameManagement].[Game] WHERE [ExternalGameId] = '{0}'", ExternalGameId[i - 1]);
- // Console.WriteLine("INSERT INTO [Globalization].[Translation] ([LanguageId],[Key],[Value]) VALUES");
- // Console.WriteLine(@"(83, 'PGM_GAME_LD_' + CONVERT(VARCHAR(100), @GameId) + '_1' , '{0}')", Long_Description[i - 1]);
- // Console.WriteLine();
- // }
- //}
- #endregion
- using (SqlConnection connection = new SqlConnection(connectionString))
- {
- SqlCommand SqlCmd = new SqlCommand();
- connection.Open();
- SqlCmd = connection.CreateCommand();
- SqlCmd.CommandText = "SELECT TOP 1000 t.Id, t.Body FROM[IGP].[NotificationManagement].[NotificationSubTypeConfiguration] INNER JOIN [TemplatesManagement].Templates t ON EmailTemplateId = t.Id WHERE[SendAsEmail] = 1 AND t.LanguageId = 83 AND t.Id > 321 OR t.Id = 259 OR t.Id = 251";
- //SqlCmd.CommandText = "SELECT * FROM [IGP].[UserManagement].[Users]";
- SqlDataReader SqlDr = SqlCmd.ExecuteReader();
- using (System.IO.StreamWriter file =
- new System.IO.StreamWriter(@"C:\Users\dominikb.CT\Desktop\clean.sql", true))
- {
- while (SqlDr.Read())
- {
- file.WriteLine();
- file.WriteLine("({0}, N'ro-RO', N'{1}'),", SqlDr.GetValue(0), SqlDr.GetValue(1));
- file.WriteLine();
- }
- }
- }
- using (System.IO.StreamWriter file =
- new System.IO.StreamWriter(@"C:\Users\dominikb.CT\Desktop\test.sql", true))
- {
- file.WriteLine("PRINT N'STARTING TemplatesManagement.Data.ICBA-967';");
- for (int i = 3; i <= 23; i++)
- {
- if (xlRange.Cells[i, 1].Value2 != null)
- {
- if (i == 21)
- {
- continue;
- }
- //file.WriteLine();
- //file.WriteLine("UPDATE [TemplatesManagement].[Templates]");
- //file.WriteLine("SET [Body] = N'{0}'", xlRange.Cells[i, 6].Value2);
- //file.WriteLine("WHERE [Name] = '{0}'", xlRange.Cells[i, 1].Value2);
- //file.WriteLine();
- //file.WriteLine();
- //Console.WriteLine("Declare @Test{0} INT", i.ToString());
- //Console.WriteLine("SELECT Test{0} = [Body] FROM [TemplatesManagement].[Templates]", i.ToString());
- //Console.WriteLine("Where [Name] = '{0}'", xlRange.Cells[i, 1].Value2);
- //Console.WriteLine("PRINT @Test{0}", i.ToString());
- //Console.WriteLine();
- //Console.WriteLine();
- //Console.WriteLine("({0}, N'ro-RO', N'')", xlRange.Cells[i, 6].Value2);
- //Console.WriteLine();
- }
- }
- file.WriteLine("PRINT N'FINISHED TemplatesManagement.Data.ICBA-967';");
- }
- Console.WriteLine("Finished");
- Console.Read();
- }
- }
- }
Add Comment
Please, Sign In to add comment