Work on AccountAdministrator

This commit is contained in:
Jonathan Williams 2014-09-01 20:03:08 -07:00
parent 8198bb31c8
commit a568631df8
6 changed files with 93 additions and 79 deletions

View File

@ -49,7 +49,7 @@ public class DDoSProtectionSwitcher
//{ //{
//if (_repository.switchToDDOSProt()) //if (_repository.switchToDDOSProt())
//{ //{
/*
System.out.println("Starting DDoS Protection Switch at " + dateFormat.format(new Date())); System.out.println("Starting DDoS Protection Switch at " + dateFormat.format(new Date()));
DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728, DomainRecords records = new ApiGetCall("https://api.dnsmadeeasy.com/V2.0/dns/managed/", 962728,
@ -111,7 +111,7 @@ public class DDoSProtectionSwitcher
+ idBuilder.toString()).Execute(); + idBuilder.toString()).Execute();
System.out.println("Deleted " + recordsToDelete.size() + " records."); System.out.println("Deleted " + recordsToDelete.size() + " records.");
} }
*/ /*
// Switching US Bungees // Switching US Bungees
switchServer("10.35.74.130", "108.178.20.166", "108.163.222.202", "108.178.20.165", "108.163.222.201"); switchServer("10.35.74.130", "108.178.20.166", "108.163.222.202", "108.178.20.165", "108.163.222.201");
switchServer("10.35.74.132", "108.163.217.110", "108.178.44.50", "108.163.217.109", "108.178.44.49"); switchServer("10.35.74.132", "108.163.217.110", "108.178.44.50", "108.163.217.109", "108.178.44.49");
@ -133,7 +133,7 @@ public class DDoSProtectionSwitcher
switchServer("10.32.214.250", "69.175.4.38", "107.6.129.250", "69.175.4.37", "107.6.129.249"); switchServer("10.32.214.250", "69.175.4.38", "107.6.129.250", "69.175.4.37", "107.6.129.249");
switchServer("10.32.214.249", "107.6.158.78", "184.154.13.38", "107.6.158.77", "184.154.13.37"); switchServer("10.32.214.249", "107.6.158.78", "184.154.13.38", "107.6.158.77", "184.154.13.37");
switchServer("10.32.214.247", "184.154.13.118", "108.163.242.98", "184.154.13.117", "108.163.242.97"); switchServer("10.32.214.247", "184.154.13.118", "108.163.242.98", "184.154.13.117", "108.163.242.97");
*/
/* /*
// Switching EU Bungees // Switching EU Bungees
switchServer("10.82.2.202", "107.6.176.194", "107.6.176.34", "107.6.176.193", "107.6.176.33"); switchServer("10.82.2.202", "107.6.176.194", "107.6.176.34", "107.6.176.193", "107.6.176.33");

View File

@ -69,6 +69,10 @@
} }
throw; throw;
} }
catch (Exception e)
{
Log("ERROR", PREFIX + String.Join("; ", e.InnerException.InnerException.Message));
}
} }
public virtual void Delete<TEntity>(TEntity entity) where TEntity : class public virtual void Delete<TEntity>(TEntity entity) where TEntity : class

View File

@ -58,6 +58,7 @@
<Reference Include="System.Data.Entity" /> <Reference Include="System.Data.Entity" />
<Reference Include="System.Runtime.Serialization" /> <Reference Include="System.Runtime.Serialization" />
<Reference Include="System.Security" /> <Reference Include="System.Security" />
<Reference Include="System.Transactions" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" /> <Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />

View File

@ -15,6 +15,7 @@
using Data; using Data;
using LOC.Website.Common.Contexts; using LOC.Website.Common.Contexts;
using System.Data.Entity.Infrastructure; using System.Data.Entity.Infrastructure;
using System.Transactions;
public class AccountAdministrator : IAccountAdministrator public class AccountAdministrator : IAccountAdministrator
{ {
@ -556,10 +557,16 @@
if (rank == null) if (rank == null)
return account.Rank.ToString(); return account.Rank.ToString();
var expire = DateTime.Now.AddMonths(1).AddMilliseconds(-DateTime.Now.Millisecond);
using (var transaction = new TransactionScope())
{
account.Rank = rank; account.Rank = rank;
account.RankExpire = DateTime.Now.AddMonths(1); account.RankExpire = expire;
account.RankPerm = token.Perm; account.RankPerm = token.Perm;
repository.CommitChanges();
repository.Edit(account); repository.Edit(account);
if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm) if ((rank.Name == "HERO" || rank.Name == "ULTRA") && token.Perm)
@ -631,6 +638,8 @@
} }
repository.CommitChanges(); repository.CommitChanges();
transaction.Complete();
}
_logger.Log("INFO", "TOKEN " + token.Name + "'s rank has been updated to " + token.Rank + " " + (token.Perm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString()); _logger.Log("INFO", "TOKEN " + token.Name + "'s rank has been updated to " + token.Rank + " " + (token.Perm ? "Permanently" : "Monthly") + "." + " Rank expire : " + account.RankExpire.ToString());
} }

View File

@ -614,7 +614,7 @@
<file relUrl="Content/css/bootstrap-responsive.css" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/css/bootstrap-responsive.css" publishTime="11/02/2013 13:30:01" />
<file relUrl="Areas/Manage/Views/Web.config" publishTime="11/02/2013 13:30:01" /> <file relUrl="Areas/Manage/Views/Web.config" publishTime="11/02/2013 13:30:01" />
<file relUrl="Views/Home/Index.cshtml" publishTime="03/19/2014 02:41:15" /> <file relUrl="Views/Home/Index.cshtml" publishTime="03/19/2014 02:41:15" />
<file relUrl="bin/LOC.Website.Common.dll" publishTime="08/30/2014 18:04:02" /> <file relUrl="bin/LOC.Website.Common.dll" publishTime="09/01/2014 16:33:06" />
<file relUrl="Content/themes/techno/js/prototype.js" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/themes/techno/js/prototype.js" publishTime="11/02/2013 13:30:01" />
<file relUrl="Scripts/jquery-1.4.4.min.js" publishTime="11/02/2013 13:30:01" /> <file relUrl="Scripts/jquery-1.4.4.min.js" publishTime="11/02/2013 13:30:01" />
<file relUrl="Content/Images/Double.png" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/Images/Double.png" publishTime="11/02/2013 13:30:01" />
@ -622,7 +622,7 @@
<file relUrl="Views/Account/LogOn.cshtml" publishTime="11/02/2013 13:30:01" /> <file relUrl="Views/Account/LogOn.cshtml" publishTime="11/02/2013 13:30:01" />
<file relUrl="Content/Images/Wiki/Ranger.png" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/Images/Wiki/Ranger.png" publishTime="11/02/2013 13:30:01" />
<file relUrl="Content/themes/techno/images/templatemo_image_02.png" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/themes/techno/images/templatemo_image_02.png" publishTime="11/02/2013 13:30:01" />
<file relUrl="bin/LOC.Website.Common.pdb" publishTime="08/30/2014 18:04:02" /> <file relUrl="bin/LOC.Website.Common.pdb" publishTime="09/01/2014 16:33:05" />
<file relUrl="bin/LOC.Core.pdb" publishTime="08/30/2014 13:54:02" /> <file relUrl="bin/LOC.Core.pdb" publishTime="08/30/2014 13:54:02" />
<file relUrl="Content/Images/Wiki/red_dye.jpg" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/Images/Wiki/red_dye.jpg" publishTime="11/02/2013 13:30:01" />
<file relUrl="Scripts/MicrosoftMvcValidation.js" publishTime="11/02/2013 13:30:01" /> <file relUrl="Scripts/MicrosoftMvcValidation.js" publishTime="11/02/2013 13:30:01" />
@ -692,9 +692,9 @@
<file relUrl="Views/Store/_WritePackage.cshtml" publishTime="11/02/2013 13:30:01" /> <file relUrl="Views/Store/_WritePackage.cshtml" publishTime="11/02/2013 13:30:01" />
<file relUrl="Content/css/bootstrap-responsive.min.css" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/css/bootstrap-responsive.min.css" publishTime="11/02/2013 13:30:01" />
<file relUrl="Views/Servers/Index.cshtml" publishTime="11/02/2013 13:30:01" /> <file relUrl="Views/Servers/Index.cshtml" publishTime="11/02/2013 13:30:01" />
<file relUrl="bin/LOC.Website.Web.dll" publishTime="08/30/2014 18:04:02" /> <file relUrl="bin/LOC.Website.Web.dll" publishTime="09/01/2014 16:33:06" />
<file relUrl="Views/Shared/_FrontLayout.cshtml" publishTime="11/02/2013 13:30:01" /> <file relUrl="Views/Shared/_FrontLayout.cshtml" publishTime="11/02/2013 13:30:01" />
<file relUrl="bin/LOC.Website.Web.pdb" publishTime="08/30/2014 18:04:02" /> <file relUrl="bin/LOC.Website.Web.pdb" publishTime="09/01/2014 16:33:06" />
<file relUrl="Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png" publishTime="11/02/2013 13:30:01" /> <file relUrl="Content/themes/base/images/ui-bg_glass_65_ffffff_1x400.png" publishTime="11/02/2013 13:30:01" />
<file relUrl="Views/Profile/Index.cshtml" publishTime="11/02/2013 13:30:01" /> <file relUrl="Views/Profile/Index.cshtml" publishTime="11/02/2013 13:30:01" />
<file relUrl="bin/WebMatrix.WebData.xml" publishTime="11/02/2013 13:30:01" /> <file relUrl="bin/WebMatrix.WebData.xml" publishTime="11/02/2013 13:30:01" />

Binary file not shown.