подкорректировала красоту вывода колонок, ну и заменила до конца использование сервис провайдера на менеджер зависимостей наш
This commit is contained in:
parent
54854a1ac0
commit
4f4dad18c5
@ -135,7 +135,7 @@ namespace SushiBarView
|
||||
|
||||
private void запускРаботToolStripMenuItem_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);
|
||||
}
|
||||
|
||||
|
@ -16,10 +16,6 @@ namespace SushiBar
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
|
||||
private static ServiceProvider? _serviceProvider;
|
||||
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
||||
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
|
@ -2,6 +2,7 @@
|
||||
using SushiBar;
|
||||
using SushiBarContracts.BindingModel;
|
||||
using SushiBarContracts.BusinessLogicsContracts;
|
||||
using SushiBarContracts.DI;
|
||||
using SushiBarContracts.SearchModel;
|
||||
using SushiBarDataModels.Models;
|
||||
|
||||
@ -29,7 +30,7 @@ namespace SushiBarView
|
||||
_logger.LogInformation("Загрузка изделия");
|
||||
try
|
||||
{
|
||||
var view = _logic.ReadElement(new SushiSearchModel{ Id = _id.Value });
|
||||
var view = _logic.ReadElement(new SushiSearchModel { Id = _id.Value });
|
||||
if (view != null)
|
||||
{
|
||||
textBoxName.Text = view.SushiName;
|
||||
@ -68,50 +69,46 @@ namespace SushiBarView
|
||||
}
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent));
|
||||
if (service is FormSushiComponent form)
|
||||
var form = DependencyManager.Instance.Resolve<FormSushiComponent>();
|
||||
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
if (form.ComponentModel == null)
|
||||
{
|
||||
if (form.ComponentModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}",
|
||||
form.ComponentModel.ComponentName, form.Count);
|
||||
if (_sushiComponents.ContainsKey(form.Id))
|
||||
{
|
||||
_sushiComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_sushiComponents.Add(form.Id, (form.ComponentModel, form.Count));
|
||||
}
|
||||
LoadData();
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Добавление нового компонента: { ComponentName} - { Count}",
|
||||
form.ComponentModel.ComponentName, form.Count);
|
||||
if (_sushiComponents.ContainsKey(form.Id))
|
||||
{
|
||||
_sushiComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||
}
|
||||
else
|
||||
{
|
||||
_sushiComponents.Add(form.Id, (form.ComponentModel, form.Count));
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
private void ButtonUpd_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormSushiComponent));
|
||||
if (service is FormSushiComponent form)
|
||||
var form = DependencyManager.Instance.Resolve<FormSushiComponent>();
|
||||
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||
form.Id = id;
|
||||
form.Count = _sushiComponents[id].Item2;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value);
|
||||
form.Id = id;
|
||||
form.Count = _sushiComponents[id].Item2;
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
if (form.ComponentModel == null)
|
||||
{
|
||||
if (form.ComponentModel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count} ",
|
||||
form.ComponentModel.ComponentName, form.Count);
|
||||
_sushiComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||
LoadData();
|
||||
return;
|
||||
}
|
||||
_logger.LogInformation("Изменение компонента: { ComponentName} - { Count} ",
|
||||
form.ComponentModel.ComponentName, form.Count);
|
||||
_sushiComponents[form.Id] = (form.ComponentModel, form.Count);
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -124,7 +121,7 @@ namespace SushiBarView
|
||||
{
|
||||
try
|
||||
{
|
||||
_logger.LogInformation("Удаление компонента: { ComponentName} - { Count}",
|
||||
_logger.LogInformation("Удаление компонента: {ComponentName} - { Count}",
|
||||
dataGridView.SelectedRows[0].Cells[1].Value);
|
||||
_sushiComponents?.Remove(Convert.ToInt32(dataGridView.SelectedRows[0].Cells[0].Value));
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ namespace SushiBarContracts.ViewModels
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(title: "ФИО клиента", width: 200)]
|
||||
[Column(title: "ФИО клиента", width: 250)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Логин (эл. почта)", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Email { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Пароль", width: 50)]
|
||||
[Column(title: "Пароль", width: 100)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -9,11 +9,11 @@ namespace SushiBarContracts.ViewModels
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(title: "Компонент", width: 50)]
|
||||
[Column(title: "Компонент", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string ComponentName { get; set; } = string.Empty;
|
||||
[DisplayName("Цена")]
|
||||
|
||||
[Column(title: "Цена", width: 30)]
|
||||
[Column(title: "Цена", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public double Cost { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -14,16 +14,16 @@ namespace SushiBarContracts.ViewModels
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(title: "Исполнитель ФИО", width: 150)]
|
||||
[Column(title: "Исполнитель ФИО", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string ImplementerFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Пароль", width: 50)]
|
||||
[Column(title: "Пароль", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Опыт работы", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
[Column(title: "Опыт работы", width: 130)]
|
||||
public int WorkExperience { get; set; }
|
||||
|
||||
[Column(title: "Квалификация", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
[Column(title: "Квалификация", width: 130)]
|
||||
public int Qualification { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace SushiBarContracts.ViewModels
|
||||
public class MessageInfoViewModel : IMessageInfoModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id => throw new NotImplementedException();
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public string MessageId { get; set; } = string.Empty;
|
||||
|
@ -8,7 +8,7 @@ namespace SushiBarContracts.ViewModels
|
||||
{
|
||||
public class OrderViewModel : IOrderModel
|
||||
{
|
||||
[Column(title: "Номер", width: 10)]
|
||||
[Column(title: "Номер", width: 30)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
@ -20,24 +20,23 @@ namespace SushiBarContracts.ViewModels
|
||||
[Column(visible: false)]
|
||||
public int? ImplementerId { get; set; }
|
||||
|
||||
[Column(title: "Имя клиента", width: 150)]
|
||||
[Column(title: "Имя клиента", width: 250)]
|
||||
public string ClientFIO { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Имя исполнителя", width: 150)]
|
||||
public string? ImplementerFIO { get; set; }
|
||||
|
||||
[Column(title: "Суши", width: 50)]
|
||||
[Column(title: "Суши", width: 100)]
|
||||
public string SushiName { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Количество", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
[Column(title: "Количество", width: 60)]
|
||||
public int Count { get; set; }
|
||||
|
||||
|
||||
[Column(title: "Сумма", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public double Sum { get; set; }
|
||||
|
||||
|
||||
[Column(title: "Статус", width: 30)]
|
||||
[Column(title: "Статус", width: 80)]
|
||||
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
|
||||
|
||||
|
||||
|
@ -9,7 +9,7 @@ namespace SushiBarContracts.ViewModels
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Column(title: "Название изделия", width: 50)]
|
||||
[Column(title: "Название изделия", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string SushiName { get; set; } = string.Empty;
|
||||
|
||||
[Column(title: "Цена", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
|
Loading…
x
Reference in New Issue
Block a user