Compare commits

..

No commits in common. "2f61afb63460843d05580947146d5c672dbcdc30" and "78d1fd1d8c077b8455239a3bafeed1b25313c56b" have entirely different histories.

6 changed files with 143 additions and 96 deletions

View File

@ -1,5 +1,4 @@
using ConfectioneryContracts.StoragesContracts; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -7,7 +6,7 @@ using System.Threading.Tasks;
namespace ConfectioneryListImplement.Implements namespace ConfectioneryListImplement.Implements
{ {
public class BackUpInfo : IBackUpInfo public class BackUpInfo
{ {
public List<T>? GetList<T>() where T : class, new() public List<T>? GetList<T>() where T : class, new()
{ {

View File

@ -1,6 +1,5 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.DI;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -27,12 +26,15 @@ namespace ConfectioneryView
private void buttonAdd_Click(object sender, EventArgs e) private void buttonAdd_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormComponent>(); var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
if (service is FormComponent form)
{
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
LoadData(); LoadData();
} }
} }
}
private void FormComponents_Load(object sender, EventArgs e) private void FormComponents_Load(object sender, EventArgs e)
{ {
@ -56,8 +58,10 @@ namespace ConfectioneryView
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var form = DependencyManager.Instance.Resolve<FormComponent>(); var service =
Program.ServiceProvider?.GetService(typeof(FormComponent));
if (service is FormComponent form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
@ -65,6 +69,7 @@ namespace ConfectioneryView
} }
} }
} }
}
private void buttonDel_Click(object sender, EventArgs e) private void buttonDel_Click(object sender, EventArgs e)
{ {

View File

@ -1,6 +1,5 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.DI;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
@ -48,18 +47,23 @@ namespace ConfectioneryView
private void buttonAdd_Click(object sender, EventArgs e) private void buttonAdd_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormImplementer>(); var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
if (service is FormImplementer form)
{
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
LoadData(); LoadData();
} }
} }
}
private void buttonUpd_Click(object sender, EventArgs e) private void buttonUpd_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var form = DependencyManager.Instance.Resolve<FormImplementer>(); var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
if (service is FormImplementer form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
@ -67,6 +71,7 @@ namespace ConfectioneryView
} }
} }
} }
}
private void buttonDel_Click(object sender, EventArgs e) private void buttonDel_Click(object sender, EventArgs e)
{ {

View File

@ -2,7 +2,6 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ConfectioneryContracts.DI;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@ -52,21 +51,30 @@ namespace ConfectioneryView
} }
private void componentsToolStripMenuItem_Click(object sender, EventArgs e) private void componentsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormComponents>(); var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
if (service is FormComponents form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void pastryToolStripMenuItem_Click(object sender, EventArgs e) private void pastryToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormPastrys>(); var service = Program.ServiceProvider?.GetService(typeof(FormPastrys));
if (service is FormPastrys form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void buttonCreateOrder_Click(object sender, EventArgs e) private void buttonCreateOrder_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormCreateOrder>(); var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
if (service is FormCreateOrder form)
{
form.ShowDialog(); form.ShowDialog();
LoadData(); LoadData();
} }
}
private void buttonTakeOrderInWork_Click(object sender, EventArgs e) private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
{ {
@ -153,15 +161,22 @@ namespace ConfectioneryView
private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e) private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormReportPastryComponents>(); var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryComponents));
if (service is FormReportPastryComponents form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void ordersListToolStripMenuItem_Click(object sender, EventArgs e) private void ordersListToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormReportOrders>(); var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void pastrysListToolStripMenuItem_Click(object sender, EventArgs e) private void pastrysListToolStripMenuItem_Click(object sender, EventArgs e)
{ {
@ -179,27 +194,36 @@ namespace ConfectioneryView
private void clientsToolStripMenuItem_Click(object sender, EventArgs e) private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormClients>(); var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void implementersToolStripMenuItem_Click(object sender, EventArgs e) private void implementersToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormImplementers>(); var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
if (service is FormImplementers form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void startWorkToolStripMenuItem_Click(object sender, EventArgs e) private void startWorkToolStripMenuItem_Click(object sender, EventArgs e)
{ {
_workProcess.DoWork(DependencyManager.Instance.Resolve<IImplementerLogic>(), _orderLogic); _workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Процесс обработки запущен", "Сообщение", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }
private void mailToolStripMenuItem_Click(object sender, EventArgs e) private void mailToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormMail>(); var service = Program.ServiceProvider?.GetService(typeof(FormMail));
if (service is FormMail form)
{
form.ShowDialog(); form.ShowDialog();
} }
}
private void createBackupToolStripMenuItem_Click(object sender, EventArgs e) private void createBackupToolStripMenuItem_Click(object sender, EventArgs e)
{ {

View File

@ -1,6 +1,5 @@
using ConfectioneryContracts.BindingModels; using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.DI;
using ConfectioneryContracts.SearchModels; using ConfectioneryContracts.SearchModels;
using ConfectioneryDataModels.Models; using ConfectioneryDataModels.Models;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -149,12 +148,16 @@ namespace ConfectioneryView
private void buttonAdd_Click(object sender, EventArgs e) private void buttonAdd_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormPastryComponent>(); var service = Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
if (service is FormPastryComponent form)
{
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{
if (form.ComponentModel == null)
{ {
return; return;
} }
_logger.LogInformation("Добавление нового ингридиента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count); _logger.LogInformation("Добавление нового компонента:{ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
if (_pastryComponents.ContainsKey(form.Id)) if (_pastryComponents.ContainsKey(form.Id))
{ {
_pastryComponents[form.Id] = (form.ComponentModel, _pastryComponents[form.Id] = (form.ComponentModel,
@ -167,12 +170,17 @@ namespace ConfectioneryView
} }
LoadData(); LoadData();
} }
}
}
private void buttonUpd_Click(object sender, EventArgs e) private void buttonUpd_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var form = DependencyManager.Instance.Resolve<FormPastryComponent>(); var service =
Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
if (service is FormPastryComponent form)
{
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
form.Id = id; form.Id = id;
form.Count = _pastryComponents[id].Item2; form.Count = _pastryComponents[id].Item2;
@ -182,12 +190,13 @@ namespace ConfectioneryView
{ {
return; return;
} }
_logger.LogInformation("Изменение ингридиента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count); _logger.LogInformation("Изменение компонента: {ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
_pastryComponents[form.Id] = (form.ComponentModel, form.Count); _pastryComponents[form.Id] = (form.ComponentModel, form.Count);
LoadData(); LoadData();
} }
} }
} }
}
private void buttonDel_Click(object sender, EventArgs e) private void buttonDel_Click(object sender, EventArgs e)
{ {

View File

@ -10,7 +10,6 @@ using System.Windows.Forms;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using ConfectioneryContracts.BindingModels; using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts; using ConfectioneryContracts.BusinessLogicsContracts;
using ConfectioneryContracts.DI;
namespace ConfectioneryView namespace ConfectioneryView
{ {
@ -45,18 +44,23 @@ namespace ConfectioneryView
private void buttonAdd_Click(object sender, EventArgs e) private void buttonAdd_Click(object sender, EventArgs e)
{ {
var form = DependencyManager.Instance.Resolve<FormPastry>(); var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
if (service is FormPastry form)
{
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
LoadData(); LoadData();
} }
} }
}
private void buttonUpd_Click(object sender, EventArgs e) private void buttonUpd_Click(object sender, EventArgs e)
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var form = DependencyManager.Instance.Resolve<FormPastry>(); var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
if (service is FormPastry form)
{
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
{ {
@ -64,6 +68,7 @@ namespace ConfectioneryView
} }
} }
} }
}
private void buttonDel_Click(object sender, EventArgs e) private void buttonDel_Click(object sender, EventArgs e)
{ {