second conflict commit

This commit is contained in:
Salikh 2024-05-17 04:26:52 +04:00
parent 8ff7b7c5af
commit cc43db5b8d
8 changed files with 30 additions and 244 deletions

View File

@ -1,4 +1,5 @@
using MotorPlantContracts.BindingModels; using Microsoft.EntityFrameworkCore;
using MotorPlantContracts.BindingModels;
using MotorPlantContracts.SearchModels; using MotorPlantContracts.SearchModels;
using MotorPlantContracts.StoragesContracts; using MotorPlantContracts.StoragesContracts;
using MotorPlantContracts.ViewModels; using MotorPlantContracts.ViewModels;

View File

@ -31,8 +31,6 @@ namespace MotorPlantDatabaseImplement.Models
public DateTime? DateImplement { get; private set; } public DateTime? DateImplement { get; private set; }
public static Order Create(MotorPlantDatabase context, OrderBindingModel model) public static Order Create(MotorPlantDatabase context, OrderBindingModel model)
{
public static Order? Create(OrderBindingModel? model)
{ {
if (model == null) if (model == null)
{ {
@ -43,7 +41,6 @@ namespace MotorPlantDatabaseImplement.Models
Id = model.Id, Id = model.Id,
EngineId = model.EngineId, EngineId = model.EngineId,
Engine = context.Engines.First(x => x.Id == model.EngineId), Engine = context.Engines.First(x => x.Id == model.EngineId),
Count = model.Count,
ClientId = model.ClientId, ClientId = model.ClientId,
Count = model.Count, Count = model.Count,
Sum = model.Sum, Sum = model.Sum,
@ -67,7 +64,6 @@ namespace MotorPlantDatabaseImplement.Models
Id = Id, Id = Id,
EngineId = EngineId, EngineId = EngineId,
EngineName = Engine.EngineName, EngineName = Engine.EngineName,
Count = Count,
ClientId = ClientId, ClientId = ClientId,
Count = Count, Count = Count,
Sum = Sum, Sum = Sum,

View File

@ -21,7 +21,6 @@ namespace MotorPlantDatabaseImplement
public virtual DbSet<Order> Orders { get; set; } public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<Shop> Shops { get; set; } public virtual DbSet<Shop> Shops { get; set; }
public virtual DbSet<ShopEngine> ShopEngines { get; set; } public virtual DbSet<ShopEngine> ShopEngines { get; set; }
}
public virtual DbSet<Client> Clients { set; get; } public virtual DbSet<Client> Clients { set; get; }
} }
} }

View File

@ -16,9 +16,8 @@ namespace MotorPlantFileImplement
private readonly string ShopFileName = "Shop.xml"; private readonly string ShopFileName = "Shop.xml";
public List<Component> Components { get; private set; } public List<Component> Components { get; private set; }
private readonly string ClientFileName = "Client.xml";
public List<Component> Components { get; private set; } private readonly string ClientFileName = "Client.xml";
public List<Order> Orders { get; private set; } public List<Order> Orders { get; private set; }
@ -26,7 +25,6 @@ namespace MotorPlantFileImplement
public List<Shop> Shops { get; private set; } public List<Shop> Shops { get; private set; }
public static DataFileSingleton GetInstance()
public List<Client> Clients { get; private set; } public List<Client> Clients { get; private set; }
public static DataFileSingleton GetInstance() public static DataFileSingleton GetInstance()
@ -37,24 +35,23 @@ namespace MotorPlantFileImplement
} }
return instance; return instance;
} }
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement); public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", x => x.GetXElement);
public void SaveEngines() => SaveData(Engines, EngineFileName, "Engines", x => x.GetXElement); public void SaveEngines() => SaveData(Engines, EngineFileName, "Engines", x => x.GetXElement);
public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement); public void SaveOrders() => SaveData(Orders, OrderFileName, "Orders", x => x.GetXElement);
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
private DataFileSingleton()
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement); public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
private DataFileSingleton() private DataFileSingleton()
{ {
Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!; Components = LoadData(ComponentFileName, "Component", x => Component.Create(x)!)!;
Engines = LoadData(EngineFileName, "Engine", x => Engine.Create(x)!)!; Engines = LoadData(EngineFileName, "Engine", x => Engine.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!; Orders = LoadData(OrderFileName, "Order", x => Order.Create(x)!)!;
Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!; Clients = LoadData(ClientFileName, "Client", x => Client.Create(x)!)!;
}
Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!; Shops = LoadData(ShopFileName, "Shop", x => Shop.Create(x)!)!;
} }

View File

@ -14,7 +14,6 @@ namespace MotorPlantListImplement
public List<Shop> Shops { get; set; } public List<Shop> Shops { get; set; }
private DataListSingleton()
public List<Client> Clients { get; set; } public List<Client> Clients { get; set; }
private DataListSingleton() private DataListSingleton()
@ -23,7 +22,6 @@ namespace MotorPlantListImplement
Orders = new List<Order>(); Orders = new List<Order>();
Engines = new List<Engine>(); Engines = new List<Engine>();
Shops = new List<Shop>(); Shops = new List<Shop>();
}
Clients = new List<Client>(); Clients = new List<Client>();
} }

View File

@ -24,7 +24,7 @@ namespace MotorPlantListImplement.Implements
var result = new List<OrderViewModel>(); var result = new List<OrderViewModel>();
foreach (var order in _source.Orders) foreach (var order in _source.Orders)
{ {
result.Add(AttachEngineName(order.GetViewModel)); result.Add(AttachNames(order.GetViewModel));
} }
return result; return result;
} }

View File

@ -48,6 +48,7 @@
buttonIssuedOrder = new Button(); buttonIssuedOrder = new Button();
buttonRef = new Button(); buttonRef = new Button();
dataGridView = new DataGridView(); dataGridView = new DataGridView();
клиентыToolStripMenuItem = new ToolStripMenuItem();
toolStrip1.SuspendLayout(); toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit(); ((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout(); SuspendLayout();
@ -229,187 +230,6 @@
dataGridView.Size = new Size(780, 441); dataGridView.Size = new Size(780, 441);
dataGridView.TabIndex = 6; dataGridView.TabIndex = 6;
// //
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(985, 467);
Controls.Add(dataGridView);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonOrderReady);
Controls.Add(buttonTakeOrderInWork);
Controls.Add(buttonCreateOrder);
Controls.Add(toolStrip1);
Name = "FormMain";
Text = "Моторный завод";
Load += FormMain_Load;
toolStrip1.ResumeLayout(false);
toolStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
ResumeLayout(false);
PerformLayout();
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
toolStrip1 = new ToolStrip();
toolStripDropDownButton1 = new ToolStripDropDownButton();
КомпонентыToolStripMenuItem = new ToolStripMenuItem();
ДвигателиToolStripMenuItem = new ToolStripMenuItem();
отчетыToolStripMenuItem = new ToolStripMenuItem();
списокДвигателейToolStripMenuItem = new ToolStripMenuItem();
компонентыПоДвигателямToolStripMenuItem = new ToolStripMenuItem();
списокЗаказовToolStripMenuItem = new ToolStripMenuItem();
buttonCreateOrder = new Button();
buttonTakeOrderInWork = new Button();
buttonOrderReady = new Button();
buttonIssuedOrder = new Button();
buttonRef = new Button();
dataGridView = new DataGridView();
клиентыToolStripMenuItem = new ToolStripMenuItem();
toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
//
// toolStrip1
//
toolStrip1.ImageScalingSize = new Size(20, 20);
toolStrip1.Items.AddRange(new ToolStripItem[] { toolStripDropDownButton1, отчетыToolStripMenuItem });
toolStrip1.Location = new Point(0, 0);
toolStrip1.Name = "toolStrip1";
toolStrip1.Size = new Size(985, 25);
toolStrip1.TabIndex = 0;
toolStrip1.Text = "toolStrip1";
//
// toolStripDropDownButton1
//
toolStripDropDownButton1.DisplayStyle = ToolStripItemDisplayStyle.Text;
toolStripDropDownButton1.DropDownItems.AddRange(new ToolStripItem[] { КомпонентыToolStripMenuItem, ДвигателиToolStripMenuItem, клиентыToolStripMenuItem });
toolStripDropDownButton1.ImageTransparentColor = Color.Magenta;
toolStripDropDownButton1.Name = "toolStripDropDownButton1";
toolStripDropDownButton1.Size = new Size(88, 22);
toolStripDropDownButton1.Text = "Справочник";
//
// КомпонентыToolStripMenuItem
//
КомпонентыToolStripMenuItem.Name = "КомпонентыToolStripMenuItem";
КомпонентыToolStripMenuItem.Size = new Size(180, 22);
КомпонентыToolStripMenuItem.Text = "Компоненты";
КомпонентыToolStripMenuItem.Click += КомпонентыToolStripMenuItem_Click;
//
// ДвигателиToolStripMenuItem
//
ДвигателиToolStripMenuItem.Name = "ДвигателиToolStripMenuItem";
ДвигателиToolStripMenuItem.Size = new Size(180, 22);
ДвигателиToolStripMenuItem.Text = "Двигатели";
ДвигателиToolStripMenuItem.Click += ИзделияToolStripMenuItem_Click;
//
// отчетыToolStripMenuItem
//
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { списокДвигателейToolStripMenuItem, компонентыПоДвигателямToolStripMenuItem, списокЗаказовToolStripMenuItem });
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(60, 25);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// списокДвигателейToolStripMenuItem
//
списокДвигателейToolStripMenuItem.Name = "списокДвигателейToolStripMenuItem";
списокДвигателейToolStripMenuItem.Size = new Size(228, 22);
списокДвигателейToolStripMenuItem.Text = "Список двигателей";
списокДвигателейToolStripMenuItem.Click += списокДвигателейToolStripMenuItem_Click;
//
// компонентыПоДвигателямToolStripMenuItem
//
компонентыПоДвигателямToolStripMenuItem.Name = омпонентыПоДвигателямToolStripMenuItem";
компонентыПоДвигателямToolStripMenuItem.Size = new Size(228, 22);
компонентыПоДвигателямToolStripMenuItem.Text = "Компоненты по двигателям";
компонентыПоДвигателямToolStripMenuItem.Click += компонентыПоДвигателямToolStripMenuItem_Click;
//
// списокЗаказовToolStripMenuItem
//
списокЗаказовToolStripMenuItem.Name = "списокЗаказовToolStripMenuItem";
списокЗаказовToolStripMenuItem.Size = new Size(228, 22);
списокЗаказовToolStripMenuItem.Text = "Список заказов";
списокЗаказовToolStripMenuItem.Click += списокЗаказовToolStripMenuItem_Click;
//
// buttonCreateOrder
//
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonCreateOrder.BackColor = SystemColors.ControlLight;
buttonCreateOrder.Location = new Point(797, 146);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(178, 30);
buttonCreateOrder.TabIndex = 1;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = false;
buttonCreateOrder.Click += buttonCreateOrder_Click;
//
// buttonTakeOrderInWork
//
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonTakeOrderInWork.BackColor = SystemColors.ControlLight;
buttonTakeOrderInWork.Location = new Point(797, 194);
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
buttonTakeOrderInWork.Size = new Size(178, 30);
buttonTakeOrderInWork.TabIndex = 2;
buttonTakeOrderInWork.Text = "Отдать на выполнение";
buttonTakeOrderInWork.UseVisualStyleBackColor = false;
buttonTakeOrderInWork.Click += buttonTakeOrderInWork_Click;
//
// buttonOrderReady
//
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonOrderReady.BackColor = SystemColors.ControlLight;
buttonOrderReady.Location = new Point(797, 242);
buttonOrderReady.Name = "buttonOrderReady";
buttonOrderReady.Size = new Size(178, 30);
buttonOrderReady.TabIndex = 3;
buttonOrderReady.Text = "Заказ готов";
buttonOrderReady.UseVisualStyleBackColor = false;
buttonOrderReady.Click += buttonOrderReady_Click;
//
// buttonIssuedOrder
//
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonIssuedOrder.BackColor = SystemColors.ControlLight;
buttonIssuedOrder.Location = new Point(797, 287);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(178, 30);
buttonIssuedOrder.TabIndex = 4;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = false;
buttonIssuedOrder.Click += buttonIssuedOrder_Click;
//
// buttonRef
//
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonRef.BackColor = SystemColors.ControlLight;
buttonRef.Location = new Point(797, 100);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(178, 30);
buttonRef.TabIndex = 5;
buttonRef.Text = "Обновить список";
buttonRef.UseVisualStyleBackColor = false;
buttonRef.Click += buttonRef_Click;
//
// dataGridView
//
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
dataGridView.BackgroundColor = SystemColors.ButtonHighlight;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(0, 26);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 24;
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dataGridView.Size = new Size(780, 441);
dataGridView.TabIndex = 6;
//
// клиентыToolStripMenuItem // клиентыToolStripMenuItem
// //
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem"; клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
@ -438,7 +258,6 @@
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
#endregion #endregion
private ToolStrip toolStrip1; private ToolStrip toolStrip1;
@ -456,21 +275,6 @@
private ToolStripMenuItem компонентыПоДвигателямToolStripMenuItem; private ToolStripMenuItem компонентыПоДвигателямToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem; private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem клиентыToolStripMenuItem; private ToolStripMenuItem клиентыToolStripMenuItem;
}
private ToolStrip toolStrip1;
private Button buttonCreateOrder;
private Button buttonTakeOrderInWork;
private Button buttonOrderReady;
private Button buttonIssuedOrder;
private Button buttonRef;
private DataGridView dataGridView;
private ToolStripDropDownButton toolStripDropDownButton1;
private ToolStripMenuItem КомпонентыToolStripMenuItem;
private ToolStripMenuItem ДвигателиToolStripMenuItem;
private ToolStripMenuItem отчетыToolStripMenuItem;
private ToolStripMenuItem списокДвигателейToolStripMenuItem;
private ToolStripMenuItem компонентыПоДвигателямToolStripMenuItem;
private ToolStripMenuItem списокЗаказовToolStripMenuItem;
private ToolStripMenuItem магазиныToolStripMenuItem; private ToolStripMenuItem магазиныToolStripMenuItem;
private ToolStripMenuItem поставкаToolStripMenuItem; private ToolStripMenuItem поставкаToolStripMenuItem;
private ToolStripMenuItem продажаToolStripMenuItem; private ToolStripMenuItem продажаToolStripMenuItem;

View File

@ -231,15 +231,6 @@ namespace MotorPlantView.Forms
form.ShowDialog(); form.ShowDialog();
} }
} }
}
private void списокЗаказовToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e) private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
{ {