aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs')
-rw-r--r--Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs79
1 files changed, 0 insertions, 79 deletions
diff --git a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs b/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs
deleted file mode 100644
index 6ba278511..000000000
--- a/Software/Visual_Studio/PPC/UpdatePackages/Tango.PPC.Packages.Auth2/Auth2.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Tango.BL;
-using Tango.Core;
-using Tango.PPC.Common.UpdatePackages;
-using Tango.PPC.Shared.Updates;
-
-namespace Tango.PPC.Packages.Auth2
-{
- [PPCPackage(PackageType.Pre, "Applying Auth2 Patch", false)]
- public class Auth2 : ExtendedObject, IPPCPackage
- {
- public Task Run(PackageContext context)
- {
- return Task.Factory.StartNew(() =>
- {
- LogManager.Log("Starting Auth2 package procedure...");
-
- using (ObservablesContext db = ObservablesContext.CreateDefault())
- {
- using (var transaction = db.Database.BeginTransaction())
- {
- LogManager.Log("Setting all jobs users to null...");
- context.ReportProgress("Modifying jobs...");
- db.Database.ExecuteSqlCommand("ALTER TABLE JOBS ALTER COLUMN USER_GUID VARCHAR(36) NULL");
- db.Database.ExecuteSqlCommand("UPDATE JOBS SET USER_GUID = NULL");
-
- Thread.Sleep(1000);
-
- LogManager.Log("Setting all job runs users to null...");
- context.ReportProgress("Modifying job runs...");
- db.Database.ExecuteSqlCommand("UPDATE JOB_RUNS SET USER_GUID = NULL");
-
- Thread.Sleep(1000);
-
- LogManager.Log("Setting all events users to null...");
- context.ReportProgress("Modifying events...");
- db.Database.ExecuteSqlCommand("UPDATE MACHINES_EVENTS SET USER_GUID = NULL");
-
- Thread.Sleep(1000);
-
- LogManager.Log("Removing all users...");
- context.ReportProgress("Modifying users...");
- db.Database.ExecuteSqlCommand("DELETE FROM USERS");
-
- Thread.Sleep(1000);
-
- LogManager.Log("Removing redundant addresses...");
- context.ReportProgress("Modifying addresses...");
- db.Database.ExecuteSqlCommand(@"
-DELETE ADDRESSES FROM ADDRESSES
-FULL JOIN ORGANIZATIONS ON ORGANIZATIONS.ADDRESS_GUID = ADDRESSES.GUID
-WHERE ORGANIZATIONS.ADDRESS_GUID IS NULL");
-
- Thread.Sleep(1000);
-
- LogManager.Log("Removing redundant contacts...");
- context.ReportProgress("Modifying contacts...");
- db.Database.ExecuteSqlCommand(@"
-DELETE CONTACTS FROM CONTACTS
-FULL JOIN ORGANIZATIONS ON ORGANIZATIONS.CONTACT_GUID = CONTACTS.GUID
-WHERE ORGANIZATIONS.CONTACT_GUID IS NULL");
-
- Thread.Sleep(1000);
-
- LogManager.Log("Committing transaction...");
- context.ReportProgress("Committing transaction...");
- transaction.Commit();
- }
- }
-
- });
- }
- }
-}