Skip to content

Commit b60c063

Browse files
authored
Merge pull request #111 from Gid733/master
Added plugins to current application
2 parents c328ecc + 53b183f commit b60c063

File tree

128 files changed

+2767
-895
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+2767
-895
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,3 +360,5 @@ eFormAPI/.idea/*
360360
eFormAPI/eFormAPI/expection\.txt
361361

362362
\.DS_Store
363+
364+
eFormAPI/eFormAPI/Plugins/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<configSections>
4+
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
5+
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
6+
</configSections>
7+
<entityFramework>
8+
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
9+
<providers>
10+
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
11+
<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider></providers>
12+
</entityFramework>
13+
<system.data>
14+
<DbProviderFactories>
15+
<remove invariant="MySql.Data.MySqlClient" />
16+
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
17+
</DbProviderFactories>
18+
</system.data>
19+
<runtime>
20+
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
21+
<dependentAssembly>
22+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
23+
<bindingRedirect oldVersion="0.0.0.0-11.0.0.0" newVersion="11.0.0.0" />
24+
</dependentAssembly>
25+
<dependentAssembly>
26+
<assemblyIdentity name="MySql.Data.Entity.EF6" publicKeyToken="c5687fc88969c44d" culture="neutral" />
27+
<bindingRedirect oldVersion="0.0.0.0-6.9.12.0" newVersion="6.9.12.0" />
28+
</dependentAssembly>
29+
</assemblyBinding>
30+
</runtime>
31+
</configuration>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace EformBase.Pn.Consts
2+
{
3+
public class EformRoles
4+
{
5+
public const string Admin = "admin";
6+
public const string User = "user";
7+
}
8+
}
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{E271AA01-FC8D-42F2-ACAA-17AB95E98CA0}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>EformBase.Pn</RootNamespace>
11+
<AssemblyName>EformBase.Pn</AssemblyName>
12+
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>..\..\eFormAPI\Plugins\EformBase\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
<PlatformTarget>x64</PlatformTarget>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<Reference Include="AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
35+
<HintPath>packages\AWSSDK.Core.3.3.22\lib\net45\AWSSDK.Core.dll</HintPath>
36+
</Reference>
37+
<Reference Include="AWSSDK.SQS, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604, processorArchitecture=MSIL">
38+
<HintPath>packages\AWSSDK.SQS.3.3.3.6\lib\net45\AWSSDK.SQS.dll</HintPath>
39+
</Reference>
40+
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
41+
<HintPath>packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll</HintPath>
42+
</Reference>
43+
<Reference Include="Castle.Windsor, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
44+
<HintPath>packages\Castle.Windsor.4.1.0\lib\net45\Castle.Windsor.dll</HintPath>
45+
</Reference>
46+
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
47+
<HintPath>packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
48+
</Reference>
49+
<Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
50+
<HintPath>packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
51+
</Reference>
52+
<Reference Include="EPPlus, Version=4.5.1.0, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
53+
<HintPath>packages\EPPlus.4.5.1\lib\net40\EPPlus.dll</HintPath>
54+
</Reference>
55+
<Reference Include="Microting.eForm, Version=2.1.220.0, Culture=neutral, processorArchitecture=AMD64">
56+
<HintPath>packages\Microting.eForm.2.1.220\lib\net45\Microting.eForm.dll</HintPath>
57+
</Reference>
58+
<Reference Include="MySql.Data, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
59+
<HintPath>packages\MySql.Data.6.9.12\lib\net45\MySql.Data.dll</HintPath>
60+
</Reference>
61+
<Reference Include="MySql.Data.Entity.EF6, Version=6.9.12.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
62+
<HintPath>packages\MySql.Data.Entity.6.9.12\lib\net45\MySql.Data.Entity.EF6.dll</HintPath>
63+
</Reference>
64+
<Reference Include="Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
65+
<HintPath>packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
66+
</Reference>
67+
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
68+
<HintPath>packages\NLog.4.3.11\lib\net45\NLog.dll</HintPath>
69+
</Reference>
70+
<Reference Include="PresentationCore" />
71+
<Reference Include="Rebus, Version=4.2.1.0, Culture=neutral, processorArchitecture=MSIL">
72+
<HintPath>packages\Rebus.4.2.1\lib\net45\Rebus.dll</HintPath>
73+
</Reference>
74+
<Reference Include="Rebus.CastleWindsor, Version=4.1.0.0, Culture=neutral, processorArchitecture=MSIL">
75+
<HintPath>packages\Rebus.Castle.Windsor.4.1.0\lib\net45\Rebus.CastleWindsor.dll</HintPath>
76+
</Reference>
77+
<Reference Include="Rebus.SqlServer, Version=4.0.0.0, Culture=neutral, processorArchitecture=MSIL">
78+
<HintPath>packages\Rebus.SqlServer.4.0.0\lib\net45\Rebus.SqlServer.dll</HintPath>
79+
</Reference>
80+
<Reference Include="System" />
81+
<Reference Include="System.ComponentModel.DataAnnotations" />
82+
<Reference Include="System.Configuration" />
83+
<Reference Include="System.Core" />
84+
<Reference Include="System.Drawing" />
85+
<Reference Include="System.Net.Http.Formatting, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
86+
<HintPath>packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
87+
</Reference>
88+
<Reference Include="System.Runtime.Remoting" />
89+
<Reference Include="System.Security" />
90+
<Reference Include="System.Transactions" />
91+
<Reference Include="System.Web" />
92+
<Reference Include="System.Web.Http, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
93+
<HintPath>packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
94+
</Reference>
95+
<Reference Include="System.Xml.Linq" />
96+
<Reference Include="System.Data.DataSetExtensions" />
97+
<Reference Include="Microsoft.CSharp" />
98+
<Reference Include="System.Data" />
99+
<Reference Include="System.Net.Http" />
100+
<Reference Include="System.Xml" />
101+
</ItemGroup>
102+
<ItemGroup>
103+
<Compile Include="Consts\EformRoles.cs" />
104+
<Compile Include="Infrastructure\Handlers\GenerateJasperFilesHandler.cs" />
105+
<Compile Include="Infrastructure\EFormCoreHelper.cs" />
106+
<Compile Include="Infrastructure\Installers\RebusInstaller.cs" />
107+
<Compile Include="Infrastructure\Installers\RebusHandlerInstaller.cs" />
108+
<Compile Include="Infrastructure\Messages\GenerateJasperFiles.cs" />
109+
<Compile Include="Properties\AssemblyInfo.cs" />
110+
</ItemGroup>
111+
<ItemGroup>
112+
<None Include="App.config" />
113+
<None Include="packages.config" />
114+
</ItemGroup>
115+
<ItemGroup>
116+
<Analyzer Include="packages\AWSSDK.SQS.3.3.3.6\analyzers\dotnet\cs\AWSSDK.SQS.CodeAnalysis.dll" />
117+
</ItemGroup>
118+
<ItemGroup>
119+
<Content Include="JasperExporter.jar" />
120+
</ItemGroup>
121+
<ItemGroup>
122+
<Folder Include="Controllers\" />
123+
</ItemGroup>
124+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
125+
</Project>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27428.2015
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EformBase.Pn", "EformBase.Pn.csproj", "{E271AA01-FC8D-42F2-ACAA-17AB95E98CA0}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{E271AA01-FC8D-42F2-ACAA-17AB95E98CA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E271AA01-FC8D-42F2-ACAA-17AB95E98CA0}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E271AA01-FC8D-42F2-ACAA-17AB95E98CA0}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E271AA01-FC8D-42F2-ACAA-17AB95E98CA0}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {E3401A25-499A-49D2-9D69-102FE8D30456}
24+
EndGlobalSection
25+
EndGlobal
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
using System;
2+
using System.Linq;
3+
using System.Net;
4+
using System.Web.Http;
5+
using Castle.MicroKernel.Registration;
6+
using Castle.Windsor;
7+
using eFormCore;
8+
using EformBase.Pn.Infrastructure.Installers;
9+
using NLog;
10+
using Rebus.Bus;
11+
12+
namespace EformBase.Pn.Infrastructure
13+
{
14+
public class EFormCoreHelper
15+
{
16+
private Core _core;
17+
private readonly Logger Logger = LogManager.GetCurrentClassLogger();
18+
private IWindsorContainer container;
19+
public IBus bus;
20+
21+
public Core GetCore()
22+
{
23+
string[] lines;
24+
try
25+
{
26+
lines =
27+
System.IO.File.ReadAllLines(System.Web.Hosting.HostingEnvironment.MapPath("~/bin/Input.txt"));
28+
29+
if (string.IsNullOrEmpty(lines[0]))
30+
{
31+
throw new Exception();
32+
}
33+
}
34+
catch (Exception)
35+
{
36+
throw new HttpResponseException(HttpStatusCode.Unauthorized);
37+
}
38+
39+
40+
var connectionStr = lines.First();
41+
42+
_core = new Core();
43+
var running = false;
44+
_core.HandleEventException += EventException;
45+
46+
try
47+
{
48+
running = _core.StartSqlOnly(connectionStr);
49+
}
50+
catch (Exception)
51+
{
52+
AdminTools adminTools = new AdminTools(connectionStr);
53+
adminTools.MigrateDb();
54+
adminTools.DbSettingsReloadRemote();
55+
running = _core.StartSqlOnly(connectionStr);
56+
}
57+
58+
if (running)
59+
{
60+
container = new WindsorContainer();
61+
container.Register(Component.For<Core>().Instance(_core));
62+
container.Install(new RebusHandlerInstaller(), new RebusInstaller(System.Configuration.ConfigurationManager.ConnectionStrings["eFormMainConnection"].ConnectionString));
63+
this.bus = container.Resolve<IBus>();
64+
return _core;
65+
}
66+
Logger.Error("Core is not running");
67+
throw new Exception("Core is not running");
68+
}
69+
70+
#region events
71+
72+
public void EventException(object sender, EventArgs args)
73+
{
74+
try
75+
{
76+
Logger.Trace(sender + Environment.NewLine);
77+
}
78+
catch (Exception ex)
79+
{
80+
if (ex.Message.Contains("bin") && ex.Message.Contains("log.txt"))
81+
{
82+
System.IO.Directory.CreateDirectory(
83+
System.Web.Hosting.HostingEnvironment.MapPath("~/bin/log/log.txt"));
84+
}
85+
EventException(ex, EventArgs.Empty);
86+
}
87+
}
88+
89+
#endregion
90+
}
91+
}

eFormAPI/eFormAPI/Handlers/GenerateJasperFilesHandler.cs renamed to eFormAPI/Plugins/EformBase.Pn/Infrastructure/Handlers/GenerateJasperFilesHandler.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using eFormAPI.Web.Messages;
1+
using System;
22
using System.Threading.Tasks;
3-
using Rebus.Handlers;
4-
using System;
53
using eFormCore;
4+
using EformBase.Pn.Infrastructure.Messages;
5+
using Rebus.Handlers;
66

7-
namespace eFormAPI.Web.Handlers
7+
namespace EformBase.Pn.Infrastructure.Handlers
88
{
99
public class GenerateJasperFilesHandler : IHandleMessages<GenerateJasperFiles>
1010
{
@@ -15,7 +15,7 @@ public GenerateJasperFilesHandler(Core core)
1515
_core = core;
1616
}
1717

18-
#pragma warning disable 1998
18+
#pragma warning disable 1998
1919
public async Task Handle(GenerateJasperFiles message)
2020
{
2121
int? caseId = _core.CaseReadFirstId(message.TemplateId, "not_removed");
@@ -25,4 +25,4 @@ public async Task Handle(GenerateJasperFiles message)
2525
}
2626
}
2727
}
28-
}
28+
}

eFormAPI/eFormAPI/Installers/RebusHandlerInstaller.cs renamed to eFormAPI/Plugins/EformBase.Pn/Infrastructure/Installers/RebusHandlerInstaller.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
using Castle.MicroKernel.Registration;
1+
using Castle.MicroKernel.Registration;
22
using Castle.MicroKernel.SubSystems.Configuration;
33
using Castle.Windsor;
44
using Rebus.Handlers;
55

6-
namespace eFormAPI.Web.Installers
6+
namespace EformBase.Pn.Infrastructure.Installers
77
{
88
public class RebusHandlerInstaller : IWindsorInstaller
99
{

eFormAPI/eFormAPI/Installers/RebusInstaller.cs renamed to eFormAPI/Plugins/EformBase.Pn/Infrastructure/Installers/RebusInstaller.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
using Castle.MicroKernel.Registration;
1+
using System;
2+
using Castle.MicroKernel.Registration;
23
using Castle.MicroKernel.SubSystems.Configuration;
34
using Castle.Windsor;
45
using Rebus.Config;
5-
using System;
66

7-
namespace eFormAPI.Web.Installers
7+
namespace EformBase.Pn.Infrastructure.Installers
88
{
99
public class RebusInstaller : IWindsorInstaller
1010
{
@@ -20,7 +20,8 @@ public void Install(IWindsorContainer container, IConfigurationStore store)
2020
{
2121
Configure.With(new CastleWindsorContainerAdapter(container))
2222
.Logging(l => l.ColoredConsole())
23-
.Transport(t => t.UseSqlServer(connectionStringOrConnectionStringName: connectionString, tableName: "Rebus", inputQueueName: "angular-input"))
23+
.Transport(t => t.UseSqlServer(connectionStringOrConnectionStringName: connectionString,
24+
tableName: "Rebus", inputQueueName: "angular-input"))
2425
.Options(o =>
2526
{
2627
o.SetMaxParallelism(1);

eFormAPI/eFormAPI/Messages/GenerateJasperFiles.cs renamed to eFormAPI/Plugins/EformBase.Pn/Infrastructure/Messages/GenerateJasperFiles.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace eFormAPI.Web.Messages
1+
namespace EformBase.Pn.Infrastructure.Messages
22
{
33
public class GenerateJasperFiles
44
{
@@ -9,4 +9,4 @@ public GenerateJasperFiles(int templateId)
99
this.TemplateId = templateId;
1010
}
1111
}
12-
}
12+
}

0 commit comments

Comments
 (0)