ПИбд-22 Боровков М В 8 лабораторная работа #9

Closed
bekodeg wants to merge 4 commits from labWork8 into labWork7
16 changed files with 32 additions and 20 deletions
Showing only changes of commit a2737c5f00 - Show all commits

View File

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

View File

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

View File

@ -4,6 +4,7 @@ using SushiBarBusinessLogic.BusinessLogic;
using SushiBarBusinessLogic.BusinessLogics;
using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.DI;
namespace SushiBar.Forms
{
@ -50,7 +51,7 @@ namespace SushiBar.Forms
}
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)
{
form.ShowDialog();
@ -58,7 +59,7 @@ namespace SushiBar.Forms
}
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)
{
form.ShowDialog();
@ -66,7 +67,7 @@ namespace SushiBar.Forms
}
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)
{
form.ShowDialog();
@ -160,7 +161,7 @@ namespace SushiBar.Forms
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)
{
form.ShowDialog();
@ -169,7 +170,7 @@ namespace SushiBar.Forms
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)
{
form.ShowDialog();
@ -178,7 +179,7 @@ namespace SushiBar.Forms
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)
{
form.ShowDialog();
@ -187,7 +188,7 @@ namespace SushiBar.Forms
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)
{
form.ShowDialog();
@ -196,13 +197,13 @@ namespace SushiBar.Forms
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);
}
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)
{
form.ShowDialog();

View File

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

View File

@ -2,6 +2,7 @@
using SushiBar.Extensions;
using SushiBarContracts.BindingModels;
using SushiBarContracts.BusinessLogicsContracts;
using SushiBarContracts.DI;
namespace SushiBar.Forms
{
@ -34,7 +35,7 @@ namespace SushiBar.Forms
}
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 (form.ShowDialog() == DialogResult.OK)
@ -47,7 +48,7 @@ namespace SushiBar.Forms
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSushi));
var service = DependencyManager.Instance.Resolve<FormSushi>();
if (service is FormSushi form)
{
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<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>(true);
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<ISushiLogic, SushiLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>(true);
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();

View File

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

View File

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

View File

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

View File

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

View File

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