вроде работает

This commit is contained in:
bekodeg 2024-06-17 22:01:18 +04:00
parent 501b3bb6cf
commit a2737c5f00
16 changed files with 32 additions and 20 deletions

View File

@ -2,6 +2,7 @@
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SushiBar.Extensions; using SushiBar.Extensions;
using SushiBarContracts.DI;
namespace SushiBar.Forms namespace SushiBar.Forms
{ {
@ -34,7 +35,7 @@ namespace SushiBar.Forms
} }
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 = DependencyManager.Instance.Resolve<FormComponent>();
if (service is FormComponent form) if (service is FormComponent form)
{ {
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
@ -47,7 +48,7 @@ namespace SushiBar.Forms
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormComponent)); var service = DependencyManager.Instance.Resolve<FormComponent>();
if (service is FormComponent form) 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);

View File

@ -2,6 +2,7 @@
using SushiBar.Extensions; using SushiBar.Extensions;
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.DI;
using System.Windows.Forms; using System.Windows.Forms;
namespace SushiBar.Forms namespace SushiBar.Forms
@ -37,7 +38,7 @@ namespace SushiBar.Forms
} }
private void CreateButton_Click(object sender, EventArgs e) private void CreateButton_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer)); var service = DependencyManager.Instance.Resolve<FormImplementer>();
if (service is FormImplementer form) if (service is FormImplementer form)
{ {
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
@ -51,7 +52,7 @@ namespace SushiBar.Forms
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer)); var service = DependencyManager.Instance.Resolve<FormImplementer>();
if (service is FormImplementer form) if (service is FormImplementer form)
{ {
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);

View File

@ -4,6 +4,7 @@ using SushiBarBusinessLogic.BusinessLogic;
using SushiBarBusinessLogic.BusinessLogics; using SushiBarBusinessLogic.BusinessLogics;
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.DI;
namespace SushiBar.Forms namespace SushiBar.Forms
{ {
@ -50,7 +51,7 @@ namespace SushiBar.Forms
} }
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e) private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormComponents)); var service = DependencyManager.Instance.Resolve<FormComponents>();
if (service is FormComponents form) if (service is FormComponents form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -58,7 +59,7 @@ namespace SushiBar.Forms
} }
private void SushiToolStripMenuItem_Click(object sender, EventArgs e) private void SushiToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormSushis)); var service = DependencyManager.Instance.Resolve<FormSushis>();
if (service is FormSushis form) if (service is FormSushis form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -66,7 +67,7 @@ namespace SushiBar.Forms
} }
private void ButtonCreateOrder_Click(object sender, EventArgs e) private void ButtonCreateOrder_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormCreateOrder)); var service = DependencyManager.Instance.Resolve<FormCreateOrder>();
if (service is FormCreateOrder form) if (service is FormCreateOrder form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -160,7 +161,7 @@ namespace SushiBar.Forms
private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e) private void componentsReportПоСушиToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormReportSushiComponents)); var service = DependencyManager.Instance.Resolve<FormReportSushiComponents>();
if (service is FormReportSushiComponents form) if (service is FormReportSushiComponents form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -169,7 +170,7 @@ namespace SushiBar.Forms
private void orderReportToolStripMenuItem_Click(object sender, EventArgs e) private void orderReportToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrders)); var service = DependencyManager.Instance.Resolve<FormReportOrders>();
if (service is FormReportOrders form) if (service is FormReportOrders form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -178,7 +179,7 @@ namespace SushiBar.Forms
private void clientsToolStripMenuItem_Click(object sender, EventArgs e) private void clientsToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormClients)); var service = DependencyManager.Instance.Resolve<FormClients>();
if (service is FormClients form) if (service is FormClients form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -187,7 +188,7 @@ namespace SushiBar.Forms
private void implementersToolStripMenuItem_Click(object sender, EventArgs e) private void implementersToolStripMenuItem_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormImplementers)); var service = DependencyManager.Instance.Resolve<FormImplementers>();
if (service is FormImplementers form) if (service is FormImplementers form)
{ {
form.ShowDialog(); form.ShowDialog();
@ -196,13 +197,13 @@ namespace SushiBar.Forms
private void startWorksToolStripMenuItem_Click(object sender, EventArgs e) private void startWorksToolStripMenuItem_Click(object sender, EventArgs e)
{ {
_workProcess.DoWork((Program.ServiceProvider?.GetService(typeof(IImplementerLogic)) as IImplementerLogic)!, _orderLogic); _workProcess.DoWork((DependencyManager.Instance.Resolve<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 service = Program.ServiceProvider?.GetService(typeof(FormMailView)); var service = DependencyManager.Instance.Resolve<FormMailView>();
if (service is FormMailView form) if (service is FormMailView form)
{ {
form.ShowDialog(); form.ShowDialog();

View File

@ -1,6 +1,7 @@
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.DI;
using SushiBarContracts.SearchModels; using SushiBarContracts.SearchModels;
using SushiBarDataModels.Models; using SushiBarDataModels.Models;
@ -69,7 +70,7 @@ namespace SushiBar.Forms
} }
private void ButtonAdd_Click(object sender, EventArgs e) private void ButtonAdd_Click(object sender, EventArgs e)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent)); var service = DependencyManager.Instance.Resolve<FormSushiComponent>();
if (service is FormSushiComponent form) if (service is FormSushiComponent form)
{ {
@ -96,7 +97,7 @@ namespace SushiBar.Forms
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent)); var service = DependencyManager.Instance.Resolve<FormSushiComponent>();
if (service is FormSushiComponent form) if (service is FormSushiComponent form)
{ {
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value); int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);

View File

@ -2,6 +2,7 @@
using SushiBar.Extensions; using SushiBar.Extensions;
using SushiBarContracts.BindingModels; using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts; using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.DI;
namespace SushiBar.Forms namespace SushiBar.Forms
{ {
@ -34,7 +35,7 @@ namespace SushiBar.Forms
} }
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 = DependencyManager.Instance.Resolve<FormSushi>();
if (service is FormSushi form) if (service is FormSushi form)
{ {
if (form.ShowDialog() == DialogResult.OK) if (form.ShowDialog() == DialogResult.OK)
@ -47,7 +48,7 @@ namespace SushiBar.Forms
{ {
if (dataGridView.SelectedRows.Count == 1) if (dataGridView.SelectedRows.Count == 1)
{ {
var service = Program.ServiceProvider?.GetService(typeof(FormSushi)); var service = DependencyManager.Instance.Resolve<FormSushi>();
if (service is FormSushi form) if (service is FormSushi form)
{ {
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value); form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);

View File

@ -64,12 +64,12 @@ namespace SushiBar
}); });
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>(); DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>(); DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>(true);
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>(); DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>(); DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<ISushiLogic, SushiLogic>(); DependencyManager.Instance.RegisterType<ISushiLogic, SushiLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>(); DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>(); DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>(true);
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>(); DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>(); DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();

View File

@ -23,6 +23,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" /> <ProjectReference Include="..\SushiBarBusinessLogic\SushiBarBusinessLogic.csproj" />
<ProjectReference Include="..\SushiBarDatabaseImplement\SushiBarDatabaseImplement.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -7,6 +7,7 @@ namespace SushiBarContracts.ViewModels
{ {
[Column(visible: false)] [Column(visible: false)]
public int Id { get; set; } public int Id { get; set; }
[Column(visible: false)]
public string ClientFIO { get; set; } = string.Empty; public string ClientFIO { get; set; } = string.Empty;
[Column(title: "Email клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)] [Column(title: "Email клиента", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Email { get; set; } = string.Empty; public string Email { get; set; } = string.Empty;

View File

@ -4,7 +4,6 @@ using SushiBarContracts.SearchModels;
using SushiBarContracts.StoragesContracts; using SushiBarContracts.StoragesContracts;
using SushiBarContracts.ViewModels; using SushiBarContracts.ViewModels;
using SushiBarDatabaseImplement.Models; using SushiBarDatabaseImplement.Models;
using System.Collections.Generic;
namespace SushiBarDatabaseImplement.Implements namespace SushiBarDatabaseImplement.Implements
{ {

View File

@ -11,4 +11,7 @@
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" /> <ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project> </Project>

View File

@ -11,4 +11,7 @@
<ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" /> <ProjectReference Include="..\SushiBarDataModels\SushiBarDataModels.csproj" />
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="copy /Y &quot;$(TargetDir)*.dll&quot; &quot;$(SolutionDir)ImplementationExtensions\*.dll&quot;" />
</Target>
</Project> </Project>