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.Linq;
using System.Text;
@ -7,7 +6,7 @@ using System.Threading.Tasks;
namespace ConfectioneryListImplement.Implements
{
public class BackUpInfo : IBackUpInfo
public class BackUpInfo
{
public List<T>? GetList<T>() where T : class, new()
{

View File

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

View File

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

View File

@ -2,7 +2,6 @@
using ConfectioneryContracts.BindingModels;
using ConfectioneryContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging;
using ConfectioneryContracts.DI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
@ -52,20 +51,29 @@ namespace ConfectioneryView
}
private void componentsToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormComponents>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
if (service is FormComponents form)
{
form.ShowDialog();
}
}
private void pastryToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormPastrys>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormPastrys));
if (service is FormPastrys form)
{
form.ShowDialog();
}
}
private void buttonCreateOrder_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
form.ShowDialog();
LoadData();
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
if (service is FormCreateOrder form)
{
form.ShowDialog();
LoadData();
}
}
private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
@ -153,14 +161,21 @@ namespace ConfectioneryView
private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormReportPastryComponents>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryComponents));
if (service is FormReportPastryComponents form)
{
form.ShowDialog();
}
}
private void ordersListToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormReportOrders>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
if (service is FormReportOrders form)
{
form.ShowDialog();
}
}
private void pastrysListToolStripMenuItem_Click(object sender, EventArgs e)
@ -179,26 +194,35 @@ namespace ConfectioneryView
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormClients>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
if (service is FormClients form)
{
form.ShowDialog();
}
}
private void implementersToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormImplementers>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
if (service is FormImplementers form)
{
form.ShowDialog();
}
}
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);
}
private void mailToolStripMenuItem_Click(object sender, EventArgs e)
{
var form = DependencyManager.Instance.Resolve<FormMail>();
form.ShowDialog();
var service = Program.ServiceProvider?.GetService(typeof(FormMail));
if (service is FormMail form)
{
form.ShowDialog();
}
}
private void createBackupToolStripMenuItem_Click(object sender, EventArgs e)

View File

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

View File

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