Add Api Endpoint to save/retrieve the active policy.Policy
Add SQLite code to save the policy html/markdown scripts from the user #94
This commit is contained in:
parent
f286498540
commit
dc2210b5b3
@ -112,5 +112,9 @@ namespace Interfaces
|
||||
OperationResponse DeleteLog(TimeLog log);
|
||||
OperationResponse CreateLog(TimeLog log);
|
||||
OperationResponse UpdateLog(TimeLog log);
|
||||
|
||||
Policy GetPolicy();
|
||||
|
||||
void SavePolicy(Policy policy);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,87 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B7347B72-E208-423A-9D99-723B558EA3D7}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Interfaces</RootNamespace>
|
||||
<AssemblyName>Interfaces</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugInstallers|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\DebugInstallers\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseInstallers|AnyCPU'">
|
||||
<OutputPath>bin\ReleaseInstallers\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppDetails.cs" />
|
||||
<Compile Include="DailyLogs.cs" />
|
||||
<Compile Include="EventLogResponse.cs" />
|
||||
<Compile Include="Group.cs" />
|
||||
<Compile Include="GroupList.cs" />
|
||||
<Compile Include="ILogger.cs" />
|
||||
<Compile Include="IRepository.cs" />
|
||||
<Compile Include="Identifier.cs" />
|
||||
<Compile Include="IdentifierList.cs" />
|
||||
<Compile Include="ManualLog.cs" />
|
||||
<Compile Include="OperationResponse.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TimeLog.cs" />
|
||||
<Compile Include="TimeLogList.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
<Compile Include="UserList.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B7347B72-E208-423A-9D99-723B558EA3D7}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Interfaces</RootNamespace>
|
||||
<AssemblyName>Interfaces</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugInstallers|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\DebugInstallers\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseInstallers|AnyCPU'">
|
||||
<OutputPath>bin\ReleaseInstallers\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AppDetails.cs" />
|
||||
<Compile Include="DailyLogs.cs" />
|
||||
<Compile Include="EventLogResponse.cs" />
|
||||
<Compile Include="Group.cs" />
|
||||
<Compile Include="GroupList.cs" />
|
||||
<Compile Include="ILogger.cs" />
|
||||
<Compile Include="IRepository.cs" />
|
||||
<Compile Include="Identifier.cs" />
|
||||
<Compile Include="IdentifierList.cs" />
|
||||
<Compile Include="ManualLog.cs" />
|
||||
<Compile Include="OperationResponse.cs" />
|
||||
<Compile Include="Policy.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="TimeLog.cs" />
|
||||
<Compile Include="TimeLogList.cs" />
|
||||
<Compile Include="User.cs" />
|
||||
<Compile Include="UserList.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
-->
|
||||
</Project>
|
||||
18
DataCenter_Windows/WindowsDataCenter/Interfaces/Policy.cs
Normal file
18
DataCenter_Windows/WindowsDataCenter/Interfaces/Policy.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Interfaces
|
||||
{
|
||||
public class Policy
|
||||
{
|
||||
public DateTime ChangeDate { get; set; }
|
||||
public string ChangeDescription { get; set; }
|
||||
public string ChangeAuthor { get; set; }
|
||||
public string Version { get; set; }
|
||||
public string Markdown { get; set; }
|
||||
public string Html { get; set; }
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
using Interfaces;
|
||||
|
||||
namespace SQLiteRepository.Converters
|
||||
{
|
||||
static class PolicyConverter
|
||||
{
|
||||
public static Policy ConvertToPolicyDto(PolicyDb policyDb)
|
||||
{
|
||||
if (policyDb == null) return null;
|
||||
return new Policy
|
||||
{
|
||||
ChangeDescription = policyDb.ChangeDescription,
|
||||
ChangeDate = policyDb.ChangeDate.UtcDateTime,
|
||||
Html = policyDb.Html,
|
||||
Version = policyDb.Version,
|
||||
ChangeAuthor = policyDb.ChangeAuthor,
|
||||
Markdown = policyDb.Markdown
|
||||
};
|
||||
}
|
||||
|
||||
public static PolicyDb ConvertFromPolicyDto(Policy policy)
|
||||
{
|
||||
if (policy == null) return null;
|
||||
return new PolicyDb
|
||||
{
|
||||
ChangeDescription = policy.ChangeDescription,
|
||||
ChangeDate = policy.ChangeDate,
|
||||
Html = policy.Html,
|
||||
Version = policy.Version,
|
||||
ChangeAuthor = policy.ChangeAuthor,
|
||||
Markdown = policy.Markdown
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using SQLite.Net.Attributes;
|
||||
|
||||
namespace SQLiteRepository
|
||||
{
|
||||
internal class PolicyDb
|
||||
{
|
||||
[PrimaryKey, AutoIncrement]
|
||||
public int Id { get; set; }
|
||||
public DateTimeOffset ChangeDate { get; set; }
|
||||
|
||||
public string ChangeDescription { get; set; }
|
||||
|
||||
public string ChangeAuthor { get; set; }
|
||||
|
||||
public string Version { get; set; }
|
||||
|
||||
public string Markdown { get; set; }
|
||||
|
||||
public string Html { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@ -38,6 +38,8 @@ namespace SQLiteRepository
|
||||
_connection.CreateTable<GroupDb>();
|
||||
_connection.CreateTable<UserGroupJoinDb>();
|
||||
_connection.CreateTable<DbVersion>();
|
||||
_connection.CreateTable<PolicyDb>();
|
||||
|
||||
_logger.Trace("Initialised SQLite Repository");
|
||||
_logger.Trace("Checking For Upgrades");
|
||||
CheckForDbUpgrade();
|
||||
@ -519,7 +521,35 @@ namespace SQLiteRepository
|
||||
|
||||
return OperationResponse.UPDATED;
|
||||
}
|
||||
|
||||
|
||||
public Policy GetPolicy()
|
||||
{
|
||||
var query = $"select * from {nameof(PolicyDb)}";
|
||||
var policies = _connection.Query<PolicyDb>(query);
|
||||
|
||||
|
||||
return PolicyConverter.ConvertToPolicyDto(policies.OrderByDescending(x => x.Version).FirstOrDefault());
|
||||
}
|
||||
|
||||
public void SavePolicy(Policy policy)
|
||||
{
|
||||
if (string.IsNullOrEmpty(policy.Version))
|
||||
{
|
||||
policy.Version = (GetNextPolicyVersion()+1).ToString();
|
||||
}
|
||||
var policyDb = PolicyConverter.ConvertFromPolicyDto(policy);
|
||||
_connection.Insert(policyDb);
|
||||
}
|
||||
|
||||
private int GetNextPolicyVersion()
|
||||
{
|
||||
var query = $"select Max({nameof(PolicyDb.Id)}) from {nameof(PolicyDb)}";
|
||||
|
||||
var id = _connection.ExecuteScalar<int>(query);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
private int GetUserCount()
|
||||
{
|
||||
return _connection.ExecuteScalar<int>(SQLiteProcedures.GET_TOTAL_USER_COUNT);
|
||||
|
||||
@ -1,129 +1,131 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B3510C81-F069-48A2-B826-EBE0CE7AB0B2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SQLiteRepository</RootNamespace>
|
||||
<AssemblyName>SQLiteRepository</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugInstallers|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\DebugInstallers\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseInstallers|AnyCPU'">
|
||||
<OutputPath>bin\ReleaseInstallers\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SQLite.Net, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SQLite.Net.Platform.Generic, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SQLite.Net.Platform.Win32, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll</HintPath>
|
||||
<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>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CardUniqueId.cs" />
|
||||
<Compile Include="Converters\LogDirectionConverter.cs" />
|
||||
<Compile Include="Converters\LogSourceConverter.cs" />
|
||||
<Compile Include="Converters\TimeLogConverter.cs" />
|
||||
<Compile Include="Converters\UserConverter.cs" />
|
||||
<Compile Include="DBVersion.cs" />
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="GroupDb.cs" />
|
||||
<Compile Include="LogSourceDb.cs" />
|
||||
<Compile Include="SQLiteRepository.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SQLiteProcedures.cs" />
|
||||
<Compile Include="LogDirectionDb.cs" />
|
||||
<Compile Include="TimeLogDb.cs" />
|
||||
<Compile Include="UserGroupJoinDb.cs" />
|
||||
<Compile Include="UserIdentity.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ConfigurationHandler\ConfigurationHandler.csproj">
|
||||
<Project>{115250F6-F8C4-4F9B-A15F-251EA258D963}</Project>
|
||||
<Name>ConfigurationHandler</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Interfaces\Interfaces.csproj">
|
||||
<Project>{B7347B72-E208-423A-9D99-723B558EA3D7}</Project>
|
||||
<Name>Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="UpgradeScripts\0.2.sql" />
|
||||
</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>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{B3510C81-F069-48A2-B826-EBE0CE7AB0B2}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>SQLiteRepository</RootNamespace>
|
||||
<AssemblyName>SQLiteRepository</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'DebugInstallers|AnyCPU'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\DebugInstallers\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'ReleaseInstallers|AnyCPU'">
|
||||
<OutputPath>bin\ReleaseInstallers\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="SQLite.Net, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLite.Net.Core-PCL.3.1.1\lib\portable-win8+net45+wp8+wpa81+MonoAndroid1+MonoTouch1\SQLite.Net.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SQLite.Net.Platform.Generic, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLite.Net-PCL.3.1.1\lib\net40\SQLite.Net.Platform.Generic.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="SQLite.Net.Platform.Win32, Version=3.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SQLite.Net-PCL.3.1.1\lib\net4\SQLite.Net.Platform.Win32.dll</HintPath>
|
||||
<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>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CardUniqueId.cs" />
|
||||
<Compile Include="Converters\LogDirectionConverter.cs" />
|
||||
<Compile Include="Converters\LogSourceConverter.cs" />
|
||||
<Compile Include="Converters\PolicyConverter.cs" />
|
||||
<Compile Include="Converters\TimeLogConverter.cs" />
|
||||
<Compile Include="Converters\UserConverter.cs" />
|
||||
<Compile Include="DBVersion.cs" />
|
||||
<Compile Include="Extensions\Extensions.cs" />
|
||||
<Compile Include="GroupDb.cs" />
|
||||
<Compile Include="LogSourceDb.cs" />
|
||||
<Compile Include="PolicyDb.cs" />
|
||||
<Compile Include="SQLiteRepository.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SQLiteProcedures.cs" />
|
||||
<Compile Include="LogDirectionDb.cs" />
|
||||
<Compile Include="TimeLogDb.cs" />
|
||||
<Compile Include="UserGroupJoinDb.cs" />
|
||||
<Compile Include="UserIdentity.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\ConfigurationHandler\ConfigurationHandler.csproj">
|
||||
<Project>{115250F6-F8C4-4F9B-A15F-251EA258D963}</Project>
|
||||
<Name>ConfigurationHandler</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Interfaces\Interfaces.csproj">
|
||||
<Project>{B7347B72-E208-423A-9D99-723B558EA3D7}</Project>
|
||||
<Name>Interfaces</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="UpgradeScripts\0.2.sql" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
-->
|
||||
</Project>
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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" />
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<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>
|
||||
@ -1,26 +1,51 @@
|
||||
using System.Reflection;
|
||||
using System.Web.Http;
|
||||
using Interfaces;
|
||||
|
||||
namespace WindowsDataCenter
|
||||
{
|
||||
[RoutePrefix("api/app")]
|
||||
public class ApplicationController:ApiController
|
||||
{
|
||||
[Route("")]
|
||||
public IHttpActionResult GetAppDetails()
|
||||
{
|
||||
var ninjectHelper = NinjectHelper.GetInstance();
|
||||
var appDetails = new AppDetails
|
||||
{
|
||||
ApplicationName = "Flexitime Tracker",
|
||||
DataBaseProvider = ninjectHelper.Get<IRepository>().GetType().ToString(),
|
||||
LoggerProvider = ninjectHelper.Get<ILogger>().GetType().ToString(),
|
||||
Version = Assembly.GetEntryAssembly().GetName().Version.ToString(),
|
||||
ErrorEmailAddress = ConfigurationHandler.ConfigurationHandler.GetConfiguration("BugSubmissionEmailAddress") ?? "NONE"
|
||||
};
|
||||
|
||||
return Ok(appDetails);
|
||||
}
|
||||
}
|
||||
}
|
||||
using System.Reflection;
|
||||
using System.Web.Http;
|
||||
using WindowsDataCenter.Helpers;
|
||||
using Interfaces;
|
||||
|
||||
namespace WindowsDataCenter
|
||||
{
|
||||
[RoutePrefix("api/app")]
|
||||
public class ApplicationController:ApiController
|
||||
{
|
||||
private IRepository _repo;
|
||||
public ApplicationController(IRepository repo)
|
||||
{
|
||||
_repo = repo;
|
||||
}
|
||||
|
||||
[Route("")]
|
||||
public IHttpActionResult GetAppDetails()
|
||||
{
|
||||
var ninjectHelper = NinjectHelper.GetInstance();
|
||||
var appDetails = new AppDetails
|
||||
{
|
||||
ApplicationName = "Flexitime Tracker",
|
||||
DataBaseProvider = ninjectHelper.Get<IRepository>().GetType().ToString(),
|
||||
LoggerProvider = ninjectHelper.Get<ILogger>().GetType().ToString(),
|
||||
Version = Assembly.GetEntryAssembly().GetName().Version.ToString(),
|
||||
ErrorEmailAddress = ConfigurationHandler.ConfigurationHandler.GetConfiguration("BugSubmissionEmailAddress") ?? "NONE"
|
||||
};
|
||||
|
||||
return Ok(appDetails);
|
||||
}
|
||||
|
||||
[Route("policy")]
|
||||
[HttpGet]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult GetPolicy()
|
||||
{
|
||||
Policy policy = _repo.GetPolicy();
|
||||
return Json(policy);
|
||||
}
|
||||
|
||||
[Route("policy")]
|
||||
[HttpPost]
|
||||
[CacheControl(MaxAge = 0)]
|
||||
public IHttpActionResult SavePolicy(Policy policy)
|
||||
{
|
||||
_repo.SavePolicy(policy);
|
||||
return Ok(new {}); //empty to ensure ajax triggers Success..
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user