Merge branch 'Release0.1.3' into 'master'

0.1.3

See merge request !5
This commit is contained in:
Chris Watts 2017-02-23 21:27:07 +00:00
commit da01f6670e
12 changed files with 40 additions and 31 deletions

View File

@ -5,6 +5,6 @@
</startup> </startup>
<appSettings> <appSettings>
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml"/> <add key="NLogConfigFilePath" value="Configs/NLogConfig.xml"/>
<add key="DataCenterServiceEndpoint" value="http://localhost:1234"/> <add key="DataCenterServiceEndpoint" value="http://localhost:8800"/>
</appSettings> </appSettings>
</configuration> </configuration>

View File

@ -142,7 +142,7 @@ namespace CardReaderService
{ {
_logger.Trace("Reader failed to connect, error: " + Enum.GetName(typeof(SCardError), err)); _logger.Trace("Reader failed to connect, error: " + Enum.GetName(typeof(SCardError), err));
} }
reader.Dispose();
} }
} }

View File

@ -352,16 +352,21 @@ namespace SQLiteRepository
#region Check the user hasnt registered an event in the last few minutes.. #region Check the user hasnt registered an event in the last few minutes..
if (ident.UserId_FK!=-1)
{ //only check log gap if the card is associated to a user
var hysteresisThresholdMinutes = Convert.ToInt32(ConfigurationManager.AppSettings["SwipeTimeGap"] ?? "3"); var hysteresisThresholdMinutes = Convert.ToInt32(ConfigurationManager.AppSettings["SwipeTimeGap"] ?? "3");
var threshold = DateTime.UtcNow.AddMinutes(0 - hysteresisThresholdMinutes); var threshold = DateTime.UtcNow.AddMinutes(0 - hysteresisThresholdMinutes);
var logs = _connection.Query<TimeLogDb>( var logs = _connection.Query<TimeLogDb>(
SQLiteProcedures.GET_LOGS_IN_LAST_X_MINUTES, SQLiteProcedures.GET_LOGS_IN_LAST_X_MINUTES,
threshold.Ticks, ident.UserId_FK); threshold.Ticks, ident.UserId_FK);
_logger.Trace("Checking last swipe event gap");
if (logs.Any()) if (logs.Any())
{ {
_logger.Error("Not logging event for user id: {0}, logged event within TimeGap Threshold of {1}", ident.UserId_FK, threshold);
logId = -1; logId = -1;
return OperationResponse.FAILED; return OperationResponse.FAILED;
} }
}
#endregion #endregion

View File

@ -45,6 +45,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL"> <Reference Include="System.Data.SQLite, Version=1.0.104.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139, processorArchitecture=MSIL">
<HintPath>..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net451\System.Data.SQLite.dll</HintPath> <HintPath>..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net451\System.Data.SQLite.dll</HintPath>

View File

@ -2,8 +2,8 @@
<configuration> <configuration>
<appSettings> <appSettings>
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" /> <add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
<add key="DefaultPageSize" value="20"/> <add key="DefaultPageSize" value="20" />
<add key="SwipeTimeGap" value="20"/> <add key="SwipeTimeGap" value="20" />
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />

View File

@ -49,6 +49,8 @@ namespace WindowsDataCenter
/// </summary> /// </summary>
/// <param name="log"></param> /// <param name="log"></param>
/// <returns></returns> /// <returns></returns>
[HttpPost]
[Route("manual")]
public IHttpActionResult ManuallyPostData([FromBody] ManualLog log) public IHttpActionResult ManuallyPostData([FromBody] ManualLog log)
{ {
throw new NotImplementedException(); throw new NotImplementedException();

View File

@ -20,7 +20,7 @@ namespace WindowsDataCenter
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always; config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
//ninject resolver for ApiController DI. //ninject resolver for ApiController DI.
config.DependencyResolver = new NinjectDependencyResolver(NinjectHelper.GetInstance().Kernel); //config.DependencyResolver = new NinjectDependencyResolver(NinjectHelper.GetInstance().Kernel);
//JSONP formatter for cross-domain requests. //JSONP formatter for cross-domain requests.
config.Formatters.Insert(0, new JsonpFormatter()); config.Formatters.Insert(0, new JsonpFormatter());

View File

@ -69,7 +69,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.3.2.0.0\lib\net45-full\Ninject.dll</HintPath> <HintPath>..\packages\Ninject.3.2.2.0\lib\net45-full\Ninject.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject.Extensions.ContextPreservation, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject.Extensions.ContextPreservation, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
@ -85,7 +85,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject.Web.Common, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject.Web.Common, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.Web.Common.3.2.0.0\lib\net45-full\Ninject.Web.Common.dll</HintPath> <HintPath>..\packages\Ninject.Web.Common.3.2.3.0\lib\net45-full\Ninject.Web.Common.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject.Web.Common.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject.Web.Common.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
@ -93,7 +93,7 @@
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject.Web.WebApi, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject.Web.WebApi, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
<HintPath>..\packages\Ninject.Web.WebApi.3.2.0.0\lib\net45-full\Ninject.Web.WebApi.dll</HintPath> <HintPath>..\packages\Ninject.Web.WebApi.3.2.4.0\lib\net45-full\Ninject.Web.WebApi.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Ninject.Web.WebApi.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL"> <Reference Include="Ninject.Web.WebApi.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">

View File

@ -15,13 +15,13 @@
<package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" /> <package id="Microsoft.Owin.StaticFiles" version="3.0.1" targetFramework="net452" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" /> <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" /> <package id="Newtonsoft.Json" version="9.0.1" targetFramework="net452" />
<package id="Ninject" version="3.2.0.0" targetFramework="net452" /> <package id="Ninject" version="3.2.2.0" targetFramework="net452" />
<package id="Ninject.Extensions.ContextPreservation" version="3.2.0.0" targetFramework="net452" /> <package id="Ninject.Extensions.ContextPreservation" version="3.2.0.0" targetFramework="net452" />
<package id="Ninject.Extensions.NamedScope" version="3.2.0.0" targetFramework="net452" /> <package id="Ninject.Extensions.NamedScope" version="3.2.0.0" targetFramework="net452" />
<package id="Ninject.Extensions.Xml" version="3.2.0.0" targetFramework="net452" /> <package id="Ninject.Extensions.Xml" version="3.2.0.0" targetFramework="net452" />
<package id="Ninject.Web.Common" version="3.2.0.0" targetFramework="net452" /> <package id="Ninject.Web.Common" version="3.2.3.0" targetFramework="net452" />
<package id="Ninject.Web.Common.OwinHost" version="3.2.3.0" targetFramework="net452" /> <package id="Ninject.Web.Common.OwinHost" version="3.2.3.0" targetFramework="net452" />
<package id="Ninject.Web.WebApi" version="3.2.0.0" targetFramework="net452" /> <package id="Ninject.Web.WebApi" version="3.2.4.0" targetFramework="net452" />
<package id="Ninject.Web.WebApi.OwinHost" version="3.2.4.0" targetFramework="net452" /> <package id="Ninject.Web.WebApi.OwinHost" version="3.2.4.0" targetFramework="net452" />
<package id="Owin" version="1.0" targetFramework="net452" /> <package id="Owin" version="1.0" targetFramework="net452" />
<package id="RazorEngine" version="3.7.2" targetFramework="net452" /> <package id="RazorEngine" version="3.7.2" targetFramework="net452" />

View File

@ -61,20 +61,18 @@
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>ID</th> <th class="col-md-3">First Name</th>
<th>UserId</th> <th class="col-md-3">Last Name</th>
<th class="col-md-1">firstName</th> <th class="col-md-1 text-center">Contractor</th>
<th class="col-md-1">lastName</th> <th />
<th/>
<th/> <th/>
</tr> </tr>
</thead> </thead>
<tbody data-bind="foreach: Users"> <tbody data-bind="foreach: Users">
<tr> <tr>
<td class="valign" data-bind="text: UserId"></td>
<td class="valign" data-bind="text: UserId"></td>
<td class="valign" data-bind="text: LastName"></td>
<td class="valign" data-bind="text: FirstName"></td> <td class="valign" data-bind="text: FirstName"></td>
<td class="valign" data-bind="text: LastName"></td>
<td class="valign text-center"><span data-bind="css:{ 'glyphicon glyphicon-ok': IsContractor}"></span></td>
<td class="fit"><button data-bind="click: $root.goToUserDetails" class="btn btn-default">Details</button></td> <td class="fit"><button data-bind="click: $root.goToUserDetails" class="btn btn-default">Details</button></td>
<td class="fit hidden-md-down"><button data-bind="click: $root.goToTimeLogs" class="btn btn-default">View Logs</button></td> <td class="fit hidden-md-down"><button data-bind="click: $root.goToTimeLogs" class="btn btn-default">View Logs</button></td>
</tr> </tr>

View File

@ -134,7 +134,7 @@
if (hrs < 1) { if (hrs < 1) {
return value + " mins"; return value + " mins";
} }
return (value / 60)+" hrs"; return self.round(hrs, 2)+" hrs";
}; };
self.convertToDisplayTime = function (dateValue) { self.convertToDisplayTime = function (dateValue) {
var date = new Date(dateValue); var date = new Date(dateValue);
@ -146,6 +146,9 @@
} }
return logCount; return logCount;
} }
self.round = function (value, decimals) {
return parseFloat(Math.round(value * 100) / 100).toFixed(decimals);
}
self.getTimeLogEntryArrayLength = function(maxDailyLogs) { self.getTimeLogEntryArrayLength = function(maxDailyLogs) {
return Math.round(maxDailyLogs/2); return Math.round(maxDailyLogs/2);
}; };

View File

@ -2,8 +2,8 @@
<configuration> <configuration>
<appSettings> <appSettings>
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" /> <add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
<add key="DefaultPageSize" value="20"/> <add key="DefaultPageSize" value="20" />
<add key="SwipeTimeGap" value="20"/> <add key="SwipeTimeGap" value="20" />
</appSettings> </appSettings>
<startup> <startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" /> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />