Skip to content

Commit

Permalink
Request window added
Browse files Browse the repository at this point in the history
  • Loading branch information
xtenzQ committed Mar 14, 2019
1 parent c2da6d9 commit 3a45479
Show file tree
Hide file tree
Showing 35 changed files with 722 additions and 99 deletions.
21 changes: 21 additions & 0 deletions ResearchersWPF.Business/Logic/Request.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using ResearchersWPF.Data.Managers;

namespace ResearchersWPF.Business.Logic
{
public class Request
{
public int GetPresentationRequest(DateTime dateTime)
{
var manager = new FactoryManager();
return manager.GetRequestManager().GetPresentation(dateTime);
}

public int GetReportRequest(int departmentNumber)
{
var manager = new FactoryManager();
return manager.GetRequestManager().GetReport(departmentNumber);
}
}
}
1 change: 1 addition & 0 deletions ResearchersWPF.Business/ResearchersWPF.Business.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Compile Include="Logic\Monograph.cs" />
<Compile Include="Logic\Presentation.cs" />
<Compile Include="Logic\Report.cs" />
<Compile Include="Logic\Request.cs" />
<Compile Include="Logic\Researcher.cs" />
<Compile Include="Logic\ResearcherManager.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
1 change: 1 addition & 0 deletions ResearchersWPF.Data/IManagers/IDataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ public interface IDataManager
IMonographManager GetMonographManager();
IPresentationManager GetPresentationManager();
IReportManager GetReportManager();
IRequestManager GetRequestManager();
}
}
10 changes: 10 additions & 0 deletions ResearchersWPF.Data/IManagers/IRequestManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System;

namespace ResearchersWPF.Data.IManagers
{
public interface IRequestManager
{
int GetPresentation(DateTime dateTime);
int GetReport(int departmentNumber);
}
}
5 changes: 5 additions & 0 deletions ResearchersWPF.Data/Managers/EntityFrameworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,10 @@ public IReportManager GetReportManager()
{
return new ReportManager();
}

public IRequestManager GetRequestManager()
{
return new RequestManager();
}
}
}
5 changes: 5 additions & 0 deletions ResearchersWPF.Data/Managers/FactoryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,10 @@ public IReportManager GetReportManager()
{
return _dataManager.GetReportManager();
}

public IRequestManager GetRequestManager()
{
return _dataManager.GetRequestManager();
}
}
}
28 changes: 28 additions & 0 deletions ResearchersWPF.Data/Managers/RequestManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System;
using System.Linq;
using Microsoft.EntityFrameworkCore;
using ResearchersWPF.Data.IManagers;
using ResearchersWPF.Data.Model;

namespace ResearchersWPF.Data.Managers
{
public class RequestManager : IRequestManager
{
public int GetPresentation(DateTime dateTime)
{
using (var context = new ResDbContext())
{
return context.Presentations.Count(i => i.PresentationDate < dateTime);
}
}

public int GetReport(int departmentNumber)
{
using (var context = new ResDbContext())
{
return context.Reports.Where(i => i.Researcher.DepartmentNumber == departmentNumber)
.Sum(i => i.PageCount);
}
}
}
}
2 changes: 2 additions & 0 deletions ResearchersWPF.Data/ResearchersWPF.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -160,13 +160,15 @@
<Compile Include="IManagers\IMonographManager.cs" />
<Compile Include="IManagers\IPresentationManager.cs" />
<Compile Include="IManagers\IReportManager.cs" />
<Compile Include="IManagers\IRequestManager.cs" />
<Compile Include="IManagers\IResearcherManager.cs" />
<Compile Include="Managers\ArticleManager.cs" />
<Compile Include="Managers\EntityFrameworkManager.cs" />
<Compile Include="Managers\FactoryManager.cs" />
<Compile Include="Managers\MonographManager.cs" />
<Compile Include="Managers\PresentationManager.cs" />
<Compile Include="Managers\ReportManager.cs" />
<Compile Include="Managers\RequestManager.cs" />
<Compile Include="Managers\ResearcherManager.cs" />
<Compile Include="Model\Article.cs" />
<Compile Include="Model\ResDbContext.cs" />
Expand Down
Binary file modified ResearchersWPF.Service/App_Data/Researchers.db
Binary file not shown.
10 changes: 10 additions & 0 deletions ResearchersWPF.Service/DataContracts/Request.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Runtime.Serialization;

namespace ResearchersWPF.Service.DataContracts
{
[DataContract]
public class Request
{

}
}
15 changes: 15 additions & 0 deletions ResearchersWPF.Service/IServices/IRequestService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.ServiceModel;

namespace ResearchersWPF.Service.IServices
{
[ServiceContract]
public interface IRequestService
{
[OperationContract]
int GetPresentationRequest(DateTime dateTime);

[OperationContract]
int GetReportRequest(int departmentNumber);
}
}
6 changes: 6 additions & 0 deletions ResearchersWPF.Service/ResearchersWPF.Service.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
<Content Include="Services\MonographService.svc" />
<Content Include="Services\PresentationService.svc" />
<Content Include="Services\ReportService.svc" />
<Content Include="Services\RequestService.svc" />
<Content Include="Services\ResearcherService.svc" />
<Content Include="Web.config" />
</ItemGroup>
Expand All @@ -73,11 +74,13 @@
<Compile Include="DataContracts\Monograph.cs" />
<Compile Include="DataContracts\Presentation.cs" />
<Compile Include="DataContracts\Report.cs" />
<Compile Include="DataContracts\Request.cs" />
<Compile Include="DataContracts\Researcher.cs" />
<Compile Include="IServices\IArticleService.cs" />
<Compile Include="IServices\IMonographService.cs" />
<Compile Include="IServices\IPresentationService.cs" />
<Compile Include="IServices\IReportService.cs" />
<Compile Include="IServices\IRequestService.cs" />
<Compile Include="Services\ArticleService.svc.cs">
<DependentUpon>ArticleService.svc</DependentUpon>
</Compile>
Expand All @@ -90,6 +93,9 @@
<Compile Include="Services\ReportService.svc.cs">
<DependentUpon>ReportService.svc</DependentUpon>
</Compile>
<Compile Include="Services\RequestService.svc.cs">
<DependentUpon>RequestService.svc</DependentUpon>
</Compile>
<Compile Include="Services\ResearcherService.svc.cs">
<DependentUpon>ResearcherService.svc</DependentUpon>
</Compile>
Expand Down
1 change: 1 addition & 0 deletions ResearchersWPF.Service/Services/RequestService.svc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<%@ ServiceHost Language="C#" Debug="true" Service="ResearchersWPF.Service.Services.RequestService" CodeBehind="RequestService.svc.cs" %>
25 changes: 25 additions & 0 deletions ResearchersWPF.Service/Services/RequestService.svc.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using ResearchersWPF.Service.IServices;

namespace ResearchersWPF.Service.Services
{
// ПРИМЕЧАНИЕ. Команду "Переименовать" в меню "Рефакторинг" можно использовать для одновременного изменения имени класса "RequestService" в коде, SVC-файле и файле конфигурации.
// ПРИМЕЧАНИЕ. Чтобы запустить клиент проверки WCF для тестирования службы, выберите элементы RequestService.svc или RequestService.svc.cs в обозревателе решений и начните отладку.
public class RequestService : IRequestService
{
public int GetPresentationRequest(DateTime dateTime)
{
return new Business.Logic.Request().GetPresentationRequest(dateTime);
}

public int GetReportRequest(int departmentNumber)
{
return new Business.Logic.Request().GetReportRequest(departmentNumber);
}
}
}
119 changes: 68 additions & 51 deletions ResearchersWPF.UI/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -8,67 +8,81 @@
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IArticleService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IMonographService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IPresentationService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IReportService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IResearcherService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
<binding name="BasicHttpBinding_IRequestService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536"
textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true"
messageEncoding="Text">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
Expand All @@ -95,6 +109,9 @@
<endpoint address="http://localhost:61740/Services/ResearcherService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IResearcherService"
contract="svcResearcher.IResearcherService" name="BasicHttpBinding_IResearcherService" />
<endpoint address="http://localhost:61740/Services/RequestService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IRequestService"
contract="svcRequest.IRequestService" name="BasicHttpBinding_IRequestService" />
</client>
</system.serviceModel>
</configuration>
Loading

0 comments on commit 3a45479

Please sign in to comment.