оно должно работать но не работает
This commit is contained in:
parent
06a496aa5f
commit
501b3bb6cf
46
SushiBar/SushiBar/Extensions/DataGridViewExtension.cs
Normal file
46
SushiBar/SushiBar/Extensions/DataGridViewExtension.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
using SushiBarContracts.Attributes;
|
||||||
|
|
||||||
|
namespace SushiBar.Extensions
|
||||||
|
{
|
||||||
|
public 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
SushiBar/SushiBar/Forms/FormClients.Designer.cs
generated
24
SushiBar/SushiBar/Forms/FormClients.Designer.cs
generated
@ -28,19 +28,19 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
DataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
DeleteButton = new Button();
|
DeleteButton = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
//
|
//
|
||||||
// DataGridView
|
// dataGridView
|
||||||
//
|
//
|
||||||
DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
DataGridView.Location = new Point(12, 34);
|
dataGridView.Location = new Point(12, 34);
|
||||||
DataGridView.Name = "DataGridView";
|
dataGridView.Name = "DataGridView";
|
||||||
DataGridView.RowTemplate.Height = 25;
|
dataGridView.RowTemplate.Height = 25;
|
||||||
DataGridView.Size = new Size(776, 404);
|
dataGridView.Size = new Size(776, 404);
|
||||||
DataGridView.TabIndex = 0;
|
dataGridView.TabIndex = 0;
|
||||||
//
|
//
|
||||||
// DeleteButton
|
// DeleteButton
|
||||||
//
|
//
|
||||||
@ -58,17 +58,17 @@
|
|||||||
AutoScaleMode = AutoScaleMode.Font;
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
ClientSize = new Size(800, 450);
|
ClientSize = new Size(800, 450);
|
||||||
Controls.Add(DeleteButton);
|
Controls.Add(DeleteButton);
|
||||||
Controls.Add(DataGridView);
|
Controls.Add(dataGridView);
|
||||||
Name = "ClientsForm";
|
Name = "ClientsForm";
|
||||||
Text = "Клиенты";
|
Text = "Клиенты";
|
||||||
Load += ClientsForm_Load;
|
Load += ClientsForm_Load;
|
||||||
((System.ComponentModel.ISupportInitialize)DataGridView).EndInit();
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private DataGridView DataGridView;
|
private DataGridView dataGridView;
|
||||||
private Button DeleteButton;
|
private Button DeleteButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBar.Extensions;
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
@ -17,28 +18,22 @@ namespace SushiBar.Forms
|
|||||||
|
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
var list = _logic.ReadList(null);
|
||||||
if (list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
DataGridView.DataSource = list;
|
dataGridView.FillandConfigGrid(list);
|
||||||
DataGridView.Columns["Id"].Visible = false;
|
_logger.LogInformation("Загрузка клиентов");
|
||||||
DataGridView.Columns["ClientFIO"].AutoSizeMode =
|
}
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
_logger.LogInformation("Загрузка клиентов");
|
||||||
DataGridView.Columns["Email"].AutoSizeMode =
|
}
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
catch (Exception ex)
|
||||||
DataGridView.Columns["Password"].AutoSizeMode =
|
{
|
||||||
DataGridViewAutoSizeColumnMode.Fill;
|
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
||||||
}
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
_logger.LogInformation("Загрузка клиентов");
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки клиентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ClientsForm_Load(object sender, EventArgs e)
|
private void ClientsForm_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -47,12 +42,12 @@ namespace SushiBar.Forms
|
|||||||
|
|
||||||
private void DeleteButton_Click(object sender, EventArgs e)
|
private void DeleteButton_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (DataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
if (MessageBox.Show("Удалить запись?", "Вопрос",
|
||||||
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
int id = Convert.ToInt32(DataGridView.SelectedRows[0].Cells["Id"].Value);
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
_logger.LogInformation("Удаление клиента");
|
_logger.LogInformation("Удаление клиента");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBar.Extensions;
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
namespace SushiBar.Forms
|
||||||
{
|
{
|
||||||
@ -20,23 +21,17 @@ namespace SushiBar.Forms
|
|||||||
}
|
}
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
_logger.LogInformation("Загрузка компонентов");
|
||||||
{
|
}
|
||||||
dataGridView.DataSource = list;
|
catch (Exception ex)
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
{
|
||||||
dataGridView.Columns["ComponentName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
||||||
}
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
||||||
|
@ -20,24 +20,25 @@ namespace SushiBar.Forms
|
|||||||
}
|
}
|
||||||
private void FormCreateOrder_Load(object sender, EventArgs e)
|
private void FormCreateOrder_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
_logger.LogInformation("Загрузка суши для заказа");
|
||||||
{
|
try
|
||||||
_logger.LogInformation("Загрузка суши для заказа");
|
{
|
||||||
List<SushiViewModel>? _list = _logicS.ReadList(null);
|
var list = _logicS.ReadList(null);
|
||||||
if (_list != null)
|
if (list != null)
|
||||||
{
|
{
|
||||||
ComboBoxSushi.DisplayMember = "SushiName";
|
ComboBoxSushi.DisplayMember = "SushiCreamName";
|
||||||
ComboBoxSushi.ValueMember = "Id";
|
ComboBoxSushi.ValueMember = "Id";
|
||||||
ComboBoxSushi.DataSource = _list;
|
ComboBoxSushi.DataSource = list;
|
||||||
ComboBoxSushi.SelectedItem = null;
|
ComboBoxSushi.SelectedItem = null;
|
||||||
}
|
}
|
||||||
}
|
_logger.LogInformation("Суши загружено");
|
||||||
catch (Exception ex)
|
}
|
||||||
{
|
catch (Exception ex)
|
||||||
_logger.LogError(ex, "Ошибка загрузки суши");
|
{
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
_logger.LogError(ex, "Ошибка загрузки суши");
|
||||||
}
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
private void CalcSum()
|
private void CalcSum()
|
||||||
{
|
{
|
||||||
if (ComboBoxSushi.SelectedValue != null && !string.IsNullOrEmpty(TextBoxCount.Text))
|
if (ComboBoxSushi.SelectedValue != null && !string.IsNullOrEmpty(TextBoxCount.Text))
|
||||||
|
@ -40,8 +40,7 @@ namespace SushiBar.Forms
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка получения исполнителя");
|
_logger.LogError(ex, "Ошибка получения исполнителя");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBar.Extensions;
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
namespace SushiBar.Forms
|
||||||
{
|
{
|
||||||
@ -24,23 +26,13 @@ namespace SushiBar.Forms
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
_logger.LogInformation("Загрузка исполнителей");
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
|
||||||
dataGridView.Columns["ImplementerFIO"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["Password"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["Qualification"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
dataGridView.Columns["WorkExperience"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка компонентов");
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
_logger.LogError(ex, "Ошибка загрузки исполнителей");
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void CreateButton_Click(object sender, EventArgs e)
|
private void CreateButton_Click(object sender, EventArgs e)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBar.Extensions;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
namespace SushiBar.Forms
|
||||||
@ -16,24 +17,16 @@ namespace SushiBar.Forms
|
|||||||
|
|
||||||
private void FormMailView_Load(object sender, EventArgs e)
|
private void FormMailView_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
_logger.LogInformation("Загрузка списка писем");
|
||||||
{
|
}
|
||||||
dataGridView.DataSource = list;
|
catch (Exception ex)
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
{
|
||||||
dataGridView.Columns["MessageId"].Visible = false;
|
_logger.LogError(ex, "Ошибка загрузки писем");
|
||||||
dataGridView.Columns["Body"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка списка писем");
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки писем");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
|
||||||
MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
477
SushiBar/SushiBar/Forms/FormMain.Designer.cs
generated
477
SushiBar/SushiBar/Forms/FormMain.Designer.cs
generated
@ -20,242 +20,250 @@
|
|||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Windows Form Designer generated code
|
#region Windows Form Designer generated code
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Required method for Designer support - do not modify
|
/// Required method for Designer support - do not modify
|
||||||
/// the contents of this method with the code editor.
|
/// the contents of this method with the code editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
dataGridView = new DataGridView();
|
dataGridView = new DataGridView();
|
||||||
menuStrip1 = new MenuStrip();
|
menuStrip1 = new MenuStrip();
|
||||||
toolStripMenuItem = new ToolStripMenuItem();
|
toolStripMenuItem = new ToolStripMenuItem();
|
||||||
sushiToolStripMenuItem = new ToolStripMenuItem();
|
sushiToolStripMenuItem = new ToolStripMenuItem();
|
||||||
componentsToolStripMenuItem = new ToolStripMenuItem();
|
componentsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
clientsToolStripMenuItem = new ToolStripMenuItem();
|
clientsToolStripMenuItem = new ToolStripMenuItem();
|
||||||
implementersToolStripMenuItem = new ToolStripMenuItem();
|
implementersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчётыToolStripMenuItem1 = new ToolStripMenuItem();
|
отчётыToolStripMenuItem1 = new ToolStripMenuItem();
|
||||||
sushisReportToolStripMenuItem = new ToolStripMenuItem();
|
sushisReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
componentsReportПоСушиToolStripMenuItem = new ToolStripMenuItem();
|
componentsReportПоСушиToolStripMenuItem = new ToolStripMenuItem();
|
||||||
orderReportToolStripMenuItem = new ToolStripMenuItem();
|
orderReportToolStripMenuItem = new ToolStripMenuItem();
|
||||||
startWorksToolStripMenuItem = new ToolStripMenuItem();
|
startWorksToolStripMenuItem = new ToolStripMenuItem();
|
||||||
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
MailToolStripMenuItem = new ToolStripMenuItem();
|
||||||
sushisToolStripMenuItem = new ToolStripMenuItem();
|
отчётыToolStripMenuItem = new ToolStripMenuItem();
|
||||||
componentSushisToolStripMenuItem = new ToolStripMenuItem();
|
sushisToolStripMenuItem = new ToolStripMenuItem();
|
||||||
ordersToolStripMenuItem = new ToolStripMenuItem();
|
componentSushisToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonCreateOrder = new Button();
|
ordersToolStripMenuItem = new ToolStripMenuItem();
|
||||||
buttonTakeOrderInWork = new Button();
|
buttonCreateOrder = new Button();
|
||||||
buttonOrderReady = new Button();
|
buttonTakeOrderInWork = new Button();
|
||||||
buttonIssuedOrder = new Button();
|
buttonOrderReady = new Button();
|
||||||
buttonRef = new Button();
|
buttonIssuedOrder = new Button();
|
||||||
MailToolStripMenuItem = new ToolStripMenuItem();
|
buttonRef = new Button();
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
backupToolStripMenuItem = new ToolStripMenuItem();
|
||||||
menuStrip1.SuspendLayout();
|
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
|
||||||
SuspendLayout();
|
menuStrip1.SuspendLayout();
|
||||||
//
|
SuspendLayout();
|
||||||
// dataGridView
|
//
|
||||||
//
|
// dataGridView
|
||||||
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
//
|
||||||
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
dataGridView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||||
dataGridView.Location = new Point(0, 28);
|
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||||
dataGridView.Name = "dataGridView";
|
dataGridView.Location = new Point(0, 28);
|
||||||
dataGridView.RowHeadersWidth = 51;
|
dataGridView.Name = "dataGridView";
|
||||||
dataGridView.RowTemplate.Height = 29;
|
dataGridView.RowHeadersWidth = 51;
|
||||||
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
dataGridView.RowTemplate.Height = 29;
|
||||||
dataGridView.Size = new Size(986, 514);
|
dataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
|
||||||
dataGridView.TabIndex = 0;
|
dataGridView.Size = new Size(986, 514);
|
||||||
//
|
dataGridView.TabIndex = 0;
|
||||||
// menuStrip1
|
//
|
||||||
//
|
// menuStrip1
|
||||||
menuStrip1.ImageScalingSize = new Size(20, 20);
|
//
|
||||||
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчётыToolStripMenuItem1, startWorksToolStripMenuItem, MailToolStripMenuItem });
|
menuStrip1.ImageScalingSize = new Size(20, 20);
|
||||||
menuStrip1.Location = new Point(0, 0);
|
menuStrip1.Items.AddRange(new ToolStripItem[] { toolStripMenuItem, отчётыToolStripMenuItem1, startWorksToolStripMenuItem, MailToolStripMenuItem, backupToolStripMenuItem });
|
||||||
menuStrip1.Name = "menuStrip1";
|
menuStrip1.Location = new Point(0, 0);
|
||||||
menuStrip1.Size = new Size(1184, 28);
|
menuStrip1.Name = "menuStrip1";
|
||||||
menuStrip1.TabIndex = 1;
|
menuStrip1.Size = new Size(1184, 28);
|
||||||
menuStrip1.Text = "menuStrip1";
|
menuStrip1.TabIndex = 1;
|
||||||
//
|
menuStrip1.Text = "menuStrip1";
|
||||||
// toolStripMenuItem
|
//
|
||||||
//
|
// toolStripMenuItem
|
||||||
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem, clientsToolStripMenuItem, implementersToolStripMenuItem });
|
//
|
||||||
toolStripMenuItem.Name = "toolStripMenuItem";
|
toolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { sushiToolStripMenuItem, componentsToolStripMenuItem, clientsToolStripMenuItem, implementersToolStripMenuItem });
|
||||||
toolStripMenuItem.Size = new Size(117, 24);
|
toolStripMenuItem.Name = "toolStripMenuItem";
|
||||||
toolStripMenuItem.Text = "Справочники";
|
toolStripMenuItem.Size = new Size(117, 24);
|
||||||
//
|
toolStripMenuItem.Text = "Справочники";
|
||||||
// sushiToolStripMenuItem
|
//
|
||||||
//
|
// sushiToolStripMenuItem
|
||||||
sushiToolStripMenuItem.Name = "sushiToolStripMenuItem";
|
//
|
||||||
sushiToolStripMenuItem.Size = new Size(185, 26);
|
sushiToolStripMenuItem.Name = "sushiToolStripMenuItem";
|
||||||
sushiToolStripMenuItem.Text = "Суши";
|
sushiToolStripMenuItem.Size = new Size(185, 26);
|
||||||
sushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click;
|
sushiToolStripMenuItem.Text = "Суши";
|
||||||
//
|
sushiToolStripMenuItem.Click += SushiToolStripMenuItem_Click;
|
||||||
// componentsToolStripMenuItem
|
//
|
||||||
//
|
// componentsToolStripMenuItem
|
||||||
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
//
|
||||||
componentsToolStripMenuItem.Size = new Size(185, 26);
|
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
|
||||||
componentsToolStripMenuItem.Text = "Компоненты";
|
componentsToolStripMenuItem.Size = new Size(185, 26);
|
||||||
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
componentsToolStripMenuItem.Text = "Компоненты";
|
||||||
//
|
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
|
||||||
// clientsToolStripMenuItem
|
//
|
||||||
//
|
// clientsToolStripMenuItem
|
||||||
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
|
//
|
||||||
clientsToolStripMenuItem.Size = new Size(185, 26);
|
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
|
||||||
clientsToolStripMenuItem.Text = "Клиенты";
|
clientsToolStripMenuItem.Size = new Size(185, 26);
|
||||||
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
|
clientsToolStripMenuItem.Text = "Клиенты";
|
||||||
//
|
clientsToolStripMenuItem.Click += clientsToolStripMenuItem_Click;
|
||||||
// implementersToolStripMenuItem
|
//
|
||||||
//
|
// implementersToolStripMenuItem
|
||||||
implementersToolStripMenuItem.Name = "implementersToolStripMenuItem";
|
//
|
||||||
implementersToolStripMenuItem.Size = new Size(185, 26);
|
implementersToolStripMenuItem.Name = "implementersToolStripMenuItem";
|
||||||
implementersToolStripMenuItem.Text = "Исполнители";
|
implementersToolStripMenuItem.Size = new Size(185, 26);
|
||||||
implementersToolStripMenuItem.Click += implementersToolStripMenuItem_Click;
|
implementersToolStripMenuItem.Text = "Исполнители";
|
||||||
//
|
implementersToolStripMenuItem.Click += implementersToolStripMenuItem_Click;
|
||||||
// отчётыToolStripMenuItem1
|
//
|
||||||
//
|
// отчётыToolStripMenuItem1
|
||||||
отчётыToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { sushisReportToolStripMenuItem, componentsReportПоСушиToolStripMenuItem, orderReportToolStripMenuItem });
|
//
|
||||||
отчётыToolStripMenuItem1.Name = "отчётыToolStripMenuItem1";
|
отчётыToolStripMenuItem1.DropDownItems.AddRange(new ToolStripItem[] { sushisReportToolStripMenuItem, componentsReportПоСушиToolStripMenuItem, orderReportToolStripMenuItem });
|
||||||
отчётыToolStripMenuItem1.Size = new Size(73, 24);
|
отчётыToolStripMenuItem1.Name = "отчётыToolStripMenuItem1";
|
||||||
отчётыToolStripMenuItem1.Text = "Отчёты";
|
отчётыToolStripMenuItem1.Size = new Size(73, 24);
|
||||||
//
|
отчётыToolStripMenuItem1.Text = "Отчёты";
|
||||||
// sushisReportToolStripMenuItem
|
//
|
||||||
//
|
// sushisReportToolStripMenuItem
|
||||||
sushisReportToolStripMenuItem.Name = "sushisReportToolStripMenuItem";
|
//
|
||||||
sushisReportToolStripMenuItem.Size = new Size(243, 26);
|
sushisReportToolStripMenuItem.Name = "sushisReportToolStripMenuItem";
|
||||||
sushisReportToolStripMenuItem.Text = "Список суши";
|
sushisReportToolStripMenuItem.Size = new Size(243, 26);
|
||||||
sushisReportToolStripMenuItem.Click += sushisReportToolStripMenuItem_Click;
|
sushisReportToolStripMenuItem.Text = "Список суши";
|
||||||
//
|
sushisReportToolStripMenuItem.Click += sushisReportToolStripMenuItem_Click;
|
||||||
// componentsReportПоСушиToolStripMenuItem
|
//
|
||||||
//
|
// componentsReportПоСушиToolStripMenuItem
|
||||||
componentsReportПоСушиToolStripMenuItem.Name = "componentsReportПоСушиToolStripMenuItem";
|
//
|
||||||
componentsReportПоСушиToolStripMenuItem.Size = new Size(243, 26);
|
componentsReportПоСушиToolStripMenuItem.Name = "componentsReportПоСушиToolStripMenuItem";
|
||||||
componentsReportПоСушиToolStripMenuItem.Text = "Компоненты по суши";
|
componentsReportПоСушиToolStripMenuItem.Size = new Size(243, 26);
|
||||||
componentsReportПоСушиToolStripMenuItem.Click += componentsReportПоСушиToolStripMenuItem_Click;
|
componentsReportПоСушиToolStripMenuItem.Text = "Компоненты по суши";
|
||||||
//
|
componentsReportПоСушиToolStripMenuItem.Click += componentsReportПоСушиToolStripMenuItem_Click;
|
||||||
// orderReportToolStripMenuItem
|
//
|
||||||
//
|
// orderReportToolStripMenuItem
|
||||||
orderReportToolStripMenuItem.Name = "orderReportToolStripMenuItem";
|
//
|
||||||
orderReportToolStripMenuItem.Size = new Size(243, 26);
|
orderReportToolStripMenuItem.Name = "orderReportToolStripMenuItem";
|
||||||
orderReportToolStripMenuItem.Text = "Список заказов";
|
orderReportToolStripMenuItem.Size = new Size(243, 26);
|
||||||
orderReportToolStripMenuItem.Click += orderReportToolStripMenuItem_Click;
|
orderReportToolStripMenuItem.Text = "Список заказов";
|
||||||
//
|
orderReportToolStripMenuItem.Click += orderReportToolStripMenuItem_Click;
|
||||||
// startWorksToolStripMenuItem
|
//
|
||||||
//
|
// startWorksToolStripMenuItem
|
||||||
startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem";
|
//
|
||||||
startWorksToolStripMenuItem.Size = new Size(114, 24);
|
startWorksToolStripMenuItem.Name = "startWorksToolStripMenuItem";
|
||||||
startWorksToolStripMenuItem.Text = "Запуск работ";
|
startWorksToolStripMenuItem.Size = new Size(114, 24);
|
||||||
startWorksToolStripMenuItem.Click += startWorksToolStripMenuItem_Click;
|
startWorksToolStripMenuItem.Text = "Запуск работ";
|
||||||
//
|
startWorksToolStripMenuItem.Click += startWorksToolStripMenuItem_Click;
|
||||||
// отчётыToolStripMenuItem
|
//
|
||||||
//
|
// MailToolStripMenuItem
|
||||||
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
//
|
||||||
отчётыToolStripMenuItem.Size = new Size(32, 19);
|
MailToolStripMenuItem.Name = "MailToolStripMenuItem";
|
||||||
//
|
MailToolStripMenuItem.Size = new Size(65, 24);
|
||||||
// sushisToolStripMenuItem
|
MailToolStripMenuItem.Text = "Почта";
|
||||||
//
|
MailToolStripMenuItem.Click += MailToolStripMenuItem_Click;
|
||||||
sushisToolStripMenuItem.Name = "sushisToolStripMenuItem";
|
//
|
||||||
sushisToolStripMenuItem.Size = new Size(32, 19);
|
// отчётыToolStripMenuItem
|
||||||
//
|
//
|
||||||
// componentSushisToolStripMenuItem
|
отчётыToolStripMenuItem.Name = "отчётыToolStripMenuItem";
|
||||||
//
|
отчётыToolStripMenuItem.Size = new Size(32, 19);
|
||||||
componentSushisToolStripMenuItem.Name = "componentSushisToolStripMenuItem";
|
//
|
||||||
componentSushisToolStripMenuItem.Size = new Size(32, 19);
|
// sushisToolStripMenuItem
|
||||||
//
|
//
|
||||||
// ordersToolStripMenuItem
|
sushisToolStripMenuItem.Name = "sushisToolStripMenuItem";
|
||||||
//
|
sushisToolStripMenuItem.Size = new Size(32, 19);
|
||||||
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
//
|
||||||
ordersToolStripMenuItem.Size = new Size(32, 19);
|
// componentSushisToolStripMenuItem
|
||||||
//
|
//
|
||||||
// buttonCreateOrder
|
componentSushisToolStripMenuItem.Name = "componentSushisToolStripMenuItem";
|
||||||
//
|
componentSushisToolStripMenuItem.Size = new Size(32, 19);
|
||||||
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
//
|
||||||
buttonCreateOrder.Location = new Point(992, 28);
|
// ordersToolStripMenuItem
|
||||||
buttonCreateOrder.Name = "buttonCreateOrder";
|
//
|
||||||
buttonCreateOrder.Size = new Size(180, 30);
|
ordersToolStripMenuItem.Name = "ordersToolStripMenuItem";
|
||||||
buttonCreateOrder.TabIndex = 8;
|
ordersToolStripMenuItem.Size = new Size(32, 19);
|
||||||
buttonCreateOrder.Text = "Создать заказ";
|
//
|
||||||
buttonCreateOrder.UseVisualStyleBackColor = true;
|
// buttonCreateOrder
|
||||||
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
//
|
||||||
//
|
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
// buttonTakeOrderInWork
|
buttonCreateOrder.Location = new Point(992, 28);
|
||||||
//
|
buttonCreateOrder.Name = "buttonCreateOrder";
|
||||||
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonCreateOrder.Size = new Size(180, 30);
|
||||||
buttonTakeOrderInWork.Location = new Point(992, 64);
|
buttonCreateOrder.TabIndex = 8;
|
||||||
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
buttonCreateOrder.Text = "Создать заказ";
|
||||||
buttonTakeOrderInWork.Size = new Size(180, 30);
|
buttonCreateOrder.UseVisualStyleBackColor = true;
|
||||||
buttonTakeOrderInWork.TabIndex = 9;
|
buttonCreateOrder.Click += ButtonCreateOrder_Click;
|
||||||
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
//
|
||||||
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
// buttonTakeOrderInWork
|
||||||
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
//
|
||||||
//
|
buttonTakeOrderInWork.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
// buttonOrderReady
|
buttonTakeOrderInWork.Location = new Point(992, 64);
|
||||||
//
|
buttonTakeOrderInWork.Name = "buttonTakeOrderInWork";
|
||||||
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonTakeOrderInWork.Size = new Size(180, 30);
|
||||||
buttonOrderReady.Location = new Point(992, 100);
|
buttonTakeOrderInWork.TabIndex = 9;
|
||||||
buttonOrderReady.Name = "buttonOrderReady";
|
buttonTakeOrderInWork.Text = "Отдать на выполнение";
|
||||||
buttonOrderReady.Size = new Size(180, 30);
|
buttonTakeOrderInWork.UseVisualStyleBackColor = true;
|
||||||
buttonOrderReady.TabIndex = 10;
|
buttonTakeOrderInWork.Click += ButtonTakeOrderInWork_Click;
|
||||||
buttonOrderReady.Text = "Заказ готов";
|
//
|
||||||
buttonOrderReady.UseVisualStyleBackColor = true;
|
// buttonOrderReady
|
||||||
buttonOrderReady.Click += ButtonOrderReady_Click;
|
//
|
||||||
//
|
buttonOrderReady.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
// buttonIssuedOrder
|
buttonOrderReady.Location = new Point(992, 100);
|
||||||
//
|
buttonOrderReady.Name = "buttonOrderReady";
|
||||||
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonOrderReady.Size = new Size(180, 30);
|
||||||
buttonIssuedOrder.Location = new Point(992, 136);
|
buttonOrderReady.TabIndex = 10;
|
||||||
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
buttonOrderReady.Text = "Заказ готов";
|
||||||
buttonIssuedOrder.Size = new Size(180, 30);
|
buttonOrderReady.UseVisualStyleBackColor = true;
|
||||||
buttonIssuedOrder.TabIndex = 11;
|
buttonOrderReady.Click += ButtonOrderReady_Click;
|
||||||
buttonIssuedOrder.Text = "Заказ Выдан";
|
//
|
||||||
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
// buttonIssuedOrder
|
||||||
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
//
|
||||||
//
|
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
// buttonRef
|
buttonIssuedOrder.Location = new Point(992, 136);
|
||||||
//
|
buttonIssuedOrder.Name = "buttonIssuedOrder";
|
||||||
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
buttonIssuedOrder.Size = new Size(180, 30);
|
||||||
buttonRef.Location = new Point(992, 172);
|
buttonIssuedOrder.TabIndex = 11;
|
||||||
buttonRef.Name = "buttonRef";
|
buttonIssuedOrder.Text = "Заказ Выдан";
|
||||||
buttonRef.Size = new Size(180, 30);
|
buttonIssuedOrder.UseVisualStyleBackColor = true;
|
||||||
buttonRef.TabIndex = 12;
|
buttonIssuedOrder.Click += ButtonIssuedOrder_Click;
|
||||||
buttonRef.Text = "Обновить список";
|
//
|
||||||
buttonRef.UseVisualStyleBackColor = true;
|
// buttonRef
|
||||||
buttonRef.Click += ButtonRef_Click;
|
//
|
||||||
//
|
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
// MailToolStripMenuItem
|
buttonRef.Location = new Point(992, 172);
|
||||||
//
|
buttonRef.Name = "buttonRef";
|
||||||
MailToolStripMenuItem.Name = "MailToolStripMenuItem";
|
buttonRef.Size = new Size(180, 30);
|
||||||
MailToolStripMenuItem.Size = new Size(65, 24);
|
buttonRef.TabIndex = 12;
|
||||||
MailToolStripMenuItem.Text = "Почта";
|
buttonRef.Text = "Обновить список";
|
||||||
MailToolStripMenuItem.Click += MailToolStripMenuItem_Click;
|
buttonRef.UseVisualStyleBackColor = true;
|
||||||
//
|
buttonRef.Click += ButtonRef_Click;
|
||||||
// FormMain
|
//
|
||||||
//
|
// backupToolStripMenuItem
|
||||||
AllowDrop = true;
|
//
|
||||||
AutoScaleDimensions = new SizeF(8F, 20F);
|
backupToolStripMenuItem.Name = "backupToolStripMenuItem";
|
||||||
AutoScaleMode = AutoScaleMode.Font;
|
backupToolStripMenuItem.Size = new Size(123, 24);
|
||||||
ClientSize = new Size(1184, 554);
|
backupToolStripMenuItem.Text = "Создать бекап";
|
||||||
Controls.Add(buttonRef);
|
backupToolStripMenuItem.Click += backupToolStripMenuItem_Click;
|
||||||
Controls.Add(buttonIssuedOrder);
|
//
|
||||||
Controls.Add(buttonOrderReady);
|
// FormMain
|
||||||
Controls.Add(buttonTakeOrderInWork);
|
//
|
||||||
Controls.Add(buttonCreateOrder);
|
AllowDrop = true;
|
||||||
Controls.Add(dataGridView);
|
AutoScaleDimensions = new SizeF(8F, 20F);
|
||||||
Controls.Add(menuStrip1);
|
AutoScaleMode = AutoScaleMode.Font;
|
||||||
MainMenuStrip = menuStrip1;
|
ClientSize = new Size(1184, 554);
|
||||||
Name = "FormMain";
|
Controls.Add(buttonRef);
|
||||||
Text = "Сушибар";
|
Controls.Add(buttonIssuedOrder);
|
||||||
WindowState = FormWindowState.Maximized;
|
Controls.Add(buttonOrderReady);
|
||||||
Load += FormMain_Load;
|
Controls.Add(buttonTakeOrderInWork);
|
||||||
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
Controls.Add(buttonCreateOrder);
|
||||||
menuStrip1.ResumeLayout(false);
|
Controls.Add(dataGridView);
|
||||||
menuStrip1.PerformLayout();
|
Controls.Add(menuStrip1);
|
||||||
ResumeLayout(false);
|
MainMenuStrip = menuStrip1;
|
||||||
PerformLayout();
|
Name = "FormMain";
|
||||||
}
|
Text = "Сушибар";
|
||||||
|
WindowState = FormWindowState.Maximized;
|
||||||
|
Load += FormMain_Load;
|
||||||
|
((System.ComponentModel.ISupportInitialize)dataGridView).EndInit();
|
||||||
|
menuStrip1.ResumeLayout(false);
|
||||||
|
menuStrip1.PerformLayout();
|
||||||
|
ResumeLayout(false);
|
||||||
|
PerformLayout();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private DataGridView dataGridView;
|
private DataGridView dataGridView;
|
||||||
private MenuStrip menuStrip1;
|
private MenuStrip menuStrip1;
|
||||||
private Button buttonCreateOrder;
|
private Button buttonCreateOrder;
|
||||||
private Button buttonTakeOrderInWork;
|
private Button buttonTakeOrderInWork;
|
||||||
@ -277,5 +285,6 @@
|
|||||||
private ToolStripMenuItem implementersToolStripMenuItem;
|
private ToolStripMenuItem implementersToolStripMenuItem;
|
||||||
private ToolStripMenuItem startWorksToolStripMenuItem;
|
private ToolStripMenuItem startWorksToolStripMenuItem;
|
||||||
private ToolStripMenuItem MailToolStripMenuItem;
|
private ToolStripMenuItem MailToolStripMenuItem;
|
||||||
}
|
private ToolStripMenuItem backupToolStripMenuItem;
|
||||||
|
}
|
||||||
}
|
}
|
@ -1,208 +1,235 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBar.Extensions;
|
||||||
|
using SushiBarBusinessLogic.BusinessLogic;
|
||||||
using SushiBarBusinessLogic.BusinessLogics;
|
using SushiBarBusinessLogic.BusinessLogics;
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
namespace SushiBar.Forms
|
namespace SushiBar.Forms
|
||||||
{
|
{
|
||||||
public partial class FormMain : Form
|
public partial class FormMain : Form
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IOrderLogic _orderLogic;
|
private readonly IOrderLogic _orderLogic;
|
||||||
private readonly IReportLogic _reportLogic;
|
private readonly IReportLogic _reportLogic;
|
||||||
private readonly IWorkProcess _workProcess;
|
private readonly IWorkProcess _workProcess;
|
||||||
public FormMain(ILogger<FormMain> logger, IOrderLogic orderLogic, IReportLogic reportLogic, IWorkProcess workProcess)
|
private readonly IBackUpLogic _backUpLogic;
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
_logger = logger;
|
|
||||||
_orderLogic = orderLogic;
|
|
||||||
_reportLogic = reportLogic;
|
|
||||||
_workProcess = workProcess;
|
|
||||||
}
|
|
||||||
private void FormMain_Load(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
private void LoadData()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var list = _orderLogic.ReadList(null);
|
|
||||||
if (list != null)
|
|
||||||
{
|
|
||||||
dataGridView.DataSource = list;
|
|
||||||
dataGridView.Columns["SushiId"].Visible = false;
|
|
||||||
dataGridView.Columns["ClientId"].Visible = false;
|
|
||||||
dataGridView.Columns["ImplementerId"].Visible = false;
|
|
||||||
dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Загрузка заказов");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки суши");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
|
||||||
if (service is FormComponents form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void SushiToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushis));
|
|
||||||
if (service is FormSushis form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
|
||||||
if (service is FormCreateOrder form)
|
|
||||||
{
|
|
||||||
form.ShowDialog();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
|
||||||
{
|
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
|
||||||
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
|
||||||
if (!operationResult)
|
|
||||||
{
|
|
||||||
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
|
||||||
}
|
|
||||||
_logger.LogInformation("Заказ №{id} выдан", id);
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonRef_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void sushisReportToolStripMenuItem_Click(object sender, EventArgs e)
|
|
||||||
{
|
|
||||||
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
|
||||||
if (dialog.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
_reportLogic.SaveSushisToWordFile(new ReportBindingModel
|
|
||||||
{
|
|
||||||
FileName = dialog.FileName
|
|
||||||
});
|
|
||||||
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e)
|
public FormMain(ILogger<FormMain> logger,
|
||||||
{
|
IOrderLogic orderLogic,
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents));
|
IReportLogic reportLogic,
|
||||||
if (service is FormReportSushiComponents form)
|
IWorkProcess workProcess,
|
||||||
{
|
IBackUpLogic backUpLogic
|
||||||
form.ShowDialog();
|
)
|
||||||
}
|
{
|
||||||
}
|
InitializeComponent();
|
||||||
|
_logger = logger;
|
||||||
|
_orderLogic = orderLogic;
|
||||||
|
_reportLogic = reportLogic;
|
||||||
|
_workProcess = workProcess;
|
||||||
|
_backUpLogic = backUpLogic;
|
||||||
|
}
|
||||||
|
private void FormMain_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
private void LoadData()
|
||||||
|
{
|
||||||
|
_logger.LogInformation("Загрузка заказов");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
dataGridView.FillandConfigGrid(_orderLogic.ReadList(null));
|
||||||
|
_logger.LogInformation("Загрузка заказов");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка загрузки заказов");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
||||||
|
if (service is FormComponents form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void SushiToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormSushis));
|
||||||
|
if (service is FormSushis form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonCreateOrder_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
||||||
|
if (service is FormCreateOrder form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'В работе'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.TakeOrderInWork(new OrderBindingModel { Id = id });
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка передачи заказа в работу");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonOrderReady_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Готов'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.FinishOrder(new OrderBindingModel { Id = id });
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о готовности заказа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonIssuedOrder_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
|
{
|
||||||
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
_logger.LogInformation("Заказ №{id}. Меняется статус на 'Выдан'", id);
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var operationResult = _orderLogic.DeliveryOrder(new OrderBindingModel { Id = id });
|
||||||
|
if (!operationResult)
|
||||||
|
{
|
||||||
|
throw new Exception("Ошибка при сохранении. Дополнительная информация в логах.");
|
||||||
|
}
|
||||||
|
_logger.LogInformation("Заказ №{id} выдан", id);
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.LogError(ex, "Ошибка отметки о выдачи заказа");
|
||||||
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void ButtonRef_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
LoadData();
|
||||||
|
}
|
||||||
|
|
||||||
private void orderReportToolStripMenuItem_Click(object sender, EventArgs e)
|
private void sushisReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
using var dialog = new SaveFileDialog { Filter = "docx|*.docx" };
|
||||||
if (service is FormReportOrders form)
|
if (dialog.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
_reportLogic.SaveSushisToWordFile(new ReportBindingModel
|
||||||
}
|
{
|
||||||
}
|
FileName = dialog.FileName
|
||||||
|
});
|
||||||
|
MessageBox.Show("Выполнено", "Успех", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents));
|
||||||
if (service is FormClients form)
|
if (service is FormReportSushiComponents form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void implementersToolStripMenuItem_Click(object sender, EventArgs e)
|
private void orderReportToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
||||||
if (service is FormImplementers form)
|
if (service is FormReportOrders form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startWorksToolStripMenuItem_Click(object sender, EventArgs e)
|
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
||||||
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
if (service is FormClients form)
|
||||||
}
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void MailToolStripMenuItem_Click(object sender, EventArgs e)
|
private void implementersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormMailView));
|
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
||||||
if (service is FormMailView form)
|
if (service is FormImplementers form)
|
||||||
{
|
{
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void startWorksToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
||||||
|
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MailToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var service = Program.ServiceProvider?.GetService(typeof(FormMailView));
|
||||||
|
if (service is FormMailView form)
|
||||||
|
{
|
||||||
|
form.ShowDialog();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void backupToolStripMenuItem_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,4 +1,5 @@
|
|||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBar.Extensions;
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
|
||||||
@ -20,24 +21,17 @@ namespace SushiBar.Forms
|
|||||||
}
|
}
|
||||||
private void LoadData()
|
private void LoadData()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var list = _logic.ReadList(null);
|
dataGridView.FillandConfigGrid(_logic.ReadList(null));
|
||||||
if (list != null)
|
_logger.LogInformation("Загрузка суши");
|
||||||
{
|
}
|
||||||
dataGridView.DataSource = list;
|
catch (Exception ex)
|
||||||
dataGridView.Columns["Id"].Visible = false;
|
{
|
||||||
dataGridView.Columns["SushiComponents"].Visible = false;
|
_logger.LogError(ex, "Ошибка загрузки суши");
|
||||||
dataGridView.Columns["SushiName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
|
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
}
|
}
|
||||||
_logger.LogInformation("Загрузка суши");
|
}
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
_logger.LogError(ex, "Ошибка загрузки суши");
|
|
||||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushi));
|
var service = Program.ServiceProvider?.GetService(typeof(FormSushi));
|
||||||
|
BIN
SushiBar/SushiBar/ImplementationExtensions.dll
Normal file
BIN
SushiBar/SushiBar/ImplementationExtensions.dll
Normal file
Binary file not shown.
BIN
SushiBar/SushiBar/ImplementationExtensionst.dll
Normal file
BIN
SushiBar/SushiBar/ImplementationExtensionst.dll
Normal file
Binary file not shown.
@ -1,20 +1,19 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog.Extensions.Logging;
|
using NLog.Extensions.Logging;
|
||||||
using SushiBar.Forms;
|
using SushiBar.Forms;
|
||||||
|
using SushiBarBusinessLogic.BusinessLogic;
|
||||||
using SushiBarBusinessLogic.BusinessLogics;
|
using SushiBarBusinessLogic.BusinessLogics;
|
||||||
using SushiBarBusinessLogic.MailWorker;
|
using SushiBarBusinessLogic.MailWorker;
|
||||||
using SushiBarBusinessLogic.OfficePackage;
|
using SushiBarBusinessLogic.OfficePackage;
|
||||||
using SushiBarBusinessLogic.OfficePackage.Implements;
|
using SushiBarBusinessLogic.OfficePackage.Implements;
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
using SushiBarContracts.StoragesContracts;
|
using SushiBarContracts.DI;
|
||||||
using SushiBarDatabaseImplement.Implements;
|
|
||||||
|
|
||||||
namespace SushiBar
|
namespace SushiBar
|
||||||
{
|
{
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
private static ServiceProvider? _serviceProvider;
|
private static ServiceProvider? _serviceProvider;
|
||||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||||
@ -28,12 +27,11 @@ namespace SushiBar
|
|||||||
// see https://aka.ms/applicationconfiguration.
|
// see https://aka.ms/applicationconfiguration.
|
||||||
ApplicationConfiguration.Initialize();
|
ApplicationConfiguration.Initialize();
|
||||||
var services = new ServiceCollection();
|
var services = new ServiceCollection();
|
||||||
ConfigureServices(services);
|
InitDependency();
|
||||||
_serviceProvider = services.BuildServiceProvider();
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var mailSender = _serviceProvider.GetService<AbstractMailWorker>();
|
var mailSender = DependencyManager.Instance.Resolve<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,
|
||||||
@ -48,54 +46,53 @@ namespace SushiBar
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
var logger = _serviceProvider.GetService<ILogger>();
|
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
||||||
logger?.LogError(ex, "Îøèáêà ðàáîòû ñ ïî÷òîé");
|
logger?.LogError(ex, "Ошибка при ходе в почту");
|
||||||
}
|
}
|
||||||
|
|
||||||
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
||||||
}
|
}
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
|
||||||
{
|
|
||||||
services.AddLogging(option =>
|
|
||||||
{
|
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
|
||||||
option.AddNLog("nlog.config");
|
|
||||||
});
|
|
||||||
services.AddTransient<IComponentStorage, ComponentStorage>();
|
|
||||||
services.AddTransient<IOrderStorage, OrderStorage>();
|
|
||||||
services.AddTransient<ISushiStorage, SushiStorage>();
|
|
||||||
services.AddTransient<IClientStorage, ClientStorage>();
|
|
||||||
services.AddTransient<IImplementerStorage, ImplementerStorage>();
|
|
||||||
services.AddTransient<IMessageInfoStorage, MessageInfoStorage>();
|
|
||||||
|
|
||||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
private static void InitDependency()
|
||||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
{
|
||||||
services.AddTransient<ISushiLogic, SushiLogic>();
|
DependencyManager.InitDependency();
|
||||||
services.AddTransient<IReportLogic, ReportLogic>();
|
|
||||||
services.AddTransient<IClientLogic, ClientLogic>();
|
|
||||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
|
||||||
services.AddSingleton<IWorkProcess, WorkModeling>();
|
|
||||||
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
|
||||||
|
|
||||||
services.AddTransient<FormMain>();
|
DependencyManager.Instance.AddLogging(option =>
|
||||||
services.AddTransient<FormComponent>();
|
{
|
||||||
services.AddTransient<FormComponents>();
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
services.AddTransient<FormCreateOrder>();
|
option.AddNLog("nlog.config");
|
||||||
services.AddTransient<FormClients>();
|
});
|
||||||
services.AddTransient<FormSushi>();
|
|
||||||
services.AddTransient<FormSushiComponent>();
|
|
||||||
services.AddTransient<FormSushis>();
|
|
||||||
services.AddTransient<FormReportSushiComponents>();
|
|
||||||
services.AddTransient<FormReportOrders>();
|
|
||||||
services.AddTransient<FormImplementers>();
|
|
||||||
services.AddTransient<FormImplementer>();
|
|
||||||
services.AddTransient<FormMailView>();
|
|
||||||
|
|
||||||
services.AddTransient<AbstractSaveToExcel, SaveToExcel>();
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
||||||
services.AddTransient<AbstractSaveToWord, SaveToWord>();
|
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
||||||
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
||||||
services.AddSingleton<AbstractMailWorker, MailKitWorker>();
|
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
||||||
}
|
DependencyManager.Instance.RegisterType<ISushiLogic, SushiLogic>();
|
||||||
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
||||||
|
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
||||||
|
|
||||||
|
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>();
|
||||||
|
|
||||||
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
||||||
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
||||||
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
||||||
|
|
||||||
|
DependencyManager.Instance.RegisterType<FormMain>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormComponent>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormComponents>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormClients>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormSushi>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormSushiComponent>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormSushis>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormReportSushiComponents>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormImplementers>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormImplementer>();
|
||||||
|
DependencyManager.Instance.RegisterType<FormMailView>();
|
||||||
|
}
|
||||||
|
|
||||||
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
private static void MailCheck(object obj) => ServiceProvider?.GetService<AbstractMailWorker>()?.MailCheck();
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
|
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
|
||||||
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\SushiBarFileImplement\SushiBarFileImplement.csproj" />
|
|
||||||
<ProjectReference Include="..\SushiBarListImplement\SushiBarListImplement.csproj" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
90
SushiBar/SushiBarBusinessLogic/BusinessLogics/BackUpLogic.cs
Normal file
90
SushiBar/SushiBarBusinessLogic/BusinessLogics/BackUpLogic.cs
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
using SushiBarContracts.BindingModels;
|
||||||
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
using SushiBarDataModels;
|
||||||
|
using System.IO.Compression;
|
||||||
|
using System.Reflection;
|
||||||
|
using System.Runtime.Serialization.Json;
|
||||||
|
|
||||||
|
namespace SushiBarBusinessLogic.BusinessLogic
|
||||||
|
{
|
||||||
|
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,8 +1,8 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BusinessLogicsContracts;
|
using SushiBarContracts.BusinessLogicsContracts;
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
|
|
||||||
namespace SushiBarBusinessLogic.BusinessLogics
|
namespace SushiBarBusinessLogic.BusinessLogics
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
<ProjectReference Include="..\SushiBarContracts\SushiBarContracts.csproj" />
|
||||||
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
22
SushiBar/SushiBarContracts/Attributes/ColumnAttribute.cs
Normal file
22
SushiBar/SushiBarContracts/Attributes/ColumnAttribute.cs
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
namespace SushiBarContracts.Attributes
|
||||||
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Property)]
|
||||||
|
public class ColumnAttribute : Attribute
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
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; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
14
SushiBar/SushiBarContracts/Attributes/GridViewAutoSize.cs
Normal file
14
SushiBar/SushiBarContracts/Attributes/GridViewAutoSize.cs
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
namespace SushiBarContracts.Attributes
|
||||||
|
{
|
||||||
|
public enum GridViewAutoSize
|
||||||
|
{
|
||||||
|
NotSet = 0,
|
||||||
|
None = 1,
|
||||||
|
ColumnHeader = 2,
|
||||||
|
AllCellsExceptHeader = 4,
|
||||||
|
AllCells = 6,
|
||||||
|
DisplayedCellsExceptHeader = 8,
|
||||||
|
DisplayedCells = 10,
|
||||||
|
Fill = 16
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace SushiBarContracts.BindingModels
|
||||||
|
{
|
||||||
|
public class BackUpSaveBinidngModel
|
||||||
|
{
|
||||||
|
public string FolderName { get; set; } = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -15,5 +15,7 @@ namespace SushiBarContracts.BindingModels
|
|||||||
public string Body { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
|
||||||
public DateTime DateDelivery { get; set; }
|
public DateTime DateDelivery { get; set; }
|
||||||
}
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
using SushiBarContracts.BindingModels;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.BusinessLogicsContracts
|
||||||
|
{
|
||||||
|
public interface IBackUpLogic
|
||||||
|
{
|
||||||
|
void CreateBackUp(BackUpSaveBinidngModel model);
|
||||||
|
}
|
||||||
|
}
|
45
SushiBar/SushiBarContracts/DI/DependencyManager.cs
Normal file
45
SushiBar/SushiBarContracts/DI/DependencyManager.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.DI
|
||||||
|
{
|
||||||
|
public class DependencyManager
|
||||||
|
{
|
||||||
|
private readonly IDependencyContainer _dependencyManager;
|
||||||
|
private static DependencyManager? _manager;
|
||||||
|
private static readonly object _locjObject = new();
|
||||||
|
private DependencyManager()
|
||||||
|
{
|
||||||
|
_dependencyManager = new ServiceDependencyContainer();
|
||||||
|
}
|
||||||
|
public static DependencyManager Instance
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_manager == null) {
|
||||||
|
lock (_locjObject)
|
||||||
|
{
|
||||||
|
_manager = new DependencyManager();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return _manager;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static void InitDependency()
|
||||||
|
{
|
||||||
|
var ext = ServiceProviderLoader.GetImplementationExtensions();
|
||||||
|
if (ext == null)
|
||||||
|
{
|
||||||
|
throw new ArgumentNullException("Отсутствуют компонент для загрузки зависимостей по модулям");
|
||||||
|
}
|
||||||
|
ext.RegisterServices();
|
||||||
|
}
|
||||||
|
public void AddLogging(Action<ILoggingBuilder> configure) =>
|
||||||
|
_dependencyManager.AddLogging(configure);
|
||||||
|
public void RegisterType<T, U>(bool isSingle = false) where U :
|
||||||
|
class, T where T : class =>
|
||||||
|
_dependencyManager.RegisterType<T, U>(isSingle);
|
||||||
|
public void RegisterType<T>(bool isSingle = false) where T : class =>
|
||||||
|
_dependencyManager.RegisterType<T>(isSingle);
|
||||||
|
public T Resolve<T>() => _dependencyManager.Resolve<T>();
|
||||||
|
}
|
||||||
|
}
|
12
SushiBar/SushiBarContracts/DI/IDependencyContainer.cs
Normal file
12
SushiBar/SushiBarContracts/DI/IDependencyContainer.cs
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.DI
|
||||||
|
{
|
||||||
|
public interface IDependencyContainer
|
||||||
|
{
|
||||||
|
void AddLogging(Action<ILoggingBuilder> configure);
|
||||||
|
void RegisterType<T, U>(bool isSingle) where U : class, T where T : class;
|
||||||
|
void RegisterType<T>(bool isSingle) where T : class;
|
||||||
|
T Resolve<T>();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
namespace SushiBarContracts.DI
|
||||||
|
{
|
||||||
|
public interface IImplementationExtension
|
||||||
|
{
|
||||||
|
public int Priority { get; }
|
||||||
|
public void RegisterServices();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
57
SushiBar/SushiBarContracts/DI/ServiceDependencyContainer.cs
Normal file
57
SushiBar/SushiBarContracts/DI/ServiceDependencyContainer.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.DI
|
||||||
|
{
|
||||||
|
public class ServiceDependencyContainer : IDependencyContainer
|
||||||
|
{
|
||||||
|
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>(bool isSingle) where T : class
|
||||||
|
{
|
||||||
|
if (isSingle)
|
||||||
|
{
|
||||||
|
_serviceCollection.AddSingleton<T>();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_serviceCollection.AddTransient<T>();
|
||||||
|
}
|
||||||
|
_serviceProvider = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 T Resolve<T>()
|
||||||
|
{
|
||||||
|
if (_serviceProvider == null)
|
||||||
|
{
|
||||||
|
_serviceProvider = _serviceCollection.BuildServiceProvider();
|
||||||
|
}
|
||||||
|
return _serviceProvider.GetService<T>()!;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
53
SushiBar/SushiBarContracts/DI/ServiceProviderLoader.cs
Normal file
53
SushiBar/SushiBarContracts/DI/ServiceProviderLoader.cs
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace SushiBarContracts.DI
|
||||||
|
{
|
||||||
|
public static partial class ServiceProviderLoader
|
||||||
|
{
|
||||||
|
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";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,8 @@
|
|||||||
|
namespace SushiBarContracts.StoragesContracts
|
||||||
|
{
|
||||||
|
public interface IBackUpInfo
|
||||||
|
{
|
||||||
|
List<T>? GetList<T>() where T : class, new();
|
||||||
|
Type? GetTypeByModelInterface(string modelInterfaceName);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,7 @@
|
|||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
|
|
||||||
namespace IceCreamShopContracts.StoragesContracts
|
namespace SushiBarContracts.StoragesContracts
|
||||||
{
|
{
|
||||||
public interface IImplementerStorage
|
public interface IImplementerStorage
|
||||||
{
|
{
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
|
<BaseOutputPath>\bin</BaseOutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -1,16 +1,17 @@
|
|||||||
using System.ComponentModel;
|
using SushiBarContracts.Attributes;
|
||||||
|
using SushiBarDataModels.Models;
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
namespace SushiBarContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ClientViewModel
|
public class ClientViewModel : IClientModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Column(visible: false)]
|
||||||
[DisplayName("ФИО клиента")]
|
public int Id { get; set; }
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
[DisplayName("Логин (эл. почта)")]
|
[Column(title: "Email клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string Email { get; set; } = string.Empty;
|
public string Email { get; set; } = string.Empty;
|
||||||
[DisplayName("Пароль")]
|
[Column(title: "Пароль", width: 150)]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
using SushiBarDataModels.Models;
|
using SushiBarContracts.Attributes;
|
||||||
using System.ComponentModel;
|
using SushiBarDataModels.Models;
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
namespace SushiBarContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ComponentViewModel : IComponentModel
|
public class ComponentViewModel : IComponentModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Column(visible: false)]
|
||||||
[DisplayName("Название компонента")]
|
public int Id { get; set; }
|
||||||
public string ComponentName { get; set; } = string.Empty;
|
[Column(title: "Название компонента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
[DisplayName("Цена")]
|
public string ComponentName { get; set; } = string.Empty;
|
||||||
public double Cost { get; set; }
|
[Column(title: "Цена", width: 80)]
|
||||||
|
public double Cost { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
using SushiBarDataModels.Models;
|
using SushiBarContracts.Attributes;
|
||||||
using System.ComponentModel;
|
using SushiBarDataModels.Models;
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
namespace SushiBarContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class ImplementerViewModel : IImplementerModel
|
public class ImplementerViewModel : IImplementerModel
|
||||||
{
|
{
|
||||||
|
[Column(visible: false)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
[DisplayName("ФИО исполнителя")]
|
[Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string ImplementerFIO { get; set; } = string.Empty;
|
public string ImplementerFIO { get; set; } = string.Empty;
|
||||||
[DisplayName("Стаж работы")]
|
[Column(title: "Стаж работы", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int WorkExperience { get; set; } = 0;
|
public int WorkExperience { get; set; } = 0;
|
||||||
[DisplayName("Квалификация")]
|
[Column(title: "Квалификация", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int Qualification { get; set; } = 0;
|
public int Qualification { get; set; } = 0;
|
||||||
[DisplayName("Пароль")]
|
[Column(title: "Пароль", width: 150)]
|
||||||
public string Password { get; set; } = string.Empty;
|
public string Password { get; set; } = string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,27 @@
|
|||||||
using SushiBarDataModels.Models;
|
using SushiBarContracts.Attributes;
|
||||||
using System.ComponentModel;
|
using SushiBarDataModels.Models;
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
namespace SushiBarContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class MessageInfoViewModel : IMessageInfoModel
|
public class MessageInfoViewModel : IMessageInfoModel
|
||||||
{
|
{
|
||||||
public string MessageId { get; set; } = string.Empty;
|
[Column(visible: false)]
|
||||||
|
public string MessageId { get; set; } = string.Empty;
|
||||||
|
[Column(visible: false)]
|
||||||
|
public int? ClientId { get; set; }
|
||||||
|
|
||||||
public int? ClientId { get; set; }
|
[Column(title: "Отправитель", gridViewAutoSize: GridViewAutoSize.DisplayedCells, isUseAutoSize: true)]
|
||||||
|
public string SenderName { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Отправитель")]
|
[Column(title: "Дата письма", width: 100)]
|
||||||
public string SenderName { get; set; } = string.Empty;
|
public DateTime DateDelivery { get; set; }
|
||||||
|
|
||||||
[DisplayName("Дата письма")]
|
[Column(title: "Заголовок", width: 150)]
|
||||||
public DateTime DateDelivery { get; set; }
|
public string Subject { get; set; } = string.Empty;
|
||||||
|
|
||||||
[DisplayName("Заголовок")]
|
[Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
public string Subject { get; set; } = string.Empty;
|
public string Body { get; set; } = string.Empty;
|
||||||
|
[Column(visible: false)]
|
||||||
[DisplayName("Текст")]
|
public int Id => throw new NotImplementedException();
|
||||||
public string Body { get; set; } = string.Empty;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,34 @@
|
|||||||
using SushiBarDataModels.Enums;
|
using SushiBarContracts.Attributes;
|
||||||
|
using SushiBarDataModels.Enums;
|
||||||
using SushiBarDataModels.Models;
|
using SushiBarDataModels.Models;
|
||||||
using System.ComponentModel;
|
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
namespace SushiBarContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class OrderViewModel : IOrderModel
|
public class OrderViewModel : IOrderModel
|
||||||
{
|
{
|
||||||
[DisplayName("Номер")]
|
[Column(title: "Номер", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public int SushiId { get; set; }
|
[Column(visible: false)]
|
||||||
public int ClientId { get; set; }
|
public int SushiId { get; set; }
|
||||||
public int? ImplementerId { get; set; }
|
[Column(visible: false)]
|
||||||
[DisplayName("Клиент")]
|
public int ClientId { get; set; }
|
||||||
public string ClientFIO { get; set; } = string.Empty;
|
[Column(visible: false)]
|
||||||
[DisplayName("Суши")]
|
public int? ImplementerId { get; set; }
|
||||||
public string SushiName { get; set; } = string.Empty;
|
[Column(title: "ФИО клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
[DisplayName("Исполнитель")]
|
public string ClientFIO { get; set; } = string.Empty;
|
||||||
public string ImplementerName { get; set;} = string.Empty;
|
[Column(title: "Суши", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
[DisplayName("Количество")]
|
public string SushiName { get; set; } = string.Empty;
|
||||||
public int Count { get; set; }
|
[Column(title: "ФИО исполнителя", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
[DisplayName("Сумма")]
|
public string ImplementerName { get; set;} = string.Empty;
|
||||||
public double Sum { get; set; }
|
[Column(title: "Количество", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
[DisplayName("Статус")]
|
public int Count { get; set; }
|
||||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
[Column(title: "Сумма", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
[DisplayName("Дата создания")]
|
public double Sum { get; set; }
|
||||||
public DateTime DateCreate { get; set; } = DateTime.Now;
|
[Column(title: "Статус", gridViewAutoSize: GridViewAutoSize.AllCells, isUseAutoSize: true)]
|
||||||
[DisplayName("Дата выполнения")]
|
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||||
public DateTime? DateImplement { get; set; }
|
[Column(title: "Дата создания", width: 100)]
|
||||||
|
public DateTime DateCreate { get; set; } = DateTime.Now;
|
||||||
|
[Column(title: "Дата выполнения", width: 100)]
|
||||||
|
public DateTime? DateImplement { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace SushiBarContracts.ViewModels
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
|
||||||
{
|
{
|
||||||
public class ReportOrdersViewModel
|
public class ReportOrdersViewModel
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace SushiBarContracts.ViewModels
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
|
||||||
{
|
{
|
||||||
public class ReportSushiComponentViewModel
|
public class ReportSushiComponentViewModel
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
using SushiBarDataModels.Models;
|
using SushiBarContracts.Attributes;
|
||||||
using System.ComponentModel;
|
using SushiBarDataModels.Models;
|
||||||
|
|
||||||
namespace SushiBarContracts.ViewModels
|
namespace SushiBarContracts.ViewModels
|
||||||
{
|
{
|
||||||
public class SushiViewModel : ISushiModel
|
public class SushiViewModel : ISushiModel
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
[Column(visible: false)]
|
||||||
[DisplayName("Название суши")]
|
public int Id { get; set; }
|
||||||
public string SushiName { get; set; } = string.Empty;
|
[Column(title: "Название Суши", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||||
[DisplayName("Цена")]
|
public string SushiName { get; set; } = string.Empty;
|
||||||
public double Price { get; set; }
|
[Column(title: "Цена", width: 100)]
|
||||||
public Dictionary<int, (IComponentModel, int)> SushiComponents
|
public double Price { get; set; }
|
||||||
|
[Column(visible: false)]
|
||||||
|
public Dictionary<int, (IComponentModel, int)> SushiComponents
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
set;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
namespace SushiBarDataModels.Models
|
namespace SushiBarDataModels.Models
|
||||||
{
|
{
|
||||||
public interface IMessageInfoModel
|
public interface IMessageInfoModel : IId
|
||||||
{
|
{
|
||||||
string MessageId { get; }
|
string MessageId { get; }
|
||||||
int? ClientId { get; }
|
int? ClientId { get; }
|
||||||
@ -8,6 +8,5 @@
|
|||||||
DateTime DateDelivery { get; }
|
DateTime DateDelivery { get; }
|
||||||
string Subject { get; }
|
string Subject { get; }
|
||||||
string Body { get; }
|
string Body { get; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
using SushiBarContracts.DI;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
using SushiBarDatabaseImplement.Implements;
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement
|
||||||
|
{
|
||||||
|
public class DatabaseImplementationExtension : IImplementationExtension
|
||||||
|
{
|
||||||
|
public int Priority => 2;
|
||||||
|
public void RegisterServices()
|
||||||
|
{
|
||||||
|
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<ISushiStorage, SushiStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
27
SushiBar/SushiBarDatabaseImplement/Implements/BackUpInfo.cs
Normal file
27
SushiBar/SushiBarDatabaseImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement.Implements
|
||||||
|
{
|
||||||
|
public class BackUpInfo : IBackUpInfo
|
||||||
|
{
|
||||||
|
public List<T>? GetList<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
using var context = new SushiBarDatabase();
|
||||||
|
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,6 +1,6 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
using SushiBarDatabaseImplement.Models;
|
using SushiBarDatabaseImplement.Models;
|
||||||
|
|
||||||
|
@ -46,5 +46,7 @@ namespace SushiBarDatabaseImplement.Models
|
|||||||
SenderName = SenderName,
|
SenderName = SenderName,
|
||||||
DateDelivery = DateDelivery,
|
DateDelivery = DateDelivery,
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
63
SushiBar/SushiBarDatabaseImplement/Properties/Resources.Designer.cs
generated
Normal file
63
SushiBar/SushiBarDatabaseImplement/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Этот код создан программой.
|
||||||
|
// Исполняемая версия:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
|
||||||
|
// повторной генерации кода.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace SushiBarDatabaseImplement.Properties {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
|
||||||
|
/// </summary>
|
||||||
|
// Этот класс создан автоматически классом StronglyTypedResourceBuilder
|
||||||
|
// с помощью такого средства, как ResGen или Visual Studio.
|
||||||
|
// Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
|
||||||
|
// с параметром /str или перестройте свой проект VS.
|
||||||
|
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
|
||||||
|
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||||
|
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||||
|
internal class Resources {
|
||||||
|
|
||||||
|
private static global::System.Resources.ResourceManager resourceMan;
|
||||||
|
|
||||||
|
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||||
|
|
||||||
|
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||||
|
internal Resources() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||||
|
get {
|
||||||
|
if (object.ReferenceEquals(resourceMan, null)) {
|
||||||
|
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("SushiBarDatabaseImplement.Properties.Resources", typeof(Resources).Assembly);
|
||||||
|
resourceMan = temp;
|
||||||
|
}
|
||||||
|
return resourceMan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перезаписывает свойство CurrentUICulture текущего потока для всех
|
||||||
|
/// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
internal static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
101
SushiBar/SushiBarDatabaseImplement/Properties/Resources.resx
Normal file
101
SushiBar/SushiBarDatabaseImplement/Properties/Resources.resx
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
Version 1.3
|
||||||
|
|
||||||
|
The primary goals of this format is to allow a simple XML format
|
||||||
|
that is mostly human readable. The generation and parsing of the
|
||||||
|
various data types are done through the TypeConverter classes
|
||||||
|
associated with the data types.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
... ado.net/XML headers & schema ...
|
||||||
|
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||||
|
<resheader name="version">1.3</resheader>
|
||||||
|
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||||
|
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||||
|
<data name="Name1">this is my long string</data>
|
||||||
|
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||||
|
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||||
|
[base64 mime encoded serialized .NET Framework object]
|
||||||
|
</data>
|
||||||
|
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
|
[base64 mime encoded string representing a byte array form of the .NET Framework object]
|
||||||
|
</data>
|
||||||
|
|
||||||
|
There are any number of "resheader" rows that contain simple
|
||||||
|
name/value pairs.
|
||||||
|
|
||||||
|
Each data row contains a name, and value. The row also contains a
|
||||||
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
text/value conversion through the TypeConverter architecture.
|
||||||
|
Classes that don't support this are serialized and stored with the
|
||||||
|
mimetype set.
|
||||||
|
|
||||||
|
The mimetype is used for serialized objects, and tells the
|
||||||
|
ResXResourceReader how to depersist the object. This is currently not
|
||||||
|
extensible. For a given mimetype the value must be set accordingly:
|
||||||
|
|
||||||
|
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||||
|
that the ResXResourceWriter will generate, however the reader can
|
||||||
|
read any of the formats listed below.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.binary.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.soap.base64
|
||||||
|
value : The object must be serialized with
|
||||||
|
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
|
||||||
|
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||||
|
value : The object must be serialized into a byte array
|
||||||
|
: using a System.ComponentModel.TypeConverter
|
||||||
|
: and then encoded with base64 encoding.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<xsd:element name="data">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||||
|
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>1.3</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="writer">
|
||||||
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
</root>
|
@ -26,4 +26,23 @@
|
|||||||
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Compile Update="Properties\Resources.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>Resources.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Update="Properties\Resources.resx">
|
||||||
|
<Generator>ResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||||
|
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)ImplementationExtensions\*.dll"" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
using SushiBarContracts.DI;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
using SushiBarFileImplement.Implements;
|
||||||
|
|
||||||
|
namespace SushiBarFileImplement
|
||||||
|
{
|
||||||
|
public class FileImplementationExtension : IImplementationExtension
|
||||||
|
{
|
||||||
|
public int Priority => 0;
|
||||||
|
public void RegisterServices()
|
||||||
|
{
|
||||||
|
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<ISushiStorage, SushiStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
38
SushiBar/SushiBarFileImplement/Implements/BackUpInfo.cs
Normal file
38
SushiBar/SushiBarFileImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
using System.Reflection;
|
||||||
|
|
||||||
|
namespace SushiBarFileImplement.Implements
|
||||||
|
{
|
||||||
|
public class BackUpInfo : IBackUpInfo
|
||||||
|
{
|
||||||
|
private readonly DataFileSingleton source;
|
||||||
|
private readonly PropertyInfo[] sourceProperties;
|
||||||
|
|
||||||
|
public BackUpInfo()
|
||||||
|
{
|
||||||
|
source = DataFileSingleton.GetInstance();
|
||||||
|
sourceProperties = source.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public);
|
||||||
|
}
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
public List<T>? GetList<T>() where T : class, new()
|
||||||
|
{
|
||||||
|
var requredType = typeof(T);
|
||||||
|
return (List<T>?)sourceProperties.FirstOrDefault(x => x.PropertyType.IsGenericType && x.PropertyType.GetGenericArguments()[0] == requredType)
|
||||||
|
?.GetValue(source);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -1,11 +1,12 @@
|
|||||||
using SushiBarContracts.BindingModels;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
using SushiBarFileImplement.Models;
|
using SushiBarFileImplement.Models;
|
||||||
|
|
||||||
namespace SushiBarFileImplement.Implements
|
namespace SushiBarFileImplement.Implements
|
||||||
{
|
{
|
||||||
public class ClientStorage
|
public class ClientStorage : IClientStorage
|
||||||
{
|
{
|
||||||
private readonly DataFileSingleton source;
|
private readonly DataFileSingleton source;
|
||||||
public ClientStorage()
|
public ClientStorage()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
using SushiBarFileImplement.Models;
|
using SushiBarFileImplement.Models;
|
||||||
|
|
||||||
|
@ -71,5 +71,7 @@ namespace SushiBarFileImplement.Models
|
|||||||
new XAttribute("SenderName", SenderName),
|
new XAttribute("SenderName", SenderName),
|
||||||
new XAttribute("DateDelivery", DateDelivery)
|
new XAttribute("DateDelivery", DateDelivery)
|
||||||
);
|
);
|
||||||
}
|
|
||||||
|
public int Id => throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
17
SushiBar/SushiBarListImplement/Implements/BackUpInfo.cs
Normal file
17
SushiBar/SushiBarListImplement/Implements/BackUpInfo.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
|
||||||
|
namespace SushiBarListImplement.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,6 +1,6 @@
|
|||||||
using IceCreamShopContracts.StoragesContracts;
|
using SushiBarContracts.BindingModels;
|
||||||
using SushiBarContracts.BindingModels;
|
|
||||||
using SushiBarContracts.SearchModels;
|
using SushiBarContracts.SearchModels;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
using SushiBarContracts.ViewModels;
|
using SushiBarContracts.ViewModels;
|
||||||
using SushiBarListImplement.Models;
|
using SushiBarListImplement.Models;
|
||||||
|
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
using SushiBarContracts.DI;
|
||||||
|
using SushiBarContracts.StoragesContracts;
|
||||||
|
using SushiBarListImplement.Implements;
|
||||||
|
|
||||||
|
namespace SushiBarListImplement
|
||||||
|
{
|
||||||
|
public class ListImplementationExtension : IImplementationExtension
|
||||||
|
{
|
||||||
|
public int Priority => 0;
|
||||||
|
public void RegisterServices()
|
||||||
|
{
|
||||||
|
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<ISushiStorage, SushiStorage>();
|
||||||
|
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -45,5 +45,6 @@ namespace SushiBarListImplement.Models
|
|||||||
DateDelivery = DateDelivery,
|
DateDelivery = DateDelivery,
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
public int Id => throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user