diff --git a/ResearchersWPF.Business/Logic/Request.cs b/ResearchersWPF.Business/Logic/Request.cs new file mode 100644 index 0000000..7aeda74 --- /dev/null +++ b/ResearchersWPF.Business/Logic/Request.cs @@ -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); + } + } +} \ No newline at end of file diff --git a/ResearchersWPF.Business/ResearchersWPF.Business.csproj b/ResearchersWPF.Business/ResearchersWPF.Business.csproj index 86e6e62..2b617da 100644 --- a/ResearchersWPF.Business/ResearchersWPF.Business.csproj +++ b/ResearchersWPF.Business/ResearchersWPF.Business.csproj @@ -50,6 +50,7 @@ + diff --git a/ResearchersWPF.Data/IManagers/IDataManager.cs b/ResearchersWPF.Data/IManagers/IDataManager.cs index ee10357..f86fd14 100644 --- a/ResearchersWPF.Data/IManagers/IDataManager.cs +++ b/ResearchersWPF.Data/IManagers/IDataManager.cs @@ -7,5 +7,6 @@ public interface IDataManager IMonographManager GetMonographManager(); IPresentationManager GetPresentationManager(); IReportManager GetReportManager(); + IRequestManager GetRequestManager(); } } \ No newline at end of file diff --git a/ResearchersWPF.Data/IManagers/IRequestManager.cs b/ResearchersWPF.Data/IManagers/IRequestManager.cs new file mode 100644 index 0000000..e34a6b0 --- /dev/null +++ b/ResearchersWPF.Data/IManagers/IRequestManager.cs @@ -0,0 +1,10 @@ +using System; + +namespace ResearchersWPF.Data.IManagers +{ + public interface IRequestManager + { + int GetPresentation(DateTime dateTime); + int GetReport(int departmentNumber); + } +} \ No newline at end of file diff --git a/ResearchersWPF.Data/Managers/EntityFrameworkManager.cs b/ResearchersWPF.Data/Managers/EntityFrameworkManager.cs index 9340537..1aea0ac 100644 --- a/ResearchersWPF.Data/Managers/EntityFrameworkManager.cs +++ b/ResearchersWPF.Data/Managers/EntityFrameworkManager.cs @@ -28,5 +28,10 @@ public IReportManager GetReportManager() { return new ReportManager(); } + + public IRequestManager GetRequestManager() + { + return new RequestManager(); + } } } \ No newline at end of file diff --git a/ResearchersWPF.Data/Managers/FactoryManager.cs b/ResearchersWPF.Data/Managers/FactoryManager.cs index 523e6ae..4d65c05 100644 --- a/ResearchersWPF.Data/Managers/FactoryManager.cs +++ b/ResearchersWPF.Data/Managers/FactoryManager.cs @@ -35,5 +35,10 @@ public IReportManager GetReportManager() { return _dataManager.GetReportManager(); } + + public IRequestManager GetRequestManager() + { + return _dataManager.GetRequestManager(); + } } } \ No newline at end of file diff --git a/ResearchersWPF.Data/Managers/RequestManager.cs b/ResearchersWPF.Data/Managers/RequestManager.cs new file mode 100644 index 0000000..2b84bd4 --- /dev/null +++ b/ResearchersWPF.Data/Managers/RequestManager.cs @@ -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); + } + } + } +} \ No newline at end of file diff --git a/ResearchersWPF.Data/ResearchersWPF.Data.csproj b/ResearchersWPF.Data/ResearchersWPF.Data.csproj index 75c9ab6..a6f7bc9 100644 --- a/ResearchersWPF.Data/ResearchersWPF.Data.csproj +++ b/ResearchersWPF.Data/ResearchersWPF.Data.csproj @@ -160,6 +160,7 @@ + @@ -167,6 +168,7 @@ + diff --git a/ResearchersWPF.Service/App_Data/Researchers.db b/ResearchersWPF.Service/App_Data/Researchers.db index dd5a45d..3ae0304 100644 Binary files a/ResearchersWPF.Service/App_Data/Researchers.db and b/ResearchersWPF.Service/App_Data/Researchers.db differ diff --git a/ResearchersWPF.Service/DataContracts/Request.cs b/ResearchersWPF.Service/DataContracts/Request.cs new file mode 100644 index 0000000..6140f2b --- /dev/null +++ b/ResearchersWPF.Service/DataContracts/Request.cs @@ -0,0 +1,10 @@ +using System.Runtime.Serialization; + +namespace ResearchersWPF.Service.DataContracts +{ + [DataContract] + public class Request + { + + } +} \ No newline at end of file diff --git a/ResearchersWPF.Service/IServices/IRequestService.cs b/ResearchersWPF.Service/IServices/IRequestService.cs new file mode 100644 index 0000000..354d36e --- /dev/null +++ b/ResearchersWPF.Service/IServices/IRequestService.cs @@ -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); + } +} \ No newline at end of file diff --git a/ResearchersWPF.Service/ResearchersWPF.Service.csproj b/ResearchersWPF.Service/ResearchersWPF.Service.csproj index 9d8fca2..9312ae7 100644 --- a/ResearchersWPF.Service/ResearchersWPF.Service.csproj +++ b/ResearchersWPF.Service/ResearchersWPF.Service.csproj @@ -65,6 +65,7 @@ + @@ -73,11 +74,13 @@ + + ArticleService.svc @@ -90,6 +93,9 @@ ReportService.svc + + RequestService.svc + ResearcherService.svc diff --git a/ResearchersWPF.Service/Services/RequestService.svc b/ResearchersWPF.Service/Services/RequestService.svc new file mode 100644 index 0000000..178bde0 --- /dev/null +++ b/ResearchersWPF.Service/Services/RequestService.svc @@ -0,0 +1 @@ +<%@ ServiceHost Language="C#" Debug="true" Service="ResearchersWPF.Service.Services.RequestService" CodeBehind="RequestService.svc.cs" %> diff --git a/ResearchersWPF.Service/Services/RequestService.svc.cs b/ResearchersWPF.Service/Services/RequestService.svc.cs new file mode 100644 index 0000000..d6aeed4 --- /dev/null +++ b/ResearchersWPF.Service/Services/RequestService.svc.cs @@ -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); + } + } +} diff --git a/ResearchersWPF.UI/App.config b/ResearchersWPF.UI/App.config index c90f935..b11100f 100644 --- a/ResearchersWPF.UI/App.config +++ b/ResearchersWPF.UI/App.config @@ -8,67 +8,81 @@ - - - - - + 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"> + + + + + - - - - - + 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"> + + + + + - - - - - + 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"> + + + + + - - - - - + 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"> + + + + + + + + + + + + + maxBufferPoolSize="524288" maxBufferSize="65536" maxReceivedMessageSize="65536" + textEncoding="utf-8" transferMode="Buffered" useDefaultWebProxy="true" + messageEncoding="Text"> @@ -95,6 +109,9 @@ + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/Reference.cs b/ResearchersWPF.UI/Connected Services/svcRequest/Reference.cs new file mode 100644 index 0000000..1a0bd14 --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/Reference.cs @@ -0,0 +1,74 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace ResearchersWPF.UI.svcRequest { + + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="svcRequest.IRequestService")] + public interface IRequestService { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRequestService/GetPresentationRequest", ReplyAction="http://tempuri.org/IRequestService/GetPresentationRequestResponse")] + int GetPresentationRequest(System.DateTime dateTime); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRequestService/GetPresentationRequest", ReplyAction="http://tempuri.org/IRequestService/GetPresentationRequestResponse")] + System.Threading.Tasks.Task GetPresentationRequestAsync(System.DateTime dateTime); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRequestService/GetReportRequest", ReplyAction="http://tempuri.org/IRequestService/GetReportRequestResponse")] + int GetReportRequest(int departmentNumber); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IRequestService/GetReportRequest", ReplyAction="http://tempuri.org/IRequestService/GetReportRequestResponse")] + System.Threading.Tasks.Task GetReportRequestAsync(int departmentNumber); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IRequestServiceChannel : ResearchersWPF.UI.svcRequest.IRequestService, System.ServiceModel.IClientChannel { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class RequestServiceClient : System.ServiceModel.ClientBase, ResearchersWPF.UI.svcRequest.IRequestService { + + public RequestServiceClient() { + } + + public RequestServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) { + } + + public RequestServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public RequestServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public RequestServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) { + } + + public int GetPresentationRequest(System.DateTime dateTime) { + return base.Channel.GetPresentationRequest(dateTime); + } + + public System.Threading.Tasks.Task GetPresentationRequestAsync(System.DateTime dateTime) { + return base.Channel.GetPresentationRequestAsync(dateTime); + } + + public int GetReportRequest(int departmentNumber) { + return base.Channel.GetReportRequest(departmentNumber); + } + + public System.Threading.Tasks.Task GetReportRequestAsync(int departmentNumber) { + return base.Channel.GetReportRequestAsync(departmentNumber); + } + } +} diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/Reference.svcmap b/ResearchersWPF.UI/Connected Services/svcRequest/Reference.svcmap new file mode 100644 index 0000000..0745534 --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/Reference.svcmap @@ -0,0 +1,34 @@ + + + + false + true + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.disco b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.disco new file mode 100644 index 0000000..22da5ef --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.disco @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.wsdl b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.wsdl new file mode 100644 index 0000000..d852873 --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.wsdl @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.xsd b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.xsd new file mode 100644 index 0000000..859b9c1 --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService.xsd @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/RequestService1.xsd b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService1.xsd new file mode 100644 index 0000000..d58e7f3 --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/RequestService1.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/configuration.svcinfo b/ResearchersWPF.UI/Connected Services/svcRequest/configuration.svcinfo new file mode 100644 index 0000000..934546e --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/configuration.svcinfo @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/Connected Services/svcRequest/configuration91.svcinfo b/ResearchersWPF.UI/Connected Services/svcRequest/configuration91.svcinfo new file mode 100644 index 0000000..55eb150 --- /dev/null +++ b/ResearchersWPF.UI/Connected Services/svcRequest/configuration91.svcinfo @@ -0,0 +1,201 @@ + + + + + + + BasicHttpBinding_IRequestService + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Коллекция) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + + + http://localhost:61740/Services/RequestService.svc + + + + + + basicHttpBinding + + + BasicHttpBinding_IRequestService + + + svcRequest.IRequestService + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + BasicHttpBinding_IRequestService + + + + + + + + + + + \ No newline at end of file diff --git a/ResearchersWPF.UI/MainWindow.xaml b/ResearchersWPF.UI/MainWindow.xaml index e5ac2a0..f9bdf34 100644 --- a/ResearchersWPF.UI/MainWindow.xaml +++ b/ResearchersWPF.UI/MainWindow.xaml @@ -35,9 +35,17 @@ - - - + + + + + + + + Request + + + diff --git a/ResearchersWPF.UI/MainWindow.xaml.cs b/ResearchersWPF.UI/MainWindow.xaml.cs index d7d6587..5eb2f2b 100644 --- a/ResearchersWPF.UI/MainWindow.xaml.cs +++ b/ResearchersWPF.UI/MainWindow.xaml.cs @@ -12,6 +12,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using ResearchersWPF.UI.View; using ResearchersWPF.UI.ViewModel; namespace ResearchersWPF.UI @@ -26,5 +27,11 @@ public MainWindow() InitializeComponent(); DataContext = ResearchersListViewModel.Instance(); } + + private void OpenRequestWindow(object sender, RoutedEventArgs e) + { + var dialog = new Request(); + dialog.ShowDialog(); + } } } diff --git a/ResearchersWPF.UI/ResearchersWPF.UI.csproj b/ResearchersWPF.UI/ResearchersWPF.UI.csproj index d503b70..02179d4 100644 --- a/ResearchersWPF.UI/ResearchersWPF.UI.csproj +++ b/ResearchersWPF.UI/ResearchersWPF.UI.csproj @@ -108,6 +108,11 @@ True Reference.svcmap + + True + True + Reference.svcmap + True True @@ -294,6 +299,13 @@ Reference.svcmap + + + Designer + + + Designer + Designer @@ -315,6 +327,13 @@ + + + + + WCF Proxy Generator + Reference.cs + Web.config @@ -335,6 +354,7 @@ + diff --git a/ResearchersWPF.UI/View/ArticleListView.xaml b/ResearchersWPF.UI/View/ArticleListView.xaml index eb02339..a9823d4 100644 --- a/ResearchersWPF.UI/View/ArticleListView.xaml +++ b/ResearchersWPF.UI/View/ArticleListView.xaml @@ -9,7 +9,7 @@ - - + - - + + diff --git a/ResearchersWPF.UI/View/Request.xaml.cs b/ResearchersWPF.UI/View/Request.xaml.cs index 64bb066..fbf2fa5 100644 --- a/ResearchersWPF.UI/View/Request.xaml.cs +++ b/ResearchersWPF.UI/View/Request.xaml.cs @@ -26,12 +26,14 @@ public Request() private void Search1_Click(object sender, RoutedEventArgs e) { - + var requestServiceClient = new svcRequest.RequestServiceClient(); + SearchResult1.Text = requestServiceClient.GetPresentationRequest(DateTime1.Value ?? DateTime.Now).ToString(); } private void Search2_Click(object sender, RoutedEventArgs e) { - throw new NotImplementedException(); + var requestServiceClient = new svcRequest.RequestServiceClient(); + SearchResult2.Text = requestServiceClient.GetReportRequest(Convert.ToInt32(Updown.Text)).ToString(); } } } diff --git a/ResearchersWPF.UI/View/ResearcherListView.xaml b/ResearchersWPF.UI/View/ResearcherListView.xaml index 35215f9..5323f76 100644 --- a/ResearchersWPF.UI/View/ResearcherListView.xaml +++ b/ResearchersWPF.UI/View/ResearcherListView.xaml @@ -9,7 +9,7 @@ -