Compare commits
No commits in common. "94cefbfbe1586be081f24aecf4ad82f451b63f04" and "c2ea9ed1406787287151715f6fe746cc34014480" have entirely different histories.
94cefbfbe1
...
c2ea9ed140
1
.gitignore
vendored
1
.gitignore
vendored
@ -398,4 +398,3 @@ FodyWeavers.xsd
|
|||||||
# JetBrains Rider
|
# JetBrains Rider
|
||||||
*.sln.iml
|
*.sln.iml
|
||||||
|
|
||||||
/Confectionery/ImplementationExtensions
|
|
@ -1,51 +0,0 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Confectionery
|
|
||||||
{
|
|
||||||
internal static class DataGridViewExtension
|
|
||||||
{
|
|
||||||
public static void FillAndConfigGrid<T>(this DataGridView grid, List<T>? data)
|
|
||||||
{
|
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
grid.DataSource = data;
|
|
||||||
|
|
||||||
var type = typeof(T);
|
|
||||||
var properties = type.GetProperties();
|
|
||||||
foreach (DataGridViewColumn column in grid.Columns)
|
|
||||||
{
|
|
||||||
var property = properties.FirstOrDefault(x => x.Name == column.Name);
|
|
||||||
if (property == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"В типе {type.Name} не найдено свойство с именем {column.Name}");
|
|
||||||
}
|
|
||||||
var attribute = property.GetCustomAttributes(typeof(ColumnAttribute), true)?.SingleOrDefault();
|
|
||||||
if (attribute == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"Не найден атрибут типа ColumnAttribute для свойства {property.Name}");
|
|
||||||
}
|
|
||||||
// ищем нужный нам атрибут
|
|
||||||
if (attribute is ColumnAttribute columnAttr)
|
|
||||||
{
|
|
||||||
column.HeaderText = columnAttr.Title;
|
|
||||||
column.Visible = columnAttr.Visible;
|
|
||||||
if (columnAttr.IsUseAutoSize)
|
|
||||||
{
|
|
||||||
column.AutoSizeMode = (DataGridViewAutoSizeColumnMode)Enum.Parse(typeof(DataGridViewAutoSizeColumnMode), columnAttr.GridViewAutoSize.ToString());
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
column.Width = columnAttr.Width;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,12 +44,12 @@
|
|||||||
this.dataGridView.RowHeadersWidth = 51;
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(605, 449);
|
this.dataGridView.Size = new System.Drawing.Size(489, 449);
|
||||||
this.dataGridView.TabIndex = 1;
|
this.dataGridView.TabIndex = 1;
|
||||||
//
|
//
|
||||||
// buttonRefresh
|
// buttonRefresh
|
||||||
//
|
//
|
||||||
this.buttonRefresh.Location = new System.Drawing.Point(613, 12);
|
this.buttonRefresh.Location = new System.Drawing.Point(529, 12);
|
||||||
this.buttonRefresh.Name = "buttonRefresh";
|
this.buttonRefresh.Name = "buttonRefresh";
|
||||||
this.buttonRefresh.Size = new System.Drawing.Size(94, 29);
|
this.buttonRefresh.Size = new System.Drawing.Size(94, 29);
|
||||||
this.buttonRefresh.TabIndex = 2;
|
this.buttonRefresh.TabIndex = 2;
|
||||||
@ -61,7 +61,7 @@
|
|||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(719, 450);
|
this.ClientSize = new System.Drawing.Size(660, 450);
|
||||||
this.Controls.Add(this.buttonRefresh);
|
this.Controls.Add(this.buttonRefresh);
|
||||||
this.Controls.Add(this.dataGridView);
|
this.Controls.Add(this.dataGridView);
|
||||||
this.Name = "FormClients";
|
this.Name = "FormClients";
|
||||||
|
@ -37,7 +37,13 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка клиентов");
|
_logger.LogInformation("Загрузка клиентов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
//
|
//
|
||||||
// buttonRef
|
// buttonRef
|
||||||
//
|
//
|
||||||
this.buttonRef.Location = new System.Drawing.Point(625, 184);
|
this.buttonRef.Location = new System.Drawing.Point(523, 185);
|
||||||
this.buttonRef.Name = "buttonRef";
|
this.buttonRef.Name = "buttonRef";
|
||||||
this.buttonRef.Size = new System.Drawing.Size(94, 29);
|
this.buttonRef.Size = new System.Drawing.Size(94, 29);
|
||||||
this.buttonRef.TabIndex = 9;
|
this.buttonRef.TabIndex = 9;
|
||||||
@ -48,7 +48,7 @@
|
|||||||
//
|
//
|
||||||
// buttonDel
|
// buttonDel
|
||||||
//
|
//
|
||||||
this.buttonDel.Location = new System.Drawing.Point(625, 126);
|
this.buttonDel.Location = new System.Drawing.Point(523, 127);
|
||||||
this.buttonDel.Name = "buttonDel";
|
this.buttonDel.Name = "buttonDel";
|
||||||
this.buttonDel.Size = new System.Drawing.Size(94, 29);
|
this.buttonDel.Size = new System.Drawing.Size(94, 29);
|
||||||
this.buttonDel.TabIndex = 8;
|
this.buttonDel.TabIndex = 8;
|
||||||
@ -58,7 +58,7 @@
|
|||||||
//
|
//
|
||||||
// buttonUpd
|
// buttonUpd
|
||||||
//
|
//
|
||||||
this.buttonUpd.Location = new System.Drawing.Point(625, 69);
|
this.buttonUpd.Location = new System.Drawing.Point(523, 70);
|
||||||
this.buttonUpd.Name = "buttonUpd";
|
this.buttonUpd.Name = "buttonUpd";
|
||||||
this.buttonUpd.Size = new System.Drawing.Size(94, 29);
|
this.buttonUpd.Size = new System.Drawing.Size(94, 29);
|
||||||
this.buttonUpd.TabIndex = 7;
|
this.buttonUpd.TabIndex = 7;
|
||||||
@ -68,7 +68,7 @@
|
|||||||
//
|
//
|
||||||
// buttonAdd
|
// buttonAdd
|
||||||
//
|
//
|
||||||
this.buttonAdd.Location = new System.Drawing.Point(625, 12);
|
this.buttonAdd.Location = new System.Drawing.Point(523, 13);
|
||||||
this.buttonAdd.Name = "buttonAdd";
|
this.buttonAdd.Name = "buttonAdd";
|
||||||
this.buttonAdd.Size = new System.Drawing.Size(94, 29);
|
this.buttonAdd.Size = new System.Drawing.Size(94, 29);
|
||||||
this.buttonAdd.TabIndex = 6;
|
this.buttonAdd.TabIndex = 6;
|
||||||
@ -87,14 +87,14 @@
|
|||||||
this.dataGridView.RowHeadersWidth = 51;
|
this.dataGridView.RowHeadersWidth = 51;
|
||||||
this.dataGridView.RowTemplate.Height = 29;
|
this.dataGridView.RowTemplate.Height = 29;
|
||||||
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
this.dataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||||
this.dataGridView.Size = new System.Drawing.Size(618, 449);
|
this.dataGridView.Size = new System.Drawing.Size(489, 449);
|
||||||
this.dataGridView.TabIndex = 5;
|
this.dataGridView.TabIndex = 5;
|
||||||
//
|
//
|
||||||
// FormImplementers
|
// FormImplementers
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(727, 450);
|
this.ClientSize = new System.Drawing.Size(628, 450);
|
||||||
this.Controls.Add(this.buttonRef);
|
this.Controls.Add(this.buttonRef);
|
||||||
this.Controls.Add(this.buttonDel);
|
this.Controls.Add(this.buttonDel);
|
||||||
this.Controls.Add(this.buttonUpd);
|
this.Controls.Add(this.buttonUpd);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
using ConfectioneryContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -34,8 +33,14 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
_logger.LogInformation("Загрузка исполнителей");
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Загрузка компонентов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -46,7 +51,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormImplementer>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||||
if (service is FormImplementer form)
|
if (service is FormImplementer form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
@ -60,7 +65,7 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormImplementer>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||||
if (service is FormImplementer form)
|
if (service is FormImplementer form)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
using ConfectioneryContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -35,7 +34,13 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["IngredientName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
_logger.LogInformation("Загрузка компонентов");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -47,7 +52,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormIngredient>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormIngredient));
|
||||||
if (service is FormIngredient form)
|
if (service is FormIngredient form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
@ -61,7 +66,7 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormIngredient>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormIngredient));
|
||||||
if (service is FormIngredient form)
|
if (service is FormIngredient form)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
@ -27,7 +27,14 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["MessageId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка писем");
|
_logger.LogInformation("Загрузка писем");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
24
Confectionery/Confectionery/FormMain.Designer.cs
generated
24
Confectionery/Confectionery/FormMain.Designer.cs
generated
@ -39,12 +39,11 @@
|
|||||||
this.IngredientPastriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.IngredientPastriesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.OrdersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.OrdersToolStripMenuItem = 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.dataGridView = new System.Windows.Forms.DataGridView();
|
||||||
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
this.buttonCreateOrder = new System.Windows.Forms.Button();
|
||||||
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
this.buttonIssuedOrder = new System.Windows.Forms.Button();
|
||||||
this.buttonRef = new System.Windows.Forms.Button();
|
this.buttonRef = new System.Windows.Forms.Button();
|
||||||
this.создатьБекапToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
this.письмаToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
this.menuStrip1.SuspendLayout();
|
this.menuStrip1.SuspendLayout();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
@ -56,8 +55,7 @@
|
|||||||
this.справочникиToolStripMenuItem,
|
this.справочникиToolStripMenuItem,
|
||||||
this.отчётыToolStripMenuItem,
|
this.отчётыToolStripMenuItem,
|
||||||
this.запускРаботToolStripMenuItem,
|
this.запускРаботToolStripMenuItem,
|
||||||
this.письмаToolStripMenuItem,
|
this.письмаToolStripMenuItem});
|
||||||
this.создатьБекапToolStripMenuItem});
|
|
||||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||||
this.menuStrip1.Name = "menuStrip1";
|
this.menuStrip1.Name = "menuStrip1";
|
||||||
this.menuStrip1.Size = new System.Drawing.Size(1703, 28);
|
this.menuStrip1.Size = new System.Drawing.Size(1703, 28);
|
||||||
@ -141,13 +139,6 @@
|
|||||||
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.Name = "письмаToolStripMenuItem";
|
|
||||||
this.письмаToolStripMenuItem.Size = new System.Drawing.Size(77, 24);
|
|
||||||
this.письмаToolStripMenuItem.Text = "Письма";
|
|
||||||
this.письмаToolStripMenuItem.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click);
|
|
||||||
//
|
|
||||||
// dataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
|
this.dataGridView.BackgroundColor = System.Drawing.Color.White;
|
||||||
@ -191,12 +182,12 @@
|
|||||||
this.buttonRef.UseVisualStyleBackColor = true;
|
this.buttonRef.UseVisualStyleBackColor = true;
|
||||||
this.buttonRef.Click += new System.EventHandler(this.buttonRef_Click);
|
this.buttonRef.Click += new System.EventHandler(this.buttonRef_Click);
|
||||||
//
|
//
|
||||||
// создатьБекапToolStripMenuItem
|
// письмаToolStripMenuItem
|
||||||
//
|
//
|
||||||
this.создатьБекапToolStripMenuItem.Name = "создатьБекапToolStripMenuItem";
|
this.письмаToolStripMenuItem.Name = "письмаToolStripMenuItem";
|
||||||
this.создатьБекапToolStripMenuItem.Size = new System.Drawing.Size(123, 24);
|
this.письмаToolStripMenuItem.Size = new System.Drawing.Size(77, 24);
|
||||||
this.создатьБекапToolStripMenuItem.Text = "Создать бекап";
|
this.письмаToolStripMenuItem.Text = "Письма";
|
||||||
this.создатьБекапToolStripMenuItem.Click += new System.EventHandler(this.создатьБекапToolStripMenuItem_Click);
|
this.письмаToolStripMenuItem.Click += new System.EventHandler(this.письмаToolStripMenuItem_Click);
|
||||||
//
|
//
|
||||||
// FormMain
|
// FormMain
|
||||||
//
|
//
|
||||||
@ -238,6 +229,5 @@
|
|||||||
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
private ToolStripMenuItem исполнителиToolStripMenuItem;
|
||||||
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
private ToolStripMenuItem запускРаботToolStripMenuItem;
|
||||||
private ToolStripMenuItem письмаToolStripMenuItem;
|
private ToolStripMenuItem письмаToolStripMenuItem;
|
||||||
private ToolStripMenuItem создатьБекапToolStripMenuItem;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,7 +1,6 @@
|
|||||||
using ConfectioneryBusinessLogic.BusinessLogics;
|
using ConfectioneryBusinessLogic.BusinessLogics;
|
||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
using ConfectioneryContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -21,16 +20,14 @@ namespace Confectionery
|
|||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
private readonly IWorkProcess _workProcess;
|
private readonly IWorkProcess _workProcess;
|
||||||
private readonly IBackUpLogic _backUpLogic;
|
|
||||||
|
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess, IBackUpLogic backUpLogic)
|
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
_orderLogic = orderLogic;
|
_orderLogic = orderLogic;
|
||||||
_reportLogic = reportLogic;
|
_reportLogic = reportLogic;
|
||||||
_workProcess = workProcess;
|
_workProcess = workProcess;
|
||||||
_backUpLogic = backUpLogic;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
@ -43,7 +40,18 @@ namespace Confectionery
|
|||||||
_logger.LogInformation("Загрузка заказов");
|
_logger.LogInformation("Загрузка заказов");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_orderLogic.ReadList(null));
|
var list = _orderLogic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["PastryId"].Visible = false;
|
||||||
|
dataGridView.Columns["PastryName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
dataGridView.Columns["ClientFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
dataGridView.Columns["ClientId"].Visible = false;
|
||||||
|
dataGridView.Columns["ClientEmail"].Visible = false;
|
||||||
|
dataGridView.Columns["ImplementerId"].Visible = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -54,7 +62,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void ингредиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void ингредиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormIngredients>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormIngredients));
|
||||||
if (service is FormIngredients form)
|
if (service is FormIngredients form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -63,7 +71,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void изделияToolStripMenuItem_Click(object sender, EventArgs e)
|
private void изделияToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormPastries>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormPastries));
|
||||||
if (service is FormPastries form)
|
if (service is FormPastries form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -72,7 +80,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
private void buttonCreateOrder_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
if (service is FormCreateOrder form)
|
if (service is FormCreateOrder form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -167,7 +175,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void IngredientPastriesToolStripMenuItem_Click(object sender, EventArgs e)
|
private void IngredientPastriesToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormReportPastryIngredients>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryIngredients));
|
||||||
if (service is FormReportPastryIngredients form)
|
if (service is FormReportPastryIngredients form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -176,7 +184,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
private void OrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormReportOrders>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
if (service is FormReportOrders form)
|
if (service is FormReportOrders form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -185,7 +193,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
private void клиентыToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormClients>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||||
if (service is FormClients form)
|
if (service is FormClients form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -194,7 +202,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
private void исполнителиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormImplementers>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
if (service is FormImplementers form)
|
if (service is FormImplementers form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
@ -203,37 +211,17 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void запускРаботToolStripMenuItem_Click(object sender, EventArgs e)
|
private void запускРаботToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>(), _orderLogic);
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
|
private void письмаToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormMails>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormMails));
|
||||||
if (service is FormMails form)
|
if (service is FormMails form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void создатьБекапToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (_backUpLogic != null)
|
|
||||||
{
|
|
||||||
var fbd = new FolderBrowserDialog();
|
|
||||||
if (fbd.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_backUpLogic.CreateBackUp(new BackUpSaveBinidngModel { FolderName = fbd.SelectedPath });
|
|
||||||
MessageBox.Show("Бекап создан", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
using ConfectioneryContracts.DI;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -35,7 +34,14 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
var list = _logic.ReadList(null);
|
||||||
|
if (list != null)
|
||||||
|
{
|
||||||
|
dataGridView.DataSource = list;
|
||||||
|
dataGridView.Columns["Id"].Visible = false;
|
||||||
|
dataGridView.Columns["PastryIngredients"].Visible = false;
|
||||||
|
dataGridView.Columns["PastryName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
||||||
|
}
|
||||||
_logger.LogInformation("Загрузка изделий");
|
_logger.LogInformation("Загрузка изделий");
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -47,7 +53,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormPastry>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
|
||||||
if (service is FormPastry form)
|
if (service is FormPastry form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
@ -61,7 +67,7 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormPastry>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
|
||||||
if (service is FormPastry form)
|
if (service is FormPastry form)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
using ConfectioneryContracts.BusinessLogicsContracts;
|
||||||
using ConfectioneryContracts.DI;
|
|
||||||
using ConfectioneryContracts.SearchModels;
|
using ConfectioneryContracts.SearchModels;
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
@ -80,7 +79,7 @@ namespace Confectionery
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormPastryIngredient>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormPastryIngredient));
|
||||||
if (service is FormPastryIngredient form)
|
if (service is FormPastryIngredient form)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
@ -107,7 +106,7 @@ namespace Confectionery
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = DependencyManager.Instance.Resolve<FormPastryIngredient>();
|
var service = Program.ServiceProvider?.GetService(typeof(FormPastryIngredient));
|
||||||
if (service is FormPastryIngredient form)
|
if (service is FormPastryIngredient form)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||||
|
@ -9,12 +9,13 @@ using Microsoft.Extensions.Logging;
|
|||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using ConfectioneryBusinessLogic.MailWorker;
|
using ConfectioneryBusinessLogic.MailWorker;
|
||||||
using ConfectioneryContracts.BindingModels;
|
using ConfectioneryContracts.BindingModels;
|
||||||
using ConfectioneryContracts.DI;
|
|
||||||
|
|
||||||
namespace Confectionery
|
namespace Confectionery
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
|
private static ServiceProvider? _serviceProvider;
|
||||||
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main entry point for the application.
|
/// The main entry point for the application.
|
||||||
@ -25,10 +26,12 @@ namespace Confectionery
|
|||||||
// To customize application configuration such as set high DPI settings or default font,
|
// To customize application configuration such as set high DPI settings or default font,
|
||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
InitDependency();
|
var services = new ServiceCollection();
|
||||||
|
ConfigureServices(services);
|
||||||
|
_serviceProvider = services.BuildServiceProvider();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
var mailSender = _serviceProvider.GetService<AbstractMailWorker>();
|
||||||
mailSender?.MailConfig(new MailConfigBindingModel
|
mailSender?.MailConfig(new MailConfigBindingModel
|
||||||
{
|
{
|
||||||
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
||||||
@ -44,51 +47,54 @@ namespace Confectionery
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
var logger = _serviceProvider.GetService<ILogger>();
|
||||||
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
||||||
}
|
}
|
||||||
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void InitDependency()
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
DependencyManager.InitDependency();
|
services.AddLogging(option =>
|
||||||
|
|
||||||
DependencyManager.Instance.AddLogging(option =>
|
|
||||||
{
|
{
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
option.AddNLog("nlog.config");
|
option.AddNLog("nlog.config");
|
||||||
});
|
});
|
||||||
|
services.AddTransient<IIngredientStorage, IngredientStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IIngredientLogic, IngredientLogic>();
|
services.AddTransient<IOrderStorage, OrderStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
services.AddTransient<IPastryStorage, PastryStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IPastryLogic, PastryLogic>();
|
services.AddTransient<IClientStorage, ClientStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
services.AddTransient<IIngredientLogic, IngredientLogic>();
|
||||||
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||||
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
services.AddTransient<IPastryLogic, PastryLogic>();
|
||||||
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
services.AddTransient<IReportLogic, ReportLogic>();
|
||||||
|
services.AddTransient<IClientLogic, ClientLogic>();
|
||||||
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||||
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||||
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
||||||
DependencyManager.Instance.RegisterType<FormMain>();
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
||||||
DependencyManager.Instance.RegisterType<FormIngredient>();
|
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
||||||
DependencyManager.Instance.RegisterType<FormIngredients>();
|
services.AddTransient<FormMain>();
|
||||||
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
services.AddTransient<FormIngredient>();
|
||||||
DependencyManager.Instance.RegisterType<FormPastry>();
|
services.AddTransient<FormIngredients>();
|
||||||
DependencyManager.Instance.RegisterType<FormPastryIngredient>();
|
services.AddTransient<FormCreateOrder>();
|
||||||
DependencyManager.Instance.RegisterType<FormPastries>();
|
services.AddTransient<FormPastry>();
|
||||||
DependencyManager.Instance.RegisterType<FormReportPastryIngredients>();
|
services.AddTransient<FormPastryIngredient>();
|
||||||
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
services.AddTransient<FormPastries>();
|
||||||
DependencyManager.Instance.RegisterType<FormClients>();
|
services.AddTransient<FormReportPastryIngredients>();
|
||||||
DependencyManager.Instance.RegisterType<FormImplementers>();
|
services.AddTransient<FormReportOrders>();
|
||||||
DependencyManager.Instance.RegisterType<FormImplementer>();
|
services.AddTransient<FormClients>();
|
||||||
DependencyManager.Instance.RegisterType<FormMails>();
|
services.AddTransient<FormImplementers>();
|
||||||
|
services.AddTransient<FormImplementer>();
|
||||||
|
services.AddTransient<FormMails>();
|
||||||
}
|
}
|
||||||
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
|
||||||
|
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,103 +0,0 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
|
||||||
using ConfectioneryContracts.BusinessLogicsContracts;
|
|
||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using ConfectioneryDataModels;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO.Compression;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.Serialization.Json;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryBusinessLogic.BusinessLogics
|
|
||||||
{
|
|
||||||
public class BackUpLogic : IBackUpLogic
|
|
||||||
{
|
|
||||||
private readonly ILogger _logger;
|
|
||||||
|
|
||||||
private readonly IBackUpInfo _backUpInfo;
|
|
||||||
|
|
||||||
public BackUpLogic(ILogger<BackUpLogic> logger, IBackUpInfo backUpInfo)
|
|
||||||
{
|
|
||||||
_logger = logger;
|
|
||||||
_backUpInfo = backUpInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CreateBackUp(BackUpSaveBinidngModel model)
|
|
||||||
{
|
|
||||||
if (_backUpInfo == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
try
|
|
||||||
{
|
|
||||||
_logger.LogDebug("Clear folder");
|
|
||||||
// зачистка папки и удаление старого архива
|
|
||||||
var dirInfo = new DirectoryInfo(model.FolderName);
|
|
||||||
if (dirInfo.Exists)
|
|
||||||
{
|
|
||||||
foreach (var file in dirInfo.GetFiles())
|
|
||||||
{
|
|
||||||
file.Delete();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Delete archive");
|
|
||||||
string fileName = $"{model.FolderName}.zip";
|
|
||||||
if (File.Exists(fileName))
|
|
||||||
{
|
|
||||||
File.Delete(fileName);
|
|
||||||
}
|
|
||||||
// берем метод для сохранения
|
|
||||||
_logger.LogDebug("Get assembly");
|
|
||||||
var typeIId = typeof(IId);
|
|
||||||
var assembly = typeIId.Assembly;
|
|
||||||
if (assembly == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Сборка не найдена", nameof(assembly));
|
|
||||||
}
|
|
||||||
var types = assembly.GetTypes();
|
|
||||||
var method = GetType().GetMethod("SaveToFile", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
||||||
_logger.LogDebug("Find {count} types", types.Length);
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
if (type.IsInterface && type.GetInterface(typeIId.Name) != null)
|
|
||||||
{
|
|
||||||
var modelType = _backUpInfo.GetTypeByModelInterface(type.Name);
|
|
||||||
if (modelType == null)
|
|
||||||
{
|
|
||||||
throw new InvalidOperationException($"Не найден класс-модель для {type.Name}");
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Call SaveToFile method for {name} type", type.Name);
|
|
||||||
// вызываем метод на выполнение
|
|
||||||
method?.MakeGenericMethod(modelType).Invoke(this, new object[] { model.FolderName });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_logger.LogDebug("Create zip and remove folder");
|
|
||||||
// архивируем
|
|
||||||
ZipFile.CreateFromDirectory(model.FolderName, fileName);
|
|
||||||
// удаляем папку
|
|
||||||
dirInfo.Delete(true);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
throw;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SaveToFile<T>(string folderName) where T : class, new()
|
|
||||||
{
|
|
||||||
var records = _backUpInfo.GetList<T>();
|
|
||||||
if (records == null)
|
|
||||||
{
|
|
||||||
_logger.LogWarning("{type} type get null list", typeof(T).Name);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var jsonFormatter = new DataContractJsonSerializer(typeof(List<T>));
|
|
||||||
using var fs = new FileStream(string.Format("{0}/{1}.json", folderName, typeof(T).Name), FileMode.OpenOrCreate);
|
|
||||||
jsonFormatter.WriteObject(fs, records);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.Attributes
|
|
||||||
{
|
|
||||||
[AttributeUsage(AttributeTargets.Property)]
|
|
||||||
public class ColumnAttribute : Attribute
|
|
||||||
{
|
|
||||||
public string Title { get; private set; }
|
|
||||||
|
|
||||||
public bool Visible { get; private set; }
|
|
||||||
|
|
||||||
public int Width { get; private set; }
|
|
||||||
|
|
||||||
public GridViewAutoSize GridViewAutoSize { get; private set; }
|
|
||||||
|
|
||||||
public bool IsUseAutoSize { get; private set; }
|
|
||||||
|
|
||||||
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
|
|
||||||
{
|
|
||||||
Title = title;
|
|
||||||
Visible = visible;
|
|
||||||
Width = width;
|
|
||||||
GridViewAutoSize = gridViewAutoSize;
|
|
||||||
IsUseAutoSize = isUseAutoSize;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.Attributes
|
|
||||||
{
|
|
||||||
public enum GridViewAutoSize
|
|
||||||
{
|
|
||||||
NotSet = 0,
|
|
||||||
None = 1,
|
|
||||||
ColumnHeader = 2,
|
|
||||||
AllCellsExceptHeader = 4,
|
|
||||||
AllCells = 6,
|
|
||||||
DisplayedCellsExceptHeader = 8,
|
|
||||||
DisplayedCells = 10,
|
|
||||||
Fill = 16
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.BindingModels
|
|
||||||
{
|
|
||||||
public class BackUpSaveBinidngModel
|
|
||||||
{
|
|
||||||
public string FolderName { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
@ -15,7 +15,5 @@ namespace ConfectioneryContracts.BindingModels
|
|||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
using ConfectioneryContracts.BindingModels;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.BusinessLogicsContracts
|
|
||||||
{
|
|
||||||
public interface IBackUpLogic
|
|
||||||
{
|
|
||||||
void CreateBackUp(BackUpSaveBinidngModel model);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,12 +6,6 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
|
||||||
<PackageReference Include="Unity" Version="5.11.10" />
|
|
||||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.DI
|
|
||||||
{
|
|
||||||
public class DependencyManager
|
|
||||||
{
|
|
||||||
private readonly IDependancyContainer _dependencyManager;
|
|
||||||
|
|
||||||
private static DependencyManager? _manager;
|
|
||||||
|
|
||||||
private static readonly object _locjObject = new();
|
|
||||||
|
|
||||||
private DependencyManager()
|
|
||||||
{
|
|
||||||
_dependencyManager = new UnityDependancyContainer();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static DependencyManager Instance { get { if (_manager == null) { lock (_locjObject) { _manager = new DependencyManager(); } } return _manager; } }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Иницализация библиотек, в которых идут установки зависомстей
|
|
||||||
/// </summary>
|
|
||||||
public static void InitDependency()
|
|
||||||
{
|
|
||||||
var ext = ServiceProviderLoader.GetImplementationExtensions();
|
|
||||||
if (ext == null)
|
|
||||||
{
|
|
||||||
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
|
||||||
}
|
|
||||||
// регистрируем зависимости
|
|
||||||
ext.RegisterServices();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Регистрация логгера
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="configure"></param>
|
|
||||||
public void AddLogging(Action<ILoggingBuilder> configure) => _dependencyManager.AddLogging(configure);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление зависимости
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <typeparam name="U"></typeparam>
|
|
||||||
public void RegisterType<T, U>(bool isSingle = false) where U : class, T where T : class => _dependencyManager.RegisterType<T, U>(isSingle);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление зависимости
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <typeparam name="U"></typeparam>
|
|
||||||
public void RegisterType<T>(bool isSingle = false) where T : class => _dependencyManager.RegisterType<T>(isSingle);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Получение класса со всеми зависмостями
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <returns></returns>
|
|
||||||
public T Resolve<T>() => _dependencyManager.Resolve<T>();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.DI
|
|
||||||
{
|
|
||||||
public interface IDependancyContainer
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Регистрация логгера
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="configure"></param>
|
|
||||||
void AddLogging(Action<ILoggingBuilder> configure);
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление зависимости
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <typeparam name="U"></typeparam>
|
|
||||||
/// <param name="isSingle"></param>
|
|
||||||
void RegisterType<T, U>(bool isSingle) where U : class, T where T : class;
|
|
||||||
/// <summary>
|
|
||||||
/// Добавление зависимости
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <param name="isSingle"></param>
|
|
||||||
void RegisterType<T>(bool isSingle) where T : class;
|
|
||||||
/// <summary>
|
|
||||||
/// Получение класса со всеми зависмостями
|
|
||||||
/// </summary>
|
|
||||||
/// <typeparam name="T"></typeparam>
|
|
||||||
/// <returns></returns>
|
|
||||||
T Resolve<T>();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.DI
|
|
||||||
{
|
|
||||||
public interface IImplementationExtension
|
|
||||||
{
|
|
||||||
public int Priority { get; }
|
|
||||||
/// <summary>
|
|
||||||
/// Регистрация сервисов
|
|
||||||
/// </summary>
|
|
||||||
public void RegisterServices();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,62 +0,0 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.DI
|
|
||||||
{
|
|
||||||
public class ServiceDependencyContainer : IDependancyContainer
|
|
||||||
{
|
|
||||||
private ServiceProvider? _serviceProvider;
|
|
||||||
|
|
||||||
private readonly ServiceCollection _serviceCollection;
|
|
||||||
|
|
||||||
public ServiceDependencyContainer()
|
|
||||||
{
|
|
||||||
_serviceCollection = new ServiceCollection();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AddLogging(Action<ILoggingBuilder> configure)
|
|
||||||
{
|
|
||||||
_serviceCollection.AddLogging(configure);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RegisterType<T, U>(bool isSingle) where U : class, T where T : class
|
|
||||||
{
|
|
||||||
if (isSingle)
|
|
||||||
{
|
|
||||||
_serviceCollection.AddSingleton<T, U>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_serviceCollection.AddTransient<T, U>();
|
|
||||||
}
|
|
||||||
_serviceProvider = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RegisterType<T>(bool isSingle) where T : class
|
|
||||||
{
|
|
||||||
if (isSingle)
|
|
||||||
{
|
|
||||||
_serviceCollection.AddSingleton<T>();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_serviceCollection.AddTransient<T>();
|
|
||||||
}
|
|
||||||
_serviceProvider = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Resolve<T>()
|
|
||||||
{
|
|
||||||
if (_serviceProvider == null)
|
|
||||||
{
|
|
||||||
_serviceProvider = _serviceCollection.BuildServiceProvider();
|
|
||||||
}
|
|
||||||
return _serviceProvider.GetService<T>()!;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,55 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.DI
|
|
||||||
{
|
|
||||||
public class ServiceProviderLoader
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Загрузка всех классов-реализаций IImplementationExtension
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static IImplementationExtension? GetImplementationExtensions()
|
|
||||||
{
|
|
||||||
IImplementationExtension? source = null;
|
|
||||||
var files = Directory.GetFiles(TryGetImplementationExtensionsFolder(), "*.dll", SearchOption.AllDirectories);
|
|
||||||
foreach (var file in files.Distinct())
|
|
||||||
{
|
|
||||||
Assembly asm = Assembly.LoadFrom(file);
|
|
||||||
foreach (var t in asm.GetExportedTypes())
|
|
||||||
{
|
|
||||||
if (t.IsClass && typeof(IImplementationExtension).IsAssignableFrom(t))
|
|
||||||
{
|
|
||||||
if (source == null)
|
|
||||||
{
|
|
||||||
source = (IImplementationExtension)Activator.CreateInstance(t)!;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var newSource = (IImplementationExtension)Activator.CreateInstance(t)!;
|
|
||||||
if (newSource.Priority > source.Priority)
|
|
||||||
{
|
|
||||||
source = newSource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string TryGetImplementationExtensionsFolder()
|
|
||||||
{
|
|
||||||
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
|
|
||||||
while (directory != null && !directory.GetDirectories("ImplementationExtensions", SearchOption.AllDirectories).Any(x => x.Name == "ImplementationExtensions"))
|
|
||||||
{
|
|
||||||
directory = directory.Parent;
|
|
||||||
}
|
|
||||||
return $"{directory?.FullName}\\ImplementationExtensions";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using Unity.Microsoft.Logging;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Unity;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.DI
|
|
||||||
{
|
|
||||||
public class UnityDependancyContainer : IDependancyContainer
|
|
||||||
{
|
|
||||||
private readonly UnityContainer _unityContainer;
|
|
||||||
|
|
||||||
public UnityDependancyContainer()
|
|
||||||
{
|
|
||||||
_unityContainer = new UnityContainer();
|
|
||||||
}
|
|
||||||
public void AddLogging(Action<ILoggingBuilder> configure)
|
|
||||||
{
|
|
||||||
_unityContainer.AddExtension(new LoggingExtension(LoggerFactory.Create(configure)));
|
|
||||||
}
|
|
||||||
|
|
||||||
void IDependancyContainer.RegisterType<T, U>(bool isSingle)
|
|
||||||
{
|
|
||||||
if (isSingle) _unityContainer.RegisterSingleton<T, U>();
|
|
||||||
else _unityContainer.RegisterType<T, U>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RegisterType<T>(bool isSingle) where T : class
|
|
||||||
{
|
|
||||||
if (isSingle) _unityContainer.RegisterSingleton<T>();
|
|
||||||
else _unityContainer.RegisterType<T>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public T Resolve<T>()
|
|
||||||
{
|
|
||||||
return _unityContainer.Resolve<T>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryContracts.StoragesContracts
|
|
||||||
{
|
|
||||||
public interface IBackUpInfo
|
|
||||||
{
|
|
||||||
List<T>? GetList<T>() where T : class, new();
|
|
||||||
|
|
||||||
Type? GetTypeByModelInterface(string modelInterfaceName);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryDataModels.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,13 +10,12 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ClientViewModel : IClientModel
|
public class ClientViewModel : IClientModel
|
||||||
{
|
{
|
||||||
[Column(visible:false)]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Column(title:"ФИО клиента", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)]
|
[DisplayName("ФИО клиента")]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
[Column(title:"Логин (эл. почта)", width:200)]
|
[DisplayName("Логин (эл. почта)")]
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
[Column(title:"Пароль", width:150)]
|
[DisplayName("Пароль")]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryDataModels.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,15 +10,14 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class ImplementerViewModel : IImplementerModel
|
public class ImplementerViewModel : IImplementerModel
|
||||||
{
|
{
|
||||||
[Column(visible:false)]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Column(title:"ФИО", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)]
|
[DisplayName("ФИО")]
|
||||||
public string ImplementerFIO { get; set; } = String.Empty;
|
public string ImplementerFIO { get; set; } = String.Empty;
|
||||||
[Column(title:"Пароль", width:150)]
|
[DisplayName("Пароль")]
|
||||||
public string Password { get; set; } = String.Empty;
|
public string Password { get; set; } = String.Empty;
|
||||||
[Column(title:"Опыт работы", width:120)]
|
[DisplayName("Опыт работы")]
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
[Column(title:"Квалификация", width:120)]
|
[DisplayName("Квалификация")]
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryDataModels.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,11 +10,10 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class IngredientViewModel : IIngredientModel
|
public class IngredientViewModel : IIngredientModel
|
||||||
{
|
{
|
||||||
[Column(visible:false)]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Column(title:"Название ингредиента", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)]
|
[DisplayName("Название ингредиента")]
|
||||||
public string IngredientName { get; set; } = string.Empty;
|
public string IngredientName { get; set; } = string.Empty;
|
||||||
[Column(title:"Цена", width:50)]
|
[DisplayName("Цена")]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryDataModels.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,19 +10,15 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class MessageInfoViewModel : IMessageInfoModel
|
public class MessageInfoViewModel : IMessageInfoModel
|
||||||
{
|
{
|
||||||
[Column(visible:false)]
|
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
[Column(visible:false)]
|
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
[Column(title:"Отправитель", width:75)]
|
[DisplayName("Отправитель")]
|
||||||
public string SenderName { get; set; } = string.Empty;
|
public string SenderName { get; set; } = string.Empty;
|
||||||
[Column(title:"Доставлено")]
|
[DisplayName("Доставлено")]
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
[Column(title:"Заголовок", width:75)]
|
[DisplayName("Заголовок")]
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
[Column(title:"Текст", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)]
|
[DisplayName("Текст")]
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
using ConfectioneryDataModels.Enums;
|
||||||
using ConfectioneryDataModels.Enums;
|
|
||||||
using ConfectioneryDataModels.Models;
|
using ConfectioneryDataModels.Models;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@ -12,31 +11,27 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class OrderViewModel : IOrderModel
|
public class OrderViewModel : IOrderModel
|
||||||
{
|
{
|
||||||
[Column(title:"Номер")]
|
[DisplayName("Номер")]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Column(visible:false)]
|
|
||||||
public int PastryId { get; set; }
|
public int PastryId { get; set; }
|
||||||
[Column(title:"Кондитерское изделие", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)]
|
[DisplayName("Кондитерское изделие")]
|
||||||
public string PastryName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
[Column(visible:false)]
|
|
||||||
public int? ImplementerId { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
[Column(title:"Исполнитель", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
[DisplayName("Исполнитель")]
|
||||||
public string? ImplementerFIO { get; set; }
|
public string? ImplementerFIO { get; set; }
|
||||||
[Column(visible:false)]
|
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
[Column(title:"ФИО клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
[DisplayName("ФИО клиента")]
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
[Column(visible:false)]
|
|
||||||
public string ClientEmail { get; set; } = string.Empty;
|
public string ClientEmail { get; set; } = string.Empty;
|
||||||
[Column(title:"Количество", width:100)]
|
[DisplayName("Количество")]
|
||||||
public int Count { get; set; }
|
public int Count { get; set; }
|
||||||
[Column(title:"Сумма", width:100)]
|
[DisplayName("Сумма")]
|
||||||
public double Sum { get; set; }
|
public double Sum { get; set; }
|
||||||
[Column(title:"Статус", width:125)]
|
[DisplayName("Статус")]
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
[Column(title:"Дата создания", width: 120)]
|
[DisplayName("Дата создания")]
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
[Column(title:"Дата выполнения", width: 120)]
|
[DisplayName("Дата выполнения")]
|
||||||
public DateTime? DateImplement { get; set; }
|
public DateTime? DateImplement { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using ConfectioneryContracts.Attributes;
|
using ConfectioneryDataModels.Models;
|
||||||
using ConfectioneryDataModels.Models;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
@ -11,13 +10,11 @@ namespace ConfectioneryContracts.ViewModels
|
|||||||
{
|
{
|
||||||
public class PastryViewModel : IPastryModel
|
public class PastryViewModel : IPastryModel
|
||||||
{
|
{
|
||||||
[Column(visible:false)]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[Column(title:"Название кондитерского изделия", gridViewAutoSize:GridViewAutoSize.Fill, isUseAutoSize:true)]
|
[DisplayName("Название кондитерского изделия")]
|
||||||
public string PastryName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
[Column(title:"Цена", width:75)]
|
[DisplayName("Цена")]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
[Column(visible:false)]
|
|
||||||
public Dictionary<int, (IIngredientModel, int)> PastryIngredients
|
public Dictionary<int, (IIngredientModel, int)> PastryIngredients
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
@ -20,8 +20,4 @@
|
|||||||
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
||||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
using ConfectioneryContracts.DI;
|
|
||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using ConfectioneryDataBaseImplement.Implements;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement
|
|
||||||
{
|
|
||||||
public class DataBaseImplementationExtension : IImplementationExtension
|
|
||||||
{
|
|
||||||
public int Priority => 3;
|
|
||||||
public void RegisterServices()
|
|
||||||
{
|
|
||||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IIngredientStorage, IngredientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Implements
|
|
||||||
{
|
|
||||||
public class BackUpInfo : IBackUpInfo
|
|
||||||
{
|
|
||||||
public List<T>? GetList<T>() where T : class, new()
|
|
||||||
{
|
|
||||||
using var context = new ConfectioneryDatabase();
|
|
||||||
return context.Set<T>().ToList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
|
||||||
{
|
|
||||||
var assembly = typeof(BackUpInfo).Assembly;
|
|
||||||
var types = assembly.GetTypes();
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
if (type.IsClass && type.GetInterface(modelInterfaceName) != null)
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,281 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
using System;
|
|
||||||
using ConfectioneryDataBaseImplement;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
[DbContext(typeof(ConfectioneryDatabase))]
|
|
||||||
[Migration("20230515055212_IdForMessageInfo")]
|
|
||||||
partial class IdForMessageInfo
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
|
||||||
{
|
|
||||||
#pragma warning disable 612, 618
|
|
||||||
modelBuilder
|
|
||||||
.HasAnnotation("ProductVersion", "7.0.3")
|
|
||||||
.HasAnnotation("Relational:MaxIdentifierLength", 128);
|
|
||||||
|
|
||||||
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Client", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ClientFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Clients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Implementer", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("ImplementerFIO")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Password")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int>("Qualification")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("WorkExperience")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Implementers");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Ingredient", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<double>("Cost")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.Property<string>("IngredientName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Ingredients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.MessageInfo", b =>
|
|
||||||
{
|
|
||||||
b.Property<string>("MessageId")
|
|
||||||
.HasColumnType("nvarchar(450)");
|
|
||||||
|
|
||||||
b.Property<string>("Body")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<int?>("ClientId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateDelivery")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SenderName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<string>("Subject")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.HasKey("MessageId");
|
|
||||||
|
|
||||||
b.ToTable("MessageInfos");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("ClientId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<DateTime>("DateCreate")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<DateTime?>("DateImplement")
|
|
||||||
.HasColumnType("datetime2");
|
|
||||||
|
|
||||||
b.Property<int?>("ImplementerId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PastryId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<double>("Sum")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ClientId");
|
|
||||||
|
|
||||||
b.HasIndex("ImplementerId");
|
|
||||||
|
|
||||||
b.HasIndex("PastryId");
|
|
||||||
|
|
||||||
b.ToTable("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Pastry", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<string>("PastryName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("nvarchar(max)");
|
|
||||||
|
|
||||||
b.Property<double>("Price")
|
|
||||||
.HasColumnType("float");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Pastrys");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.PastryIngredient", b =>
|
|
||||||
{
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
|
|
||||||
|
|
||||||
b.Property<int>("Count")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("IngredientId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<int>("PastryId")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("IngredientId");
|
|
||||||
|
|
||||||
b.HasIndex("PastryId");
|
|
||||||
|
|
||||||
b.ToTable("PastryIngredients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Order", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ConfectioneryDataBaseImplement.Models.Client", "Client")
|
|
||||||
.WithMany()
|
|
||||||
.HasForeignKey("ClientId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ConfectioneryDataBaseImplement.Models.Implementer", "Implementer")
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("ImplementerId");
|
|
||||||
|
|
||||||
b.HasOne("ConfectioneryDataBaseImplement.Models.Pastry", null)
|
|
||||||
.WithMany("Orders")
|
|
||||||
.HasForeignKey("PastryId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Client");
|
|
||||||
|
|
||||||
b.Navigation("Implementer");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.PastryIngredient", b =>
|
|
||||||
{
|
|
||||||
b.HasOne("ConfectioneryDataBaseImplement.Models.Ingredient", "Ingredient")
|
|
||||||
.WithMany("PastryIgredients")
|
|
||||||
.HasForeignKey("IngredientId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.HasOne("ConfectioneryDataBaseImplement.Models.Pastry", "Pastry")
|
|
||||||
.WithMany("Ingredients")
|
|
||||||
.HasForeignKey("PastryId")
|
|
||||||
.OnDelete(DeleteBehavior.Cascade)
|
|
||||||
.IsRequired();
|
|
||||||
|
|
||||||
b.Navigation("Ingredient");
|
|
||||||
|
|
||||||
b.Navigation("Pastry");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Implementer", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Ingredient", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("PastryIgredients");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("ConfectioneryDataBaseImplement.Models.Pastry", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Ingredients");
|
|
||||||
|
|
||||||
b.Navigation("Orders");
|
|
||||||
});
|
|
||||||
#pragma warning restore 612, 618
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class IdForMessageInfo : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.AddColumn<int>(
|
|
||||||
name: "Id",
|
|
||||||
table: "MessageInfos",
|
|
||||||
type: "int",
|
|
||||||
nullable: false,
|
|
||||||
defaultValue: 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropColumn(
|
|
||||||
name: "Id",
|
|
||||||
table: "MessageInfos");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -109,9 +109,6 @@ namespace ConfectioneryDataBaseImplement.Migrations
|
|||||||
b.Property<DateTime>("DateDelivery")
|
b.Property<DateTime>("DateDelivery")
|
||||||
.HasColumnType("datetime2");
|
.HasColumnType("datetime2");
|
||||||
|
|
||||||
b.Property<int>("Id")
|
|
||||||
.HasColumnType("int");
|
|
||||||
|
|
||||||
b.Property<string>("SenderName")
|
b.Property<string>("SenderName")
|
||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("nvarchar(max)");
|
.HasColumnType("nvarchar(max)");
|
||||||
|
@ -6,24 +6,18 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Models
|
namespace ConfectioneryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Client : IClientModel
|
public class Client : IClientModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string ClientFIO { get; private set; } = string.Empty;
|
public string ClientFIO { get; private set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Email { get; private set; } = string.Empty;
|
public string Email { get; private set; } = string.Empty;
|
||||||
|
|
||||||
|
@ -6,27 +6,20 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Models
|
namespace ConfectioneryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Implementer : IImplementerModel
|
public class Implementer : IImplementerModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
[ForeignKey("ImplementerId")]
|
[ForeignKey("ImplementerId")]
|
||||||
|
@ -6,21 +6,16 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Models
|
namespace ConfectioneryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Ingredient : IIngredientModel
|
public class Ingredient : IIngredientModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string IngredientName { get; private set; } = string.Empty;
|
public string IngredientName { get; private set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
[ForeignKey("IngredientId")]
|
[ForeignKey("IngredientId")]
|
||||||
|
@ -6,31 +6,23 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Models
|
namespace ConfectioneryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class MessageInfo : IMessageInfoModel
|
public class MessageInfo : IMessageInfoModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
[Key]
|
[Key]
|
||||||
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
[DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string SenderName { get; set; } = string.Empty;
|
public string SenderName { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
@ -60,6 +52,5 @@ namespace ConfectioneryDataBaseImplement.Models
|
|||||||
Subject = Subject,
|
Subject = Subject,
|
||||||
DateDelivery = DateDelivery
|
DateDelivery = DateDelivery
|
||||||
};
|
};
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,40 +6,29 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Models
|
namespace ConfectioneryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public int PastryId { get; private set; }
|
public int PastryId { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public int ClientId { get; set; }
|
public int ClientId { get; set; }
|
||||||
public virtual Client Client { get; set; } = new();
|
public virtual Client Client { get; set; } = new();
|
||||||
[DataMember]
|
|
||||||
public int? ImplementerId { get; set; }
|
public int? ImplementerId { get; set; }
|
||||||
public virtual Implementer? Implementer { get; set; } = new();
|
public virtual Implementer? Implementer { get; set; } = new();
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public OrderStatus Status { get; private set; }
|
public OrderStatus Status { get; private set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public DateTime DateCreate { get; private set; }
|
public DateTime DateCreate { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
public static Order? Create(ConfectioneryDatabase context, OrderBindingModel? model)
|
public static Order? Create(ConfectioneryDatabase context, OrderBindingModel? model)
|
||||||
{
|
{
|
||||||
|
@ -6,25 +6,19 @@ using System.Collections.Generic;
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace ConfectioneryDataBaseImplement.Models
|
namespace ConfectioneryDataBaseImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Pastry : IPastryModel
|
public class Pastry : IPastryModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public string PastryName { get; set; } = string.Empty;
|
public string PastryName { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
[Required]
|
[Required]
|
||||||
public double Price { get; set; }
|
public double Price { get; set; }
|
||||||
private Dictionary<int, (IIngredientModel, int)>? _pastryIngredients = null;
|
private Dictionary<int, (IIngredientModel, int)>? _pastryIngredients = null;
|
||||||
[DataMember]
|
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public Dictionary<int, (IIngredientModel, int)> PastryIngredients
|
public Dictionary<int, (IIngredientModel, int)> PastryIngredients
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
|||||||
|
|
||||||
namespace ConfectioneryDataModels.Models
|
namespace ConfectioneryDataModels.Models
|
||||||
{
|
{
|
||||||
public interface IMessageInfoModel : IId
|
public interface IMessageInfoModel
|
||||||
{
|
{
|
||||||
string MessageId { get; }
|
string MessageId { get; }
|
||||||
int? ClientId { get; }
|
int? ClientId { get; }
|
||||||
|
@ -11,8 +11,4 @@
|
|||||||
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
||||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,26 +0,0 @@
|
|||||||
using ConfectioneryContracts.DI;
|
|
||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using ConfectioneryFileImplement.Implements;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement
|
|
||||||
{
|
|
||||||
public class FileImplementationExtension : IImplementationExtension
|
|
||||||
{
|
|
||||||
public int Priority => 1;
|
|
||||||
public void RegisterServices()
|
|
||||||
{
|
|
||||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IIngredientStorage, IngredientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Implements
|
|
||||||
{
|
|
||||||
public class BackUpInfo : IBackUpInfo
|
|
||||||
{
|
|
||||||
public readonly DataFileSingleton _source;
|
|
||||||
|
|
||||||
public BackUpInfo()
|
|
||||||
{
|
|
||||||
_source = DataFileSingleton.GetInstance();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<T>? GetList<T>() where T : class, new()
|
|
||||||
{
|
|
||||||
Type type = typeof(T);
|
|
||||||
var list = _source.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)
|
|
||||||
.FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments().First() == type)?.GetValue(_source);
|
|
||||||
return (List<T>?)list;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
|
||||||
{
|
|
||||||
var assembly = typeof(BackUpInfo).Assembly;
|
|
||||||
var types = assembly.GetTypes();
|
|
||||||
foreach (var type in types)
|
|
||||||
{
|
|
||||||
if (type.IsClass && type.GetInterface(modelInterfaceName) != null)
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -4,23 +4,17 @@ using ConfectioneryDataModels.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Client : IClientModel
|
public class Client : IClientModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DataMember]
|
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
public static Client? Create(ClientBindingModel? model)
|
public static Client? Create(ClientBindingModel? model)
|
||||||
{
|
{
|
||||||
|
@ -5,25 +5,21 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Implementer : IImplementerModel
|
public class Implementer : IImplementerModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public int WorkExperience { get; set; }
|
public int WorkExperience { get; set; }
|
||||||
[DataMember]
|
|
||||||
public int Qualification { get; set; }
|
public int Qualification { get; set; }
|
||||||
|
|
||||||
public static Implementer? Create(ImplementerBindingModel? model)
|
public static Implementer? Create(ImplementerBindingModel? model)
|
||||||
|
@ -5,21 +5,16 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Ingredient : IIngredientModel
|
public class Ingredient : IIngredientModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public string IngredientName { get; private set; } = string.Empty;
|
public string IngredientName { get; private set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public double Cost { get; set; }
|
public double Cost { get; set; }
|
||||||
public static Ingredient? Create(IngredientBindingModel model)
|
public static Ingredient? Create(IngredientBindingModel model)
|
||||||
{
|
{
|
||||||
|
@ -4,27 +4,19 @@ using ConfectioneryDataModels.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class MessageInfo : IMessageInfoModel
|
public class MessageInfo : IMessageInfoModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public string MessageId { get; set; } = string.Empty;
|
public string MessageId { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public int? ClientId { get; set; }
|
public int? ClientId { get; set; }
|
||||||
[DataMember]
|
|
||||||
public string SenderName { get; set; } = string.Empty;
|
public string SenderName { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
[DataMember]
|
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Subject { get; set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||||
@ -78,7 +70,5 @@ namespace ConfectioneryFileImplement.Models
|
|||||||
new XElement("Subject", Subject),
|
new XElement("Subject", Subject),
|
||||||
new XElement("Body", Body),
|
new XElement("Body", Body),
|
||||||
new XElement("DateDelivery", DateDelivery.ToString()));
|
new XElement("DateDelivery", DateDelivery.ToString()));
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,33 +5,25 @@ using ConfectioneryDataModels.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Order : IOrderModel
|
public class Order : IOrderModel
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public int PastryId { get; private set; }
|
public int PastryId { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public int ClientId { get; private set; }
|
public int ClientId { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public int? ImplementerId { get; private set; }
|
public int? ImplementerId { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public int Count { get; private set; }
|
public int Count { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public double Sum { get; private set; }
|
public double Sum { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public OrderStatus Status { get; private set; }
|
public OrderStatus Status { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public DateTime DateCreate { get; private set; }
|
public DateTime DateCreate { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public DateTime? DateImplement { get; private set; }
|
public DateTime? DateImplement { get; private set; }
|
||||||
|
|
||||||
public static Order? Create(OrderBindingModel? model)
|
public static Order? Create(OrderBindingModel? model)
|
||||||
|
@ -4,23 +4,17 @@ using ConfectioneryDataModels.Models;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace ConfectioneryFileImplement.Models
|
namespace ConfectioneryFileImplement.Models
|
||||||
{
|
{
|
||||||
[DataContract]
|
|
||||||
public class Pastry
|
public class Pastry
|
||||||
{
|
{
|
||||||
[DataMember]
|
|
||||||
public int Id { get; private set; }
|
public int Id { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public string PastryName { get; private set; } = string.Empty;
|
public string PastryName { get; private set; } = string.Empty;
|
||||||
[DataMember]
|
|
||||||
public double Price { get; private set; }
|
public double Price { get; private set; }
|
||||||
[DataMember]
|
|
||||||
public Dictionary<int, int> Ingredients { get; private set; } = new();
|
public Dictionary<int, int> Ingredients { get; private set; } = new();
|
||||||
private Dictionary<int, (IIngredientModel, int)>? _pastryIngredients = null;
|
private Dictionary<int, (IIngredientModel, int)>? _pastryIngredients = null;
|
||||||
public Dictionary<int, (IIngredientModel, int)> PastryIngredients
|
public Dictionary<int, (IIngredientModel, int)> PastryIngredients
|
||||||
|
@ -11,8 +11,4 @@
|
|||||||
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
<ProjectReference Include="..\ConfectioneryDataModels\ConfectioneryDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
|
||||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryListImplement.Implements
|
|
||||||
{
|
|
||||||
public class BackUpInfo : IBackUpInfo
|
|
||||||
{
|
|
||||||
public List<T>? GetList<T>() where T : class, new()
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Type? GetTypeByModelInterface(string modelInterfaceName)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
using ConfectioneryContracts.DI;
|
|
||||||
using ConfectioneryContracts.StoragesContracts;
|
|
||||||
using ConfectioneryListImplement.Implements;
|
|
||||||
using ConfectioneryListImplement.Models;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace ConfectioneryListImplement
|
|
||||||
{
|
|
||||||
public class ListImplementationExtension : IImplementationExtension
|
|
||||||
{
|
|
||||||
public int Priority => 0;
|
|
||||||
public void RegisterServices()
|
|
||||||
{
|
|
||||||
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IIngredientStorage, IngredientStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IPastryStorage, PastryStorage>();
|
|
||||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -44,7 +44,5 @@ namespace ConfectioneryListImplement.Models
|
|||||||
Subject = Subject,
|
Subject = Subject,
|
||||||
DateDelivery = DateDelivery
|
DateDelivery = DateDelivery
|
||||||
};
|
};
|
||||||
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user