lab4 ispr

This commit is contained in:
aleksandr chegodaev 2024-06-16 21:00:26 +04:00
parent ae8ed1c371
commit 68831c48fd
10 changed files with 141 additions and 51 deletions

View File

@ -28,30 +28,34 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FormMain)); this.menuStrip1 = new System.Windows.Forms.MenuStrip();
toolStrip1 = new ToolStrip(); this.toolStripMenuItemCatalogs = new System.Windows.Forms.ToolStripMenuItem();
toolStripDropDownButton1 = new ToolStripDropDownButton(); this.компонентыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
компонентыToolStripMenuItem = new ToolStripMenuItem(); this.пакетыДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
ПутёвкиToolStripMenuItem = new ToolStripMenuItem(); this.отчётыToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
buttonCreateOrder = new Button(); this.списокПакетовДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
buttonTakeOrderInWork = new Button(); this.компонентыПоПакетамДокументовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
buttonOrderReady = new Button(); this.списокЗаказовToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
buttonIssuedOrder = new Button(); this.dataGridView = new System.Windows.Forms.DataGridView();
buttonRef = new Button(); this.buttonCreateOrder = new System.Windows.Forms.Button();
dataGridView = new DataGridView(); this.buttonTakeOrderInWork = new System.Windows.Forms.Button();
toolStrip1.SuspendLayout(); this.buttonOrderReady = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); this.buttonIssuedOrder = new System.Windows.Forms.Button();
SuspendLayout(); this.buttonRef = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
this.SuspendLayout();
// //
// menuStrip1 // menuStrip1
// //
toolStrip1.ImageScalingSize = new Size(20, 20); this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1 }); this.toolStripMenuItemCatalogs,
toolStrip1.Location = new Point(0, 0); this.отчётыToolStripMenuItem});
toolStrip1.Name = "toolStrip1"; this.menuStrip1.Location = new System.Drawing.Point(0, 0);
toolStrip1.Size = new Size(969, 25); this.menuStrip1.Name = "menuStrip1";
toolStrip1.TabIndex = 0; this.menuStrip1.Size = new System.Drawing.Size(910, 24);
toolStrip1.Text = "toolStrip1"; this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "Справочники";
// //
// toolStripMenuItemCatalogs // toolStripMenuItemCatalogs
// //
@ -76,6 +80,46 @@
this.пакетыДокументовToolStripMenuItem.Text = "Пакеты документов"; this.пакетыДокументовToolStripMenuItem.Text = "Пакеты документов";
this.пакетыДокументовToolStripMenuItem.Click += new System.EventHandler(this.пакетыДокументовToolStripMenuItem_Click); this.пакетыДокументовToolStripMenuItem.Click += new System.EventHandler(this.пакетыДокументовToolStripMenuItem_Click);
// //
// отчётыToolStripMenuItem
//
this.отчётыToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.списокПакетовДокументовToolStripMenuItem,
this.компонентыПоПакетамДокументовToolStripMenuItem,
this.списокЗаказовToolStripMenuItem});
this.отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
this.отчётыToolStripMenuItem.Size = new System.Drawing.Size(60, 20);
this.отчётыToolStripMenuItem.Text = "Отчёты";
//
// списокПакетовДокументовToolStripMenuItem
//
this.списокПакетовДокументовToolStripMenuItem.Name = "списокПакетовДокументовToolStripMenuItem";
this.списокПакетовДокументовToolStripMenuItem.Size = new System.Drawing.Size(278, 22);
this.списокПакетовДокументовToolStripMenuItem.Text = "Список пакетов документов";
this.списокПакетовДокументовToolStripMenuItem.Click += new System.EventHandler(this.списокПакетовДокументовToolStripMenuItem_Click);
//
// компонентыПоПакетамДокументовToolStripMenuItem
//
this.компонентыПоПакетамДокументовToolStripMenuItem.Name = омпонентыПоПакетамДокументовToolStripMenuItem";
this.компонентыПоПакетамДокументовToolStripMenuItem.Size = new System.Drawing.Size(278, 22);
this.компонентыПоПакетамДокументовToolStripMenuItem.Text = "Компоненты по пакетам документов";
this.компонентыПоПакетамДокументовToolStripMenuItem.Click += new System.EventHandler(this.компонентыПоПакетамДокументовToolStripMenuItem_Click);
//
// списокЗаказовToolStripMenuItem
//
this.списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
this.списокЗаказовToolStripMenuItem.Size = new System.Drawing.Size(278, 22);
this.списокЗаказовToolStripMenuItem.Text = "Список заказов";
this.списокЗаказовToolStripMenuItem.Click += new System.EventHandler(this.списокЗаказовToolStripMenuItem_Click);
//
// dataGridView
//
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView.Location = new System.Drawing.Point(0, 27);
this.dataGridView.Name = "dataGridView";
this.dataGridView.RowTemplate.Height = 25;
this.dataGridView.Size = new System.Drawing.Size(736, 411);
this.dataGridView.TabIndex = 1;
//
// buttonCreateOrder // buttonCreateOrder
// //
this.buttonCreateOrder.Location = new System.Drawing.Point(742, 39); this.buttonCreateOrder.Location = new System.Drawing.Point(742, 39);
@ -162,9 +206,9 @@
private Button buttonOrderReady; private Button buttonOrderReady;
private Button buttonIssuedOrder; private Button buttonIssuedOrder;
private Button buttonRef; private Button buttonRef;
private DataGridView dataGridView; private ToolStripMenuItem отчётыToolStripMenuItem;
private ToolStripDropDownButton toolStripDropDownButton1; private ToolStripMenuItem списокПакетовДокументовToolStripMenuItem;
private ToolStripMenuItem компонентыToolStripMenuItem; private ToolStripMenuItem компонентыПоПакетамДокументовToolStripMenuItem;
private ToolStripMenuItem ПутёвкиToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem;
} }
} }

View File

@ -167,5 +167,50 @@ namespace LawFirmView
{ {
LoadData(); LoadData();
} }
private OrderBindingModel CreateBindingModel(int id, bool isDone = false)
{
return new OrderBindingModel
{
Id = id,
DocumentId = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["DocumentId"].Value),
Status = Enum.Parse<OrderStatus>(dataGridView.SelectedRows[0].Cells["Status"].Value.ToString()),
Count = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Count"].Value),
Sum = double.Parse(dataGridView.SelectedRows[0].Cells["Sum"].Value.ToString()),
DateCreate = DateTime.Parse(dataGridView.SelectedRows[0].Cells["DateCreate"].Value.ToString()),
};
}
private void списокПакетовДокументовToolStripMenuItem_Click(object sender, EventArgs e)
{
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
if (dialog.ShowDialog() == DialogResult.OK)
{
_reportLogic.SaveDocumentsToWordFile(new ReportBindingModel
{
FileName = dialog.FileName
});
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK,
MessageBoxIcon.Information);
}
}
private void компонентыПоПакетамДокументовToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportDocumentComponents));
if (service is FormReportDocumentComponents form)
{
form.ShowDialog();
}
}
private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
} }
} }

View File

@ -61,6 +61,6 @@
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>56</value> <value>96</value>
</metadata> </metadata>
</root> </root>

View File

@ -24,11 +24,11 @@
<ProjectReference Include="..\LawFirmFileImplement\LawFirmFileImplement.csproj" /> <ProjectReference Include="..\LawFirmFileImplement\LawFirmFileImplement.csproj" />
<ProjectReference Include="..\LawFirmListImplement\LawFirmListImplement.csproj" /> <ProjectReference Include="..\LawFirmListImplement\LawFirmListImplement.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Update="ReportOrders.rdlc"> <None Update="ReportOrders.rdlc">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,4 +1,7 @@
using LawFirmBusinessLogic.BusinessLogic; using LawFirmBusinessLogic.BusinessLogic;
using LawFirmBusinessLogic.OfficePackage.Implements;
using LawFirmBusinessLogic.OfficePackage;
using LawFirmContracts.BusinessLogicsContracts;
using LawFirmContracts.StoragesContracts; using LawFirmContracts.StoragesContracts;
using LawFirmDatabaseImplement.Implements; using LawFirmDatabaseImplement.Implements;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
@ -38,15 +41,20 @@ namespace LawFirmView
services.AddTransient<IDocumentStorage, DocumentStorage>(); services.AddTransient<IDocumentStorage, DocumentStorage>();
services.AddTransient<IComponentLogic, ComponentLogic>(); services.AddTransient<IComponentLogic, ComponentLogic>();
services.AddTransient<IOrderLogic, OrderLogic>(); services.AddTransient<IOrderLogic, OrderLogic>();
services.AddTransient<ILawLogic, LawLogic>(); services.AddTransient<IDocumentLogic, DocumentLogic>();
services.AddTransient<IReportLogic, ReportLogic>();
services.AddTransient<AbstractSaveToWord, SaveToWord>();
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
services.AddTransient<FormMain>(); services.AddTransient<FormMain>();
services.AddTransient<FormComponent>(); services.AddTransient<FormComponent>();
services.AddTransient<FormComponents>(); services.AddTransient<FormComponents>();
services.AddTransient<FormCreateOrder>(); services.AddTransient<FormCreateOrder>();
services.AddTransient<FormLaw>(); services.AddTransient<FormDocument>();
services.AddTransient<FormLawComponent>(); services.AddTransient<FormDocumentComponent>();
services.AddTransient<FormLaws>(); services.AddTransient<FormDocuments>();
services.AddTransient<FormReportDocumentComponents>();
services.AddTransient<FormReportOrders>();
} }
} }

View File

@ -7,12 +7,9 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" /> <PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" /> <PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="7.0.0" />
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.8" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -32,9 +32,10 @@ namespace LawFirmDatabaseImplement.Implements
} }
using var context = new LawFirmDatabase(); using var context = new LawFirmDatabase();
return context.Orders return context.Orders
.Where(x => x.Id == model.Id) .Where(x => x.Id == model.Id || model.DateFrom <= x.DateCreate && x.DateCreate <= model.DateTo)
.Select(x => AccessLawStorage(x.GetViewModel)) .Include(x => x.Document)
.ToList(); .Select(x => x.GetViewModel)
.ToList();
} }
public List<OrderViewModel> GetFullList() public List<OrderViewModel> GetFullList()

View File

@ -12,11 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace LawFirmDatabaseImplement.Migrations namespace LawFirmDatabaseImplement.Migrations
{ {
[DbContext(typeof(LawFirmDatabase))] [DbContext(typeof(LawFirmDatabase))]
<<<<<<<< HEAD:LawFirm/LawFirmDatabaseImplement/Migrations/20240616163258_InitialCreate.Designer.cs [Migration("20240616165923_InitialCreate")]
[Migration("20240616163258_InitialCreate")]
========
[Migration("20240616155435_InitialCreate")]
>>>>>>>> lab3:LawFirm/LawFirmDatabaseImplement/Migrations/20240616155435_InitialCreate.Designer.cs
partial class InitialCreate partial class InitialCreate
{ {
/// <inheritdoc /> /// <inheritdoc />

View File

@ -33,7 +33,6 @@ namespace LawFirmFileImplement
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
Documents = LoadData(DocumentFileName, "Document", x => Document.Create(x)!)!; Documents = LoadData(DocumentFileName, "Document", x => Document.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
//Orders = new List<Order>();
} }
private static List<T>? LoadData<T>(string filename, string xmlNodeName, private static List<T>? LoadData<T>(string filename, string xmlNodeName,
Func<XElement, T> selectFunction) Func<XElement, T> selectFunction)