lab4 ipsr

This commit is contained in:
aleksandr chegodaev 2024-06-16 21:00:19 +04:00
commit ae8ed1c371
8 changed files with 45 additions and 135 deletions

View File

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

View File

@ -167,50 +167,5 @@ namespace LawFirmView
{
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>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>96</value>
<value>56</value>
</metadata>
</root>

View File

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

View File

@ -7,9 +7,12 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageReference Include="PDFsharp-MigraDoc-GDI" Version="1.50.5147" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Configuration" Version="7.0.0" />
<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>

View File

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

View File

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

View File

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