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.StoragesContracts;
using MotorPlantContracts.ViewModels;

View File

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

View File

@ -21,7 +21,6 @@ namespace MotorPlantDatabaseImplement
public virtual DbSet<Order> Orders { get; set; }
public virtual DbSet<Shop> Shops { 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";
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; }
@ -26,10 +25,9 @@ namespace MotorPlantFileImplement
public List<Shop> Shops { get; private set; }
public static DataFileSingleton GetInstance()
public List<Client> Clients { get; private set; }
public static DataFileSingleton GetInstance()
public static DataFileSingleton GetInstance()
{
if (instance == null)
{
@ -37,16 +35,16 @@ namespace MotorPlantFileImplement
}
return instance;
}
public void SaveComponents() => SaveData(Components, ComponentFileName, "Components", 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 SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
private DataFileSingleton()
public void SaveClients() => SaveData(Clients, ClientFileName, "Clients", x => x.GetXElement);
public void SaveShops() => SaveData(Shops, ShopFileName, "Shops", x => x.GetXElement);
private DataFileSingleton()
{
@ -54,9 +52,8 @@ namespace MotorPlantFileImplement
Engines = LoadData(EngineFileName, "Engine", x => Engine.Create(x)!)!;
Orders = LoadData(OrderFileName, "Order", x => Order.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)!)!;
}
private static List<T>? LoadData<T>(string filename, string xmlNodeName, Func<XElement, T> selectFunction)
{

View File

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

View File

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

View File

@ -48,6 +48,7 @@
buttonIssuedOrder = new Button();
buttonRef = new Button();
dataGridView = new DataGridView();
клиентыToolStripMenuItem = new ToolStripMenuItem();
toolStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@ -229,6 +230,13 @@
dataGridView.Size = new Size(780, 441);
dataGridView.TabIndex = 6;
//
// клиентыToolStripMenuItem
//
клиентыToolStripMenuItem.Name = "клиентыToolStripMenuItem";
клиентыToolStripMenuItem.Size = new Size(180, 22);
клиентыToolStripMenuItem.Text = "Клиенты";
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(7F, 15F);
@ -250,195 +258,6 @@
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.Name = "клиентыToolStripMenuItem";
клиентыToolStripMenuItem.Size = new Size(180, 22);
клиентыToolStripMenuItem.Text = "Клиенты";
клиентыToolStripMenuItem.Click += клиентыToolStripMenuItem_Click;
//
// 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();
}
#endregion
private ToolStrip toolStrip1;
@ -456,21 +275,6 @@
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;

View File

@ -231,23 +231,14 @@ namespace MotorPlantView.Forms
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)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
}
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
}
}