commit
da01f6670e
@ -5,6 +5,6 @@
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml"/>
|
||||
<add key="DataCenterServiceEndpoint" value="http://localhost:1234"/>
|
||||
<add key="DataCenterServiceEndpoint" value="http://localhost:8800"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@ -142,7 +142,7 @@ namespace CardReaderService
|
||||
{
|
||||
_logger.Trace("Reader failed to connect, error: " + Enum.GetName(typeof(SCardError), err));
|
||||
}
|
||||
|
||||
reader.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -352,15 +352,20 @@ namespace SQLiteRepository
|
||||
|
||||
#region Check the user hasnt registered an event in the last few minutes..
|
||||
|
||||
var hysteresisThresholdMinutes = Convert.ToInt32(ConfigurationManager.AppSettings["SwipeTimeGap"] ?? "3");
|
||||
var threshold = DateTime.UtcNow.AddMinutes(0 - hysteresisThresholdMinutes);
|
||||
var logs = _connection.Query<TimeLogDb>(
|
||||
SQLiteProcedures.GET_LOGS_IN_LAST_X_MINUTES,
|
||||
threshold.Ticks, ident.UserId_FK);
|
||||
if (logs.Any())
|
||||
{
|
||||
logId = -1;
|
||||
return OperationResponse.FAILED;
|
||||
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 threshold = DateTime.UtcNow.AddMinutes(0 - hysteresisThresholdMinutes);
|
||||
var logs = _connection.Query<TimeLogDb>(
|
||||
SQLiteProcedures.GET_LOGS_IN_LAST_X_MINUTES,
|
||||
threshold.Ticks, ident.UserId_FK);
|
||||
_logger.Trace("Checking last swipe event gap");
|
||||
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;
|
||||
return OperationResponse.FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@ -45,6 +45,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<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>
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
||||
<add key="DefaultPageSize" value="20"/>
|
||||
<add key="SwipeTimeGap" value="20"/>
|
||||
<add key="DefaultPageSize" value="20" />
|
||||
<add key="SwipeTimeGap" value="20" />
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
|
||||
@ -49,6 +49,8 @@ namespace WindowsDataCenter
|
||||
/// </summary>
|
||||
/// <param name="log"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
[Route("manual")]
|
||||
public IHttpActionResult ManuallyPostData([FromBody] ManualLog log)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@ -20,7 +20,7 @@ namespace WindowsDataCenter
|
||||
|
||||
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
|
||||
//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.
|
||||
config.Formatters.Insert(0, new JsonpFormatter());
|
||||
|
||||
|
||||
@ -69,7 +69,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Extensions.ContextPreservation, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
@ -85,7 +85,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.Common.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
@ -93,7 +93,7 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<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>
|
||||
</Reference>
|
||||
<Reference Include="Ninject.Web.WebApi.OwinHost, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7, processorArchitecture=MSIL">
|
||||
|
||||
@ -15,13 +15,13 @@
|
||||
<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="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.NamedScope" 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.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="Owin" version="1.0" targetFramework="net452" />
|
||||
<package id="RazorEngine" version="3.7.2" targetFramework="net452" />
|
||||
|
||||
@ -61,20 +61,18 @@
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>UserId</th>
|
||||
<th class="col-md-1">firstName</th>
|
||||
<th class="col-md-1">lastName</th>
|
||||
<th/>
|
||||
<th class="col-md-3">First Name</th>
|
||||
<th class="col-md-3">Last Name</th>
|
||||
<th class="col-md-1 text-center">Contractor</th>
|
||||
<th />
|
||||
<th/>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody data-bind="foreach: Users">
|
||||
<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: 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 hidden-md-down"><button data-bind="click: $root.goToTimeLogs" class="btn btn-default">View Logs</button></td>
|
||||
</tr>
|
||||
|
||||
@ -134,7 +134,7 @@
|
||||
if (hrs < 1) {
|
||||
return value + " mins";
|
||||
}
|
||||
return (value / 60)+" hrs";
|
||||
return self.round(hrs, 2)+" hrs";
|
||||
};
|
||||
self.convertToDisplayTime = function (dateValue) {
|
||||
var date = new Date(dateValue);
|
||||
@ -146,6 +146,9 @@
|
||||
}
|
||||
return logCount;
|
||||
}
|
||||
self.round = function (value, decimals) {
|
||||
return parseFloat(Math.round(value * 100) / 100).toFixed(decimals);
|
||||
}
|
||||
self.getTimeLogEntryArrayLength = function(maxDailyLogs) {
|
||||
return Math.round(maxDailyLogs/2);
|
||||
};
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
||||
<add key="DefaultPageSize" value="20"/>
|
||||
<add key="SwipeTimeGap" value="20"/>
|
||||
<add key="DefaultPageSize" value="20" />
|
||||
<add key="SwipeTimeGap" value="20" />
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
|
||||
Loading…
Reference in New Issue
Block a user