fix relative file paths (file not found errors).
added razor engine to WindowsDataCenter project. fixed odd logCount errors in spa.js/index.html
This commit is contained in:
parent
aca00e95ed
commit
ebfced87ee
Binary file not shown.
@ -1,5 +1,7 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using ILogger = Interfaces.ILogger;
|
||||
@ -11,7 +13,7 @@ namespace NLogLogger
|
||||
private NLog.Logger _logger;
|
||||
public NLogger()
|
||||
{
|
||||
var nlogConfigPath = ConfigurationManager.AppSettings["NLogConfigFilePath"];
|
||||
var nlogConfigPath = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), ConfigurationManager.AppSettings["NLogConfigFilePath"])).LocalPath;
|
||||
if (nlogConfigPath == null)
|
||||
{
|
||||
throw new ArgumentNullException("nlogConfigPath");
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Interfaces;
|
||||
using SQLite.Net;
|
||||
@ -17,6 +19,9 @@ namespace SQLiteRepository
|
||||
|
||||
public SQLiteRepository(ILogger logger)
|
||||
{
|
||||
_path =
|
||||
new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), "flexitimedb.db"))
|
||||
.LocalPath;
|
||||
if (logger == null) throw new ArgumentNullException(nameof(logger));
|
||||
_logger = logger;
|
||||
|
||||
|
||||
@ -11,6 +11,8 @@
|
||||
<AssemblyName>SQLiteRepository</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@ -44,6 +46,10 @@
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<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>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@ -71,6 +77,13 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Data.SQLite.Core.1.0.104.0\build\net451\System.Data.SQLite.Core.targets'))" />
|
||||
</Target>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
|
||||
@ -2,4 +2,5 @@
|
||||
<packages>
|
||||
<package id="SQLite.Net.Core-PCL" version="3.1.1" targetFramework="net452" />
|
||||
<package id="SQLite.Net-PCL" version="3.1.1" targetFramework="net452" />
|
||||
<package id="System.Data.SQLite.Core" version="1.0.104.0" targetFramework="net452" />
|
||||
</packages>
|
||||
BIN
DataCenter_Windows/WindowsDataCenter/Sentinel.zip
Normal file
BIN
DataCenter_Windows/WindowsDataCenter/Sentinel.zip
Normal file
Binary file not shown.
@ -4,6 +4,11 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsDataCenter", "WindowsDataCenter\WindowsDataCenter.csproj", "{A5FEE048-17A6-4966-9B6B-BF073592A470}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{6E48913F-9D8C-4132-93A7-C7B1C6DD5264} = {6E48913F-9D8C-4132-93A7-C7B1C6DD5264}
|
||||
{1C5220D6-9166-4F47-B57D-BEB4D09D2A3F} = {1C5220D6-9166-4F47-B57D-BEB4D09D2A3F}
|
||||
{5F30E8E4-5107-4C99-ADFF-38D735DC113D} = {5F30E8E4-5107-4C99-ADFF-38D735DC113D}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WindowsDataServiceHost", "WindowsDataServiceHost\WindowsDataServiceHost.csproj", "{5A4E2CF2-FA51-413E-82C7-14A19A50766D}"
|
||||
EndProject
|
||||
|
||||
@ -1,9 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
|
||||
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="NLogConfigFilePath" value="Configs/NLogConfig.xml" />
|
||||
</appSettings>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
|
||||
</startup>
|
||||
@ -21,18 +20,10 @@
|
||||
<assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="RazorEngine" publicKeyToken="9ee697374c7e744a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-3.7.2.0" newVersion="3.7.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<entityFramework>
|
||||
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
|
||||
<parameters>
|
||||
<parameter value="v13.0" />
|
||||
</parameters>
|
||||
</defaultConnectionFactory>
|
||||
<providers>
|
||||
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
|
||||
<provider invariantName="System.Data.SQLite.EF6" type="System.Data.SQLite.EF6.SQLiteProviderServices, System.Data.SQLite.EF6" />
|
||||
</providers>
|
||||
</entityFramework>
|
||||
|
||||
</configuration>
|
||||
@ -15,10 +15,12 @@ namespace WindowsDataCenter
|
||||
{
|
||||
var kernel = new StandardKernel();
|
||||
kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>();
|
||||
|
||||
if (File.Exists("NinjectConfig.xml"))
|
||||
var ninjectConfigPath =
|
||||
new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), "NinjectConfig.xml"))
|
||||
.LocalPath;
|
||||
if (File.Exists(ninjectConfigPath))
|
||||
{
|
||||
kernel.Load("NinjectConfig.xml");
|
||||
kernel.Load(ninjectConfigPath);
|
||||
}
|
||||
|
||||
var logger = kernel.TryGet<ILogger>();
|
||||
@ -32,9 +34,11 @@ namespace WindowsDataCenter
|
||||
var repo = kernel.TryGet<IRepository>();
|
||||
if (repo == null)
|
||||
{
|
||||
Debug.WriteLine(File.ReadAllText(ninjectConfigPath));
|
||||
logger.Fatal("A type of IRepository must be installed. Exiting.");
|
||||
throw new ArgumentNullException("IRepository");
|
||||
}
|
||||
logger.Trace("Got Repo: {0}", repo.GetType());
|
||||
|
||||
return kernel;
|
||||
}
|
||||
|
||||
@ -15,10 +15,12 @@ namespace WindowsDataCenter
|
||||
private readonly ILogger _logger;
|
||||
public UsersController(IRepository repo, ILogger logger)
|
||||
{
|
||||
if(repo == null) { throw new ArgumentNullException(nameof(repo));}
|
||||
_repo = repo;
|
||||
if(logger == null) { throw new ArgumentNullException(nameof(logger));}
|
||||
_logger = logger;
|
||||
_logger.Trace("Loading Repository..");
|
||||
if(repo == null) { throw new ArgumentNullException(nameof(repo));}
|
||||
_repo = repo;
|
||||
_logger.Trace("Loaded Repository..");
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
|
||||
@ -45,7 +45,15 @@ namespace WindowsDataCenter
|
||||
Name = "OWIN SELF HOST MAIN THREAD"
|
||||
};
|
||||
//TODO: use app.config for endpoint config.
|
||||
_webApp = WebApp.Start<StartOwin>("http://*:8800");
|
||||
try
|
||||
{
|
||||
_webApp = WebApp.Start<StartOwin>("http://*:8800");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnStop()
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
using System.Web.Http;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Web.Http;
|
||||
using DalSoft.WebApi.HelpPage;
|
||||
using Microsoft.Owin.FileSystems;
|
||||
using Microsoft.Owin.StaticFiles;
|
||||
@ -13,18 +16,15 @@ namespace WindowsDataCenter
|
||||
var config = new HttpConfiguration();
|
||||
config.MapHttpAttributeRoutes();
|
||||
|
||||
config.IncludeErrorDetailPolicy = IncludeErrorDetailPolicy.Always;
|
||||
//ninject resolver for ApiController DI.
|
||||
config.DependencyResolver = new NinjectDependencyResolver(NinjectHelper.GetInstance().Kernel);
|
||||
//JSONP formatter for cross-domain requests.
|
||||
config.Formatters.Insert(0, new JsonpFormatter());
|
||||
|
||||
appBuilder.UseWebApi(config);
|
||||
#if DEBUG
|
||||
//Add the help-pages extension only in Debug mode.
|
||||
appBuilder.UseWebApiHelpPage(config, "help-pages");
|
||||
#endif
|
||||
|
||||
var fileSystem = new PhysicalFileSystem(@"./www");
|
||||
var staticFilePaths = new Uri(Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().CodeBase), "www"))
|
||||
.LocalPath;
|
||||
var fileSystem = new PhysicalFileSystem(staticFilePaths);
|
||||
var options = new FileServerOptions
|
||||
{
|
||||
EnableDefaultFiles = true,
|
||||
@ -37,6 +37,13 @@ namespace WindowsDataCenter
|
||||
"index.html"
|
||||
};
|
||||
|
||||
config.EnsureInitialized();
|
||||
appBuilder.UseWebApi(config);
|
||||
#if DEBUG
|
||||
//Add the help-pages extension only in Debug mode.
|
||||
appBuilder.UseWebApiHelpPage(config, "help-pages");
|
||||
#endif
|
||||
|
||||
appBuilder.UseFileServer(options);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,6 +84,10 @@
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RazorEngine, Version=3.7.2.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RazorEngine.3.7.2\lib\net45\RazorEngine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="System.Core" />
|
||||
|
||||
@ -206,7 +206,7 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Day Of Week</th>
|
||||
<!-- ko foreach: new Array(MaxDailyLogCount/2) -->
|
||||
<!-- ko foreach: new Array($root.getTimeLogEntryArrayLength(MaxDailyLogCount)) -->
|
||||
<th>In</th>
|
||||
<th>Out</th>
|
||||
<!-- /ko -->
|
||||
@ -220,14 +220,14 @@
|
||||
<!-- ko foreach: Logs -->
|
||||
<td class="valign" data-bind="text: $root.convertToDisplayTime(EventTime)"></td>
|
||||
<!-- /ko -->
|
||||
<!-- ko foreach: new Array($parent.MaxDailyLogCount-LogCount)-->
|
||||
<!-- ko foreach: new Array($root.correctLogOffset($parent.MaxDailyLogCount)-LogCount)-->
|
||||
<td class="valign"></td>
|
||||
<!-- /ko -->
|
||||
<td class="valign"data-bind="text: $root.convertToHours(DailyTotal)"></td>
|
||||
</tr>
|
||||
<!-- /ko -->
|
||||
<tr>
|
||||
<td class="valign" data-bind="attr:{colspan: MaxDailyLogCount+1}">Weekly Total</td>
|
||||
<td class="valign" data-bind="attr:{colspan: $root.correctLogOffset(MaxDailyLogCount)+1}">Weekly Total</td>
|
||||
<td class="valign" for="dailyHrsTotal" data-bind="text: $root.convertToHours(WeeklyTotal)"></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
@ -140,6 +140,15 @@
|
||||
var date = new Date(dateValue);
|
||||
return date.getHours() + ":" + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
|
||||
};
|
||||
self.correctLogOffset = function (logCount) {
|
||||
if (logCount % 2 !== 0) {
|
||||
logCount += 1;
|
||||
}
|
||||
return logCount;
|
||||
}
|
||||
self.getTimeLogEntryArrayLength = function(maxDailyLogs) {
|
||||
return Math.round(maxDailyLogs/2);
|
||||
};
|
||||
self.dismissAlert = function(data, event) {
|
||||
self.errorData(null);
|
||||
};
|
||||
|
||||
@ -49,10 +49,6 @@
|
||||
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RazorEngine, Version=3.7.2.0, Culture=neutral, PublicKeyToken=9ee697374c7e744a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RazorEngine.3.7.2\lib\net45\RazorEngine.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
@ -101,7 +97,9 @@ copy "$(SolutionDir)NLogLogger\$(OutDir)NLog.dll" "$(TargetDir)"
|
||||
copy "$(SolutionDir)NLogLogger\$(OutDir)NLogLogger.dll.config" "$(TargetDir)"
|
||||
copy "$(SolutionDir)NLogLogger\$(OutDir)NLogConfig.xml" "$(TargetDir)Configs\"
|
||||
|
||||
copy "$(SolutionDir)WindowsDataCenter\$(OutDir)Ninject.Extensions.Xml.dll" "$(TargetDir)"</PostBuildEvent>
|
||||
copy "$(SolutionDir)WindowsDataCenter\$(OutDir)Ninject.Extensions.Xml.dll" "$(TargetDir)"
|
||||
|
||||
copy "$(SolutionDir)WindowsDataCenter\$(OutDir)RazorEngine.dll" "$(TargetDir)"</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user