депенденси менеджер.....
This commit is contained in:
parent
78d1fd1d8c
commit
ab12dc2571
@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@ -26,15 +27,12 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponent));
|
var form = DependencyManager.Instance.Resolve<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)
|
||||||
{
|
{
|
||||||
@ -58,17 +56,14 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service =
|
var form = DependencyManager.Instance.Resolve<FormComponent>();
|
||||||
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)
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
LoadData();
|
||||||
{
|
}
|
||||||
LoadData();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonDel_Click(object sender, EventArgs e)
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@ -47,13 +48,10 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||||
if (service is FormImplementer form)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
LoadData();
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,14 +59,11 @@ namespace ConfectioneryView
|
|||||||
{
|
{
|
||||||
if (dataGridView.SelectedRows.Count == 1)
|
if (dataGridView.SelectedRows.Count == 1)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||||
if (service is FormImplementer form)
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
LoadData();
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
|
||||||
{
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
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;
|
||||||
@ -51,29 +52,20 @@ namespace ConfectioneryView
|
|||||||
}
|
}
|
||||||
private void componentsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void componentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormComponents));
|
var form = DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormPastrys));
|
var form = DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder));
|
var form = DependencyManager.Instance.Resolve<FormCreateOrder>();
|
||||||
if (service is FormCreateOrder form)
|
form.ShowDialog();
|
||||||
{
|
LoadData();
|
||||||
form.ShowDialog();
|
|
||||||
LoadData();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
|
private void buttonTakeOrderInWork_Click(object sender, EventArgs e)
|
||||||
@ -161,21 +153,14 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e)
|
private void componentPastryToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportPastryComponents));
|
var form = DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormReportOrders));
|
var form = DependencyManager.Instance.Resolve<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)
|
||||||
@ -194,35 +179,26 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
|
private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormClients));
|
var form = DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormImplementers));
|
var form = DependencyManager.Instance.Resolve<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((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic);
|
_workProcess.DoWork(DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormMail));
|
var form = DependencyManager.Instance.Resolve<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)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
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;
|
||||||
@ -148,55 +149,45 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
|
var form = DependencyManager.Instance.Resolve<FormPastryComponent>();
|
||||||
if (service is FormPastryComponent form)
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
{
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
return;
|
||||||
{
|
}
|
||||||
if (form.ComponentModel == null)
|
_logger.LogInformation("Добавление нового ингридиента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count);
|
||||||
{
|
if (_pastryComponents.ContainsKey(form.Id))
|
||||||
return;
|
{
|
||||||
}
|
_pastryComponents[form.Id] = (form.ComponentModel,
|
||||||
_logger.LogInformation("Добавление нового компонента:{ComponentName} - {Count}", form.ComponentModel.ComponentName, form.Count);
|
form.Count);
|
||||||
if (_pastryComponents.ContainsKey(form.Id))
|
}
|
||||||
{
|
else
|
||||||
_pastryComponents[form.Id] = (form.ComponentModel,
|
{
|
||||||
form.Count);
|
_pastryComponents.Add(form.Id, (form.ComponentModel,
|
||||||
}
|
form.Count));
|
||||||
else
|
}
|
||||||
{
|
LoadData();
|
||||||
_pastryComponents.Add(form.Id, (form.ComponentModel,
|
}
|
||||||
form.Count));
|
|
||||||
}
|
|
||||||
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 service =
|
var form = DependencyManager.Instance.Resolve<FormPastryComponent>();
|
||||||
Program.ServiceProvider?.GetService(typeof(FormPastryComponent));
|
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||||
if (service is FormPastryComponent form)
|
form.Id = id;
|
||||||
{
|
form.Count = _pastryComponents[id].Item2;
|
||||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
form.Id = id;
|
{
|
||||||
form.Count = _pastryComponents[id].Item2;
|
if (form.ComponentModel == null)
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
{
|
||||||
{
|
return;
|
||||||
if (form.ComponentModel == null)
|
}
|
||||||
{
|
_logger.LogInformation("Изменение ингридиента:{ ComponentName}-{ Count}", form.ComponentModel.ComponentName, form.Count);
|
||||||
return;
|
_pastryComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||||
}
|
LoadData();
|
||||||
_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)
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
@ -10,6 +10,7 @@ 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
|
||||||
{
|
{
|
||||||
@ -44,30 +45,24 @@ namespace ConfectioneryView
|
|||||||
|
|
||||||
private void buttonAdd_Click(object sender, EventArgs e)
|
private void buttonAdd_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var service = Program.ServiceProvider?.GetService(typeof(FormPastry));
|
var form = DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormPastry));
|
var form = DependencyManager.Instance.Resolve<FormPastry>();
|
||||||
if (service is FormPastry form)
|
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||||
{
|
if (form.ShowDialog() == DialogResult.OK)
|
||||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
{
|
||||||
if (form.ShowDialog() == DialogResult.OK)
|
LoadData();
|
||||||
{
|
}
|
||||||
LoadData();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonDel_Click(object sender, EventArgs e)
|
private void buttonDel_Click(object sender, EventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user