pre-add Report.rdlc

This commit is contained in:
ShabOl 2024-04-10 22:22:51 +04:00
parent fe53deabde
commit 036c45410e
12 changed files with 172 additions and 41 deletions

View File

@ -1,7 +1,7 @@
using AutoWorkshopBusinessLogic.OfficePackage;
using AutoWorkshopBusinessLogic.OfficePackage.HelperModels;
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.BusinessLogicContracts;
using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;

View File

@ -1,7 +1,7 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.ViewModels;
namespace AutoWorkshopContracts.BusinessLogicsContracts
namespace AutoWorkshopContracts.BusinessLogicContracts
{
public interface IReportLogic
{

View File

@ -4,6 +4,7 @@ using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopDatabaseImplement.Models;
using Microsoft.EntityFrameworkCore;
using System;
namespace AutoWorkshopDatabaseImplement.Implements
{
@ -21,11 +22,20 @@ namespace AutoWorkshopDatabaseImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
{
if (!Model.Id.HasValue)
if (!Model.Id.HasValue || !Model.DateFrom.HasValue || !Model.DateTo.HasValue)
return new();
using var Context = new AutoWorkshopDatabase();
if (Model.DateFrom.HasValue)
{
return Context.Orders
.Include(x => x.Repair)
.Where(x => x.DateCreate >= Model.DateFrom && x.DateCreate <= Model.DateTo)
.Select(x => x.GetViewModel)
.ToList();
}
return Context.Orders
.Include(x => x.Repair)
.Where(x => x.Id == Model.Id)

View File

@ -3,7 +3,6 @@ using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopFileImplement.Models;
using System.Reflection;
namespace AutoWorkshopFileImplement.Implements
{
@ -23,10 +22,13 @@ namespace AutoWorkshopFileImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
{
if (!Model.Id.HasValue)
if (!Model.Id.HasValue || !Model.DateFrom.HasValue || !Model.DateTo.HasValue)
return new();
return _source.Orders.Where(x => x.Id == Model.Id).Select(x => AddRepairName(x.GetViewModel)).ToList();
return _source.Orders
.Where(x => x.DateCreate >= Model.DateFrom && x.DateCreate <= Model.DateTo)
.Select(x => AddRepairName(x.GetViewModel))
.ToList();
}
public OrderViewModel? Delete(OrderBindingModel Model)

View File

@ -3,6 +3,7 @@ using AutoWorkshopContracts.SearchModels;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopContracts.ViewModels;
using AutoWorkshopListImplement.Models;
using System.Reflection;
namespace AutoWorkshopListImplement.Implements
{
@ -30,13 +31,13 @@ namespace AutoWorkshopListImplement.Implements
public List<OrderViewModel> GetFilteredList(OrderSearchModel Model)
{
var Result = new List<OrderViewModel>();
if (!Model.Id.HasValue)
if (!Model.Id.HasValue || !Model.DateFrom.HasValue || !Model.DateFrom.HasValue)
return Result;
foreach (var Order in _source.Orders)
{
if (Order.Id == Model.Id)
if (Order.DateCreate >= Model.DateFrom && Order.DateCreate <= Model.DateTo)
{
Result.Add(JoinRepairName(Order.GetViewModel));
break;

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,5 +1,5 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.BusinessLogicContracts;
using Microsoft.Extensions.Logging;
using Microsoft.Reporting.WinForms;
@ -49,8 +49,9 @@ namespace AutoWorkshopView.Forms
_reportViewer.LocalReport.DataSources.Clear();
_reportViewer.LocalReport.DataSources.Add(Source);
var Parameters = new[] { new ReportParameter("ReportParameterPeriod",
$"c {FromDateTimePicker.Value.ToShortDateString()} по {ToDateTimePicker.Value.ToShortDateString()}") };
var Parameters = new[] {
new ReportParameter("ReportParameterPeriod", $"c {FromDateTimePicker.Value.ToShortDateString()} по {ToDateTimePicker.Value.ToShortDateString()}")
};
_reportViewer.LocalReport.SetParameters(Parameters);
_reportViewer.RefreshReport();

View File

@ -45,13 +45,13 @@
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
DataGridView.Columns.AddRange(new DataGridViewColumn[] { ColumnRepair, ColumnComponent, ColumnCount });
DataGridView.Dock = DockStyle.Bottom;
DataGridView.Location = new Point(0, 36);
DataGridView.Location = new Point(0, 61);
DataGridView.Margin = new Padding(3, 2, 3, 2);
DataGridView.Name = "DataGridView";
DataGridView.ReadOnly = true;
DataGridView.RowHeadersWidth = 51;
DataGridView.RowTemplate.Height = 29;
DataGridView.Size = new Size(494, 302);
DataGridView.Size = new Size(494, 277);
DataGridView.TabIndex = 0;
//
// ColumnRepair
@ -80,10 +80,10 @@
//
// SaveToExcelButton
//
SaveToExcelButton.Location = new Point(12, 10);
SaveToExcelButton.Location = new Point(12, 11);
SaveToExcelButton.Margin = new Padding(3, 2, 3, 2);
SaveToExcelButton.Name = "SaveToExcelButton";
SaveToExcelButton.Size = new Size(470, 22);
SaveToExcelButton.Size = new Size(153, 36);
SaveToExcelButton.TabIndex = 1;
SaveToExcelButton.Text = "Сохранить в Excel";
SaveToExcelButton.UseVisualStyleBackColor = true;

View File

@ -1,5 +1,5 @@
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.BusinessLogicContracts;
using Microsoft.Extensions.Logging;
namespace AutoWorkshopView.Forms

View File

@ -80,34 +80,34 @@
//
// ReportsToolStripMenuItem
//
this.ReportsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ComponentsToolStripMenuItem1,
this.ComponentRepairToolStripMenuItem1,
this.OrdersToolStripMenuItem});
this.ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
this.ReportsToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.ReportsToolStripMenuItem.Text = "Reports";
ReportsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] {
ComponentsToolStripMenuItem1,
ComponentRepairToolStripMenuItem1,
OrdersToolStripMenuItem});
ReportsToolStripMenuItem.Name = "ReportsToolStripMenuItem";
ReportsToolStripMenuItem.Size = new Size(60, 20);
ReportsToolStripMenuItem.Text = "Отчёты";
//
// ComponentsToolStripMenuItem1
//
this.ComponentsToolStripMenuItem1.Name = "ComponentsToolStripMenuItem1";
this.ComponentsToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
this.ComponentsToolStripMenuItem1.Text = "Ремонты";
this.ComponentsToolStripMenuItem1.Click += new System.EventHandler(this.ComponentsToolStripMenuItem_Click);
ComponentsToolStripMenuItem1.Name = "ComponentsToolStripMenuItem1";
ComponentsToolStripMenuItem1.Size = new Size(205, 22);
ComponentsToolStripMenuItem1.Text = "Ремонты";
ComponentsToolStripMenuItem1.Click += new EventHandler(ComponentsToolStripMenuItem_Click);
//
// ComponentRepairToolStripMenuItem1
//
this.ComponentRepairToolStripMenuItem1.Name = "ComponentRepairToolStripMenuItem1";
this.ComponentRepairToolStripMenuItem1.Size = new System.Drawing.Size(205, 22);
this.ComponentRepairToolStripMenuItem1.Text = "Ремонт с компонентами";
this.ComponentRepairToolStripMenuItem1.Click += new System.EventHandler(this.ComponentRepairToolStripMenuItem_Click);
ComponentRepairToolStripMenuItem1.Name = "ComponentRepairToolStripMenuItem1";
ComponentRepairToolStripMenuItem1.Size = new Size(205, 22);
ComponentRepairToolStripMenuItem1.Text = "Ремонт с компонентами";
ComponentRepairToolStripMenuItem1.Click += new EventHandler(ComponentRepairToolStripMenuItem_Click);
//
// OrdersToolStripMenuItem
//
this.OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
this.OrdersToolStripMenuItem.Size = new System.Drawing.Size(205, 22);
this.OrdersToolStripMenuItem.Text = "Заказы";
this.OrdersToolStripMenuItem.Click += new System.EventHandler(this.OrdersToolStripMenuItem_Click);
OrdersToolStripMenuItem.Name = "OrdersToolStripMenuItem";
OrdersToolStripMenuItem.Size = new Size(205, 22);
OrdersToolStripMenuItem.Text = "Заказы";
OrdersToolStripMenuItem.Click += new EventHandler(OrdersToolStripMenuItem_Click);
//
// DataGridView
//

View File

@ -1,7 +1,5 @@
using AutoWorkshopBusinessLogic.BusinessLogics;
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BindingModels;
using AutoWorkshopContracts.BusinessLogicContracts;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopView.Forms;
using Microsoft.Extensions.Logging;

View File

@ -2,7 +2,6 @@ using AutoWorkshopBusinessLogic.BusinessLogics;
using AutoWorkshopBusinessLogic.OfficePackage.Implements;
using AutoWorkshopBusinessLogic.OfficePackage;
using AutoWorkshopContracts.BusinessLogicContracts;
using AutoWorkshopContracts.BusinessLogicsContracts;
using AutoWorkshopContracts.StoragesContracts;
using AutoWorkshopDatabaseImplement.Implements;
using AutoWorkshopView.Forms;