aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.DataSynchronizer.CLI/Program.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.DataSynchronizer.CLI/Program.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.DataSynchronizer.CLI/Program.cs107
1 files changed, 0 insertions, 107 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.DataSynchronizer.CLI/Program.cs b/Software/Visual_Studio/PPC/Tango.PPC.DataSynchronizer.CLI/Program.cs
deleted file mode 100644
index 091ef8f13..000000000
--- a/Software/Visual_Studio/PPC/Tango.PPC.DataSynchronizer.CLI/Program.cs
+++ /dev/null
@@ -1,107 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.BL;
-using Tango.SQLExaminer;
-
-namespace Tango.PPC.DataSynchronizer.CLI
-{
- class Program
- {
- static void Main(string[] args)
- {
- DataSynchronizer synchronizer = new DataSynchronizer();
- synchronizer.Synchronize();
- Console.ReadLine();
- }
- }
-
- public class DataSynchronizer
- {
- private Core.DataSource source;
- private Core.DataSource target;
- private String machineGuid;
-
- public void Synchronize()
- {
- try
- {
- Console.WriteLine("Starting PPC data synchronization...");
-
- source = new Core.DataSource();
- source.IntegratedSecurity = false;
- source.Address = "twine.database.windows.net";
- source.Catalog = "Tango_DEV";
- source.UserName = "Roy";
- source.Password = "Aa123456";
-
- using (ObservablesContext db = ObservablesContext.CreateDefault(source))
- {
- machineGuid = db.Machines.Where(x => x.SerialNumber == "LENA_TABLET").Take(1).Select(x => x.Guid).First();
- }
-
- target = new Core.DataSource();
- target.Address = "localhost\\SQLPPC";
- target.Catalog = "Tango";
-
- OverrideData();
- UpdateMachine();
-
- Console.ForegroundColor = ConsoleColor.Green;
- Console.WriteLine("Synchronization Completed Successfully.");
- }
- catch (Exception ex)
- {
- Console.ForegroundColor = ConsoleColor.Red;
- Console.WriteLine(ex.ToString());
- }
- }
-
- private void OverrideData()
- {
- Console.WriteLine("Executing override data script...");
-
- ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.OverrideData);
- builder.SetSource(source).SetTarget(target).Synchronize();
- var process = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data);
- process.Progress += (x, msg) =>
- {
- if (msg != null && !msg.Contains("SQL Examiner"))
- {
- Console.WriteLine(msg);
- }
- };
- var result = process.Execute().Result;
-
- if (result.ExitCode != ExaminerProcessExitCode.Success)
- {
- throw new InvalidOperationException(result.Output);
- }
- }
-
- private void UpdateMachine()
- {
- Console.WriteLine("Executing update machine script...");
-
- ExaminerConfigurationBuilder builder = new ExaminerConfigurationBuilder(ExaminerConfigurationType.UpdateMachine);
- builder.SetSource(source).SetTarget(target).SetMachineSerialNumber(machineGuid).Synchronize();
- var process = new ExaminerProcess(builder.Build(), ExaminerProcessType.Data);
- process.Progress += (x, msg) =>
- {
- if (msg != null && !msg.Contains("SQL Examiner"))
- {
- Console.WriteLine(msg);
- }
- };
- var result = process.Execute().Result;
-
- if (result.ExitCode != ExaminerProcessExitCode.Success)
- {
- throw new InvalidOperationException(result.Output);
- }
- }
- }
-}