Skip to content

Commit

Permalink
fix #246
Browse files Browse the repository at this point in the history
  • Loading branch information
Simon Felix committed Sep 5, 2018
1 parent 4515ed4 commit 84e99bd
Show file tree
Hide file tree
Showing 7 changed files with 82 additions and 8 deletions.
4 changes: 1 addition & 3 deletions ProStudCreator/Global.asax.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Global : HttpApplication
private const string DummyPage = "CheckAllTasks";
public static readonly TimeSpan AllowTitleChangesBeforeSubmission = TimeSpan.FromDays(11*7);
public static readonly TimeSpan ExpectFinalPresentationAfterSubmissionForIP5 = TimeSpan.FromDays(3*7);
public static readonly TimeSpan GradingDuration = TimeSpan.FromDays(2);
public static readonly TimeSpan GradingDuration = TimeSpan.FromDays(4);
public static readonly string WebAdmin = "[email protected]";
public static readonly string GradeAdmin = "[email protected]";
public static readonly string PayExpertAdmin = "[email protected]"; // "[email protected]";
Expand All @@ -38,7 +38,6 @@ private void Application_Start(object sender, EventArgs e)
Application.Add("dummyRequest", "");

TaskHandler.CheckAllTasks();

}


Expand All @@ -59,7 +58,6 @@ public void CacheItemRemovedCallback(string key, object value, CacheItemRemovedR
{
HitPage();

// Do the service works
TaskHandler.CheckAllTasks();
}

Expand Down
9 changes: 9 additions & 0 deletions ProStudCreator/ProStudCreator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,10 @@
<Content Include="Projectlist.aspx" />
<Content Include="Scripts\bootstrap.js" />
<Content Include="Scripts\bootstrap.min.js" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Scripts\jquery-3.3.1.intellisense.js" />
<Content Include="Scripts\jquery-3.3.1.js" />
<Content Include="Scripts\jquery-3.3.1.min.js" />
Expand Down Expand Up @@ -329,6 +333,11 @@
</Compile>
<Compile Include="ClientType.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Translator.cs" />
<Compile Include="ProjectFilesDownload.aspx.cs">
<DependentUpon>ProjectFilesDownload.aspx</DependentUpon>
Expand Down
2 changes: 1 addition & 1 deletion ProStudCreator/ProStudentCreatorDB.designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 37 additions & 0 deletions ProStudCreator/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions ProStudCreator/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ProStudCreator.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="aspnet_ProStudCreator_20140818043155ConnectionString" Type="(Connection string)" Scope="Application">
<DesignTimeValue Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
&lt;SerializableConnectionString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
&lt;ConnectionString&gt;Data Source=DESKTOP-NKIG02J;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True&lt;/ConnectionString&gt;
&lt;ProviderName&gt;System.Data.SqlClient&lt;/ProviderName&gt;
&lt;/SerializableConnectionString&gt;</DesignTimeValue>
<Value Profile="(Default)">Data Source=DESKTOP-NKIG02J;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True</Value>
</Setting>
</Settings>
</SettingsFile>
14 changes: 12 additions & 2 deletions ProStudCreator/TaskHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,21 @@ enum Type : int
CheckBillingStatus = 16
}

private static readonly object TaskCheckLock = new object();
private static DateTime NextTaskCheck = DateTime.Today.AddHours(19);

public static void CheckAllTasks() //register all Methods which check for tasks here.
{
//protect against reentrancy-problems. this lock is enough as long as the method runs in less than 24h
lock (TaskCheckLock)
{
var now = DateTime.Now;
if (now < NextTaskCheck)
return;

NextTaskCheck = now.Date.AddHours(24 + 19);
}

using (var db = new ProStudentCreatorDBDataContext())
{
CheckGradesRegistered(db);
Expand All @@ -53,8 +65,6 @@ enum Type : int
SendGradesToAdmin(db);
SendPayExperts(db);



//vvvvvvvvvvvvv NOT YET IMPLEMENTED
//SendInvoiceCustomers(db); //<-- not yet implemented

Expand Down
10 changes: 8 additions & 2 deletions ProStudCreator/Web.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<connectionStrings>
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-ProStudCreator-20140818043155.mdf;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="aspnet_ProStudCreator_20140818043155ConnectionString" connectionString="Data Source=DESKTOP-NKIG02J;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True" providerName="System.Data.SqlClient" />
<add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-ProStudCreator-20140818043155.mdf;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="aspnet_ProStudCreator_20140818043155ConnectionString"
connectionString="Data Source=DESKTOP-NKIG02J;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True"
providerName="System.Data.SqlClient" />
<add name="ProStudCreator.Properties.Settings.aspnet_ProStudCreator_20140818043155ConnectionString"
connectionString="Data Source=DESKTOP-NKIG02J;Initial Catalog=aspnet-ProStudCreator-20140818043155;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>

<appSettings>
Expand Down

0 comments on commit 84e99bd

Please sign in to comment.