done hard8
This commit is contained in:
parent
14d46c3035
commit
53b0086695
1
.gitignore
vendored
1
.gitignore
vendored
@ -18,6 +18,7 @@
|
||||
*.dll
|
||||
|
||||
/Pizzeria/ImplementationExtensions
|
||||
/Pizzeria/BusinessLogicExtensions
|
||||
|
||||
# Mono auto generated files
|
||||
mono_crash.*
|
||||
|
@ -0,0 +1,34 @@
|
||||
using PizzeriaBusinessLogic.MailWorker;
|
||||
using PizzeriaBusinessLogic.OfficePackage.Implements;
|
||||
using PizzeriaBusinessLogic.OfficePackage;
|
||||
using PizzeriaContracts.BusinessLogicsContracts;
|
||||
using PizzeriaContracts.DI;
|
||||
|
||||
namespace PizzeriaBusinessLogic.BusinessLogics
|
||||
{
|
||||
public class BusinessLogicExtension : IBusinessLogicExtension
|
||||
{
|
||||
public int Priority => 0;
|
||||
|
||||
public void RegisterServices()
|
||||
{
|
||||
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
||||
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
||||
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
||||
DependencyManager.Instance.RegisterType<IPizzaLogic, PizzaLogic>();
|
||||
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
||||
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
||||
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
||||
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
||||
DependencyManager.Instance.RegisterType<IShopLogic, ShopLogic>();
|
||||
|
||||
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
||||
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
||||
|
||||
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
||||
}
|
||||
}
|
||||
}
|
@ -18,4 +18,8 @@
|
||||
<ProjectReference Include="..\PizzeriaDataModels\PizzeriaDataModels.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="copy /Y "$(TargetDir)*.dll" "$(SolutionDir)BusinessLogicExtensions\*.dll"" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -13,13 +13,18 @@
|
||||
|
||||
public bool IsUseAutoSize { get; private set; }
|
||||
|
||||
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
|
||||
public string Format { get; private set; }
|
||||
|
||||
public ColumnAttribute(string title = "", bool visible = true, int width = 0,
|
||||
GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false,
|
||||
string format = "")
|
||||
{
|
||||
Title = title;
|
||||
Visible = visible;
|
||||
Width = width;
|
||||
GridViewAutoSize = gridViewAutoSize;
|
||||
IsUseAutoSize = isUseAutoSize;
|
||||
Format = format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,12 +23,14 @@ namespace PizzeriaContracts.DI
|
||||
public static void InitDependency()
|
||||
{
|
||||
var ext = ServiceProviderLoader.GetImplementationExtensions();
|
||||
if (ext == null)
|
||||
var extLogic = ServiceProviderLoader.GetBusinessLogicExtensions();
|
||||
if (ext == null || extLogic == null)
|
||||
{
|
||||
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей по модулям");
|
||||
}
|
||||
// регистрируем зависимости
|
||||
ext.RegisterServices();
|
||||
extLogic.RegisterServices();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
9
Pizzeria/PizzeriaContracts/DI/IBusinessLogicExtension.cs
Normal file
9
Pizzeria/PizzeriaContracts/DI/IBusinessLogicExtension.cs
Normal file
@ -0,0 +1,9 @@
|
||||
namespace PizzeriaContracts.DI
|
||||
{
|
||||
public interface IBusinessLogicExtension
|
||||
{
|
||||
public int Priority { get; }
|
||||
|
||||
public void RegisterServices();
|
||||
}
|
||||
}
|
@ -42,6 +42,35 @@ namespace PizzeriaContracts.DI
|
||||
return source;
|
||||
}
|
||||
|
||||
public static IBusinessLogicExtension? GetBusinessLogicExtensions()
|
||||
{
|
||||
IBusinessLogicExtension? source = null;
|
||||
var files = Directory.GetFiles(TryGetBusinessLogicExtensionsFolder(), "*.dll", SearchOption.AllDirectories);
|
||||
foreach (var file in files.Distinct())
|
||||
{
|
||||
Assembly asm = Assembly.LoadFrom(file);
|
||||
foreach (var t in asm.GetExportedTypes())
|
||||
{
|
||||
if (t.IsClass && typeof(IBusinessLogicExtension).IsAssignableFrom(t))
|
||||
{
|
||||
if (source == null)
|
||||
{
|
||||
source = (IBusinessLogicExtension)Activator.CreateInstance(t)!;
|
||||
}
|
||||
else
|
||||
{
|
||||
var newSource = (IBusinessLogicExtension)Activator.CreateInstance(t)!;
|
||||
if (newSource.Priority > source.Priority)
|
||||
{
|
||||
source = newSource;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return source;
|
||||
}
|
||||
|
||||
private static string TryGetImplementationExtensionsFolder()
|
||||
{
|
||||
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
@ -51,5 +80,15 @@ namespace PizzeriaContracts.DI
|
||||
}
|
||||
return $"{directory?.FullName}\\ImplementationExtensions";
|
||||
}
|
||||
|
||||
private static string TryGetBusinessLogicExtensionsFolder()
|
||||
{
|
||||
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
|
||||
while (directory != null && !directory.GetDirectories("BusinessLogicExtensions", SearchOption.AllDirectories).Any(x => x.Name == "BusinessLogicExtensions"))
|
||||
{
|
||||
directory = directory.Parent;
|
||||
}
|
||||
return $"{directory?.FullName}\\BusinessLogicExtensions";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
50
Pizzeria/PizzeriaContracts/DI/UnityDependencyContainer.cs
Normal file
50
Pizzeria/PizzeriaContracts/DI/UnityDependencyContainer.cs
Normal file
@ -0,0 +1,50 @@
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Unity;
|
||||
using Unity.Microsoft.Logging;
|
||||
|
||||
namespace PizzeriaContracts.DI
|
||||
{
|
||||
public class UnityDependencyContainer : IDependencyContainer
|
||||
{
|
||||
private readonly UnityContainer _container;
|
||||
|
||||
public UnityDependencyContainer()
|
||||
{
|
||||
_container = new UnityContainer();
|
||||
}
|
||||
|
||||
public void AddLogging(Action<ILoggingBuilder> configure)
|
||||
{
|
||||
_container.AddExtension(new LoggingExtension(LoggerFactory.Create(configure)));
|
||||
}
|
||||
|
||||
public void RegisterType<T, U>(bool isSingle) where U : class, T where T : class
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
_container.RegisterSingleton<T, U>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_container.RegisterType<T, U>();
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterType<T>(bool isSingle) where T : class
|
||||
{
|
||||
if (isSingle)
|
||||
{
|
||||
_container.RegisterSingleton<T>();
|
||||
}
|
||||
else
|
||||
{
|
||||
_container.RegisterType<T>();
|
||||
}
|
||||
}
|
||||
|
||||
public T Resolve<T>()
|
||||
{
|
||||
return _container.Resolve<T>();
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="7.0.0" />
|
||||
<PackageReference Include="Unity.Microsoft.Logging" Version="5.11.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -26,7 +26,7 @@ namespace PizzeriaContracts.ViewModels
|
||||
[Column(title: "Текст", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
|
||||
public string Body { get; set; } = string.Empty;
|
||||
|
||||
[DisplayName("Прочитанно")]
|
||||
[Column("Прочитанно", width: 120)]
|
||||
public bool IsReaded { get; set; }
|
||||
|
||||
public string? ReplyMessageId { get; set; }
|
||||
|
@ -1,4 +1,5 @@
|
||||
using PizzeriaDataModels.Models;
|
||||
using PizzeriaContracts.Attributes;
|
||||
using PizzeriaDataModels.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -8,17 +9,25 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace PizzeriaContracts.ViewModels
|
||||
{
|
||||
|
||||
public class ShopViewModel : IShopModel
|
||||
{
|
||||
[Column(visible: false)]
|
||||
public int Id { get; set; }
|
||||
[DisplayName("Название")]
|
||||
|
||||
[Column(title: "Магазин", width: 200)]
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
[DisplayName("Адрес")]
|
||||
|
||||
[Column(title: "Адрес", width: 100)]
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
[DisplayName("Дата открытия")]
|
||||
|
||||
[Column(title: "Дата открытия", width: 100, format: "d")]
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
[Column(visible: false)]
|
||||
public Dictionary<int, (IPizzaModel, int)> ShopPizzas { get; set; } = new();
|
||||
[DisplayName("Вместимость")]
|
||||
|
||||
[Column(title: "Вместимость", width: 100)]
|
||||
public int PizzaMaxCount { get; set; }
|
||||
}
|
||||
}
|
@ -14,6 +14,8 @@ namespace PizzeriaDatabaseImplement
|
||||
DependencyManager.Instance.RegisterType<IComponentStorage, ComponentStorage>();
|
||||
DependencyManager.Instance.RegisterType<IImplementerStorage, ImplementerStorage>();
|
||||
DependencyManager.Instance.RegisterType<IMessageInfoStorage, MessageInfoStorage>();
|
||||
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
||||
DependencyManager.Instance.RegisterType<IPizzaStorage, PizzaStorage>();
|
||||
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
|
||||
|
@ -1,19 +1,32 @@
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using PizzeriaDataModels.Models;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PizzeriaDatabaseImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember]
|
||||
[Required]
|
||||
public string ShopName { get; set; } = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
[Required]
|
||||
public string Adress { get; set; } = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
[Required]
|
||||
public DateTime OpeningDate { get; set; }
|
||||
|
||||
[DataMember]
|
||||
[Required]
|
||||
public int PizzaMaxCount { get; set; }
|
||||
|
||||
private Dictionary<int, (IPizzaModel, int)>? _shopPizzas = null;
|
||||
|
@ -7,18 +7,28 @@ using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace PizzeriaFileImplement.Models
|
||||
{
|
||||
[DataContract]
|
||||
public class Shop : IShopModel
|
||||
{
|
||||
[DataMember]
|
||||
public int Id { get; private set; }
|
||||
|
||||
[DataMember]
|
||||
public string ShopName { get; private set; } = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
public string Adress { get; private set; } = string.Empty;
|
||||
|
||||
[DataMember]
|
||||
public DateTime OpeningDate { get; private set; }
|
||||
public Dictionary<int, int> Pizzas { get; private set; } = new();
|
||||
private Dictionary<int, (IPizzaModel, int)>? _shopPizzas = null;
|
||||
|
||||
[DataMember]
|
||||
public Dictionary<int, (IPizzaModel, int)> ShopPizzas
|
||||
{
|
||||
get
|
||||
@ -32,6 +42,7 @@ namespace PizzeriaFileImplement.Models
|
||||
}
|
||||
}
|
||||
|
||||
[DataMember]
|
||||
public int PizzaMaxCount { get; private set; }
|
||||
|
||||
public static Shop? Create(ShopBindingModel? model)
|
||||
|
@ -28,22 +28,6 @@ namespace PizzeriaListImplement.Models
|
||||
|
||||
public int Id => throw new NotImplementedException();
|
||||
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new()
|
||||
{
|
||||
Body = model.Body,
|
||||
Subject = model.Subject,
|
||||
ClientId = model.ClientId,
|
||||
MessageId = model.MessageId,
|
||||
SenderName = model.SenderName,
|
||||
DateDelivery = model.DateDelivery,
|
||||
};
|
||||
}
|
||||
public static MessageInfo? Create(MessageInfoBindingModel model)
|
||||
{
|
||||
if (model == null)
|
||||
|
@ -39,6 +39,7 @@ namespace PizzeriaView
|
||||
{
|
||||
column.Width = columnAttr.Width;
|
||||
}
|
||||
column.DefaultCellStyle.Format = columnAttr.Format;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
35
Pizzeria/PizzeriaView/FormComponents.Designer.cs
generated
35
Pizzeria/PizzeriaView/FormComponents.Designer.cs
generated
@ -43,13 +43,12 @@
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(10, 9);
|
||||
this.dataGridView.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.dataGridView.Location = new System.Drawing.Point(11, 12);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(516, 320);
|
||||
this.dataGridView.Size = new System.Drawing.Size(590, 427);
|
||||
this.dataGridView.TabIndex = 0;
|
||||
//
|
||||
// ToolsPanel
|
||||
@ -58,18 +57,16 @@
|
||||
this.ToolsPanel.Controls.Add(this.buttonDelete);
|
||||
this.ToolsPanel.Controls.Add(this.buttonEdit);
|
||||
this.ToolsPanel.Controls.Add(this.buttonAdd);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(532, 9);
|
||||
this.ToolsPanel.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(608, 12);
|
||||
this.ToolsPanel.Name = "ToolsPanel";
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(158, 320);
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(181, 427);
|
||||
this.ToolsPanel.TabIndex = 1;
|
||||
//
|
||||
// buttonUpdate
|
||||
//
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(27, 154);
|
||||
this.buttonUpdate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonUpdate.Location = new System.Drawing.Point(31, 205);
|
||||
this.buttonUpdate.Name = "buttonUpdate";
|
||||
this.buttonUpdate.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonUpdate.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonUpdate.TabIndex = 3;
|
||||
this.buttonUpdate.Text = "Обновить";
|
||||
this.buttonUpdate.UseVisualStyleBackColor = true;
|
||||
@ -77,10 +74,9 @@
|
||||
//
|
||||
// buttonDelete
|
||||
//
|
||||
this.buttonDelete.Location = new System.Drawing.Point(27, 106);
|
||||
this.buttonDelete.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonDelete.Location = new System.Drawing.Point(31, 141);
|
||||
this.buttonDelete.Name = "buttonDelete";
|
||||
this.buttonDelete.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonDelete.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonDelete.TabIndex = 2;
|
||||
this.buttonDelete.Text = "Удалить";
|
||||
this.buttonDelete.UseVisualStyleBackColor = true;
|
||||
@ -88,10 +84,9 @@
|
||||
//
|
||||
// buttonEdit
|
||||
//
|
||||
this.buttonEdit.Location = new System.Drawing.Point(27, 57);
|
||||
this.buttonEdit.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonEdit.Location = new System.Drawing.Point(31, 76);
|
||||
this.buttonEdit.Name = "buttonEdit";
|
||||
this.buttonEdit.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonEdit.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonEdit.TabIndex = 1;
|
||||
this.buttonEdit.Text = "Изменить";
|
||||
this.buttonEdit.UseVisualStyleBackColor = true;
|
||||
@ -99,10 +94,9 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(27, 12);
|
||||
this.buttonAdd.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonAdd.Location = new System.Drawing.Point(31, 16);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(110, 27);
|
||||
this.buttonAdd.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonAdd.TabIndex = 0;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -110,12 +104,11 @@
|
||||
//
|
||||
// FormComponents
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(700, 338);
|
||||
this.ClientSize = new System.Drawing.Size(800, 451);
|
||||
this.Controls.Add(this.ToolsPanel);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormComponents";
|
||||
this.Text = "Ингредиенты";
|
||||
this.Load += new System.EventHandler(this.FormComponents_Load);
|
||||
|
@ -27,21 +27,13 @@ namespace PizzeriaView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["ComponentName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
_logger.LogInformation("Загрузка ингридиентов");
|
||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
||||
_logger.LogInformation("Загрузка компонентов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "Ошибка загрузки ингридиентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
_logger.LogError(ex, "Ошибка загрузки компонентов");
|
||||
MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@
|
||||
this.ToolsPanel.Controls.Add(this.buttonDel);
|
||||
this.ToolsPanel.Controls.Add(this.buttonUpd);
|
||||
this.ToolsPanel.Controls.Add(this.buttonAdd);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(608, 12);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(992, 12);
|
||||
this.ToolsPanel.Name = "ToolsPanel";
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(180, 426);
|
||||
this.ToolsPanel.TabIndex = 3;
|
||||
@ -99,14 +99,14 @@
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(590, 426);
|
||||
this.dataGridView.Size = new System.Drawing.Size(957, 426);
|
||||
this.dataGridView.TabIndex = 2;
|
||||
//
|
||||
// FormImplementers
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(1206, 450);
|
||||
this.Controls.Add(this.ToolsPanel);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormImplementers";
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Pizzeria;
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.BusinessLogicsContracts;
|
||||
using PizzeriaContracts.DI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -48,13 +49,10 @@ namespace PizzeriaView
|
||||
|
||||
private void buttonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||
if (service is FormImplementer form)
|
||||
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
LoadData();
|
||||
}
|
||||
LoadData();
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,14 +60,11 @@ namespace PizzeriaView
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormImplementer));
|
||||
if (service is FormImplementer form)
|
||||
var form = DependencyManager.Instance.Resolve<FormImplementer>();
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ using Pizzeria;
|
||||
using PizzeriaBusinessLogic.MailWorker;
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.BusinessLogicsContracts;
|
||||
using PizzeriaContracts.DI;
|
||||
using PizzeriaContracts.SearchModels;
|
||||
using PizzeriaContracts.ViewModels;
|
||||
using System;
|
||||
@ -110,7 +111,7 @@ namespace PizzeriaView
|
||||
|
||||
private void buttonReply_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormLetter));
|
||||
var service = DependencyManager.Instance.Resolve<FormLetter>();
|
||||
if (service is FormLetter form)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(model.ReplyMessageId))
|
||||
|
@ -4,6 +4,7 @@ using Pizzeria;
|
||||
using PizzeriaBusinessLogic.BusinessLogics;
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.BusinessLogicsContracts;
|
||||
using PizzeriaContracts.DI;
|
||||
using PizzeriaContracts.SearchModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@ -55,7 +56,7 @@ namespace PizzeriaView
|
||||
if (dataGridView.SelectedRows.Count <= 0)
|
||||
return;
|
||||
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormLetter));
|
||||
var service = DependencyManager.Instance.Resolve<FormLetter>();
|
||||
if (service is FormLetter form)
|
||||
{
|
||||
string? messageId = dataGridView.SelectedRows[0].Cells["MessageId"].Value.ToString();
|
||||
|
5
Pizzeria/PizzeriaView/FormMain.Designer.cs
generated
5
Pizzeria/PizzeriaView/FormMain.Designer.cs
generated
@ -69,10 +69,11 @@
|
||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.bookToolStripMenuItem,
|
||||
this.отчётыToolStripMenuItem,
|
||||
this.запускРаботToolStripMenuItem,
|
||||
this.создатьБекапToolStripMenuItem,
|
||||
this.почтаToolStripMenuItem,
|
||||
this.создатьБекапToolStripMenuItem});
|
||||
this.operationToolStripMenuItem,
|
||||
this.отчётыToolStripMenuItem});
|
||||
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
|
||||
this.menuStrip1.Name = "menuStrip1";
|
||||
this.menuStrip1.Padding = new System.Windows.Forms.Padding(5, 2, 0, 2);
|
||||
|
@ -150,29 +150,20 @@ namespace PizzeriaView
|
||||
|
||||
private void shopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
|
||||
if (service is FormShops form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
var form = DependencyManager.Instance.Resolve<FormShops>();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void transactionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormCreateSupply));
|
||||
if (service is FormCreateSupply form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
var form = DependencyManager.Instance.Resolve<FormCreateSupply>();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void SellToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormSellPizza));
|
||||
if (service is FormSellPizza form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
var form = DependencyManager.Instance.Resolve<FormSellPizza>();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void ComponentsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
@ -244,8 +235,7 @@ namespace PizzeriaView
|
||||
MessageBox.Show(ex.Message, "Ошибка создания бэкапа", MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormMail));
|
||||
if (service is FormMail form)
|
||||
{
|
||||
@ -265,20 +255,14 @@ namespace PizzeriaView
|
||||
|
||||
private void BusyShopsToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportShop));
|
||||
if (service is FormReportShop form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
var form = DependencyManager.Instance.Resolve<FormReportShop>();
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void GroupOrdersToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormReportGroupedOrders));
|
||||
if (service is FormReportGroupedOrders form)
|
||||
{
|
||||
form.ShowDialog();
|
||||
}
|
||||
var form = DependencyManager.Instance.Resolve<FormReportGroupedOrders>();
|
||||
form.ShowDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
26
Pizzeria/PizzeriaView/FormShops.Designer.cs
generated
26
Pizzeria/PizzeriaView/FormShops.Designer.cs
generated
@ -44,16 +44,16 @@
|
||||
this.ToolsPanel.Controls.Add(this.buttonDel);
|
||||
this.ToolsPanel.Controls.Add(this.buttonUpd);
|
||||
this.ToolsPanel.Controls.Add(this.buttonAdd);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(608, 12);
|
||||
this.ToolsPanel.Location = new System.Drawing.Point(676, 12);
|
||||
this.ToolsPanel.Name = "ToolsPanel";
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(180, 426);
|
||||
this.ToolsPanel.Size = new System.Drawing.Size(180, 406);
|
||||
this.ToolsPanel.TabIndex = 3;
|
||||
//
|
||||
// buttonRef
|
||||
//
|
||||
this.buttonRef.Location = new System.Drawing.Point(31, 206);
|
||||
this.buttonRef.Location = new System.Drawing.Point(31, 196);
|
||||
this.buttonRef.Name = "buttonRef";
|
||||
this.buttonRef.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonRef.Size = new System.Drawing.Size(126, 34);
|
||||
this.buttonRef.TabIndex = 3;
|
||||
this.buttonRef.Text = "Обновить";
|
||||
this.buttonRef.UseVisualStyleBackColor = true;
|
||||
@ -61,9 +61,9 @@
|
||||
//
|
||||
// buttonDel
|
||||
//
|
||||
this.buttonDel.Location = new System.Drawing.Point(31, 142);
|
||||
this.buttonDel.Location = new System.Drawing.Point(31, 135);
|
||||
this.buttonDel.Name = "buttonDel";
|
||||
this.buttonDel.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonDel.Size = new System.Drawing.Size(126, 34);
|
||||
this.buttonDel.TabIndex = 2;
|
||||
this.buttonDel.Text = "Удалить";
|
||||
this.buttonDel.UseVisualStyleBackColor = true;
|
||||
@ -71,9 +71,9 @@
|
||||
//
|
||||
// buttonUpd
|
||||
//
|
||||
this.buttonUpd.Location = new System.Drawing.Point(31, 76);
|
||||
this.buttonUpd.Location = new System.Drawing.Point(31, 72);
|
||||
this.buttonUpd.Name = "buttonUpd";
|
||||
this.buttonUpd.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonUpd.Size = new System.Drawing.Size(126, 34);
|
||||
this.buttonUpd.TabIndex = 1;
|
||||
this.buttonUpd.Text = "Изменить";
|
||||
this.buttonUpd.UseVisualStyleBackColor = true;
|
||||
@ -81,9 +81,9 @@
|
||||
//
|
||||
// buttonAdd
|
||||
//
|
||||
this.buttonAdd.Location = new System.Drawing.Point(31, 16);
|
||||
this.buttonAdd.Location = new System.Drawing.Point(31, 15);
|
||||
this.buttonAdd.Name = "buttonAdd";
|
||||
this.buttonAdd.Size = new System.Drawing.Size(126, 36);
|
||||
this.buttonAdd.Size = new System.Drawing.Size(126, 34);
|
||||
this.buttonAdd.TabIndex = 0;
|
||||
this.buttonAdd.Text = "Добавить";
|
||||
this.buttonAdd.UseVisualStyleBackColor = true;
|
||||
@ -94,19 +94,19 @@
|
||||
this.dataGridView.AllowUserToAddRows = false;
|
||||
this.dataGridView.AllowUserToDeleteRows = false;
|
||||
this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 12);
|
||||
this.dataGridView.Location = new System.Drawing.Point(12, 11);
|
||||
this.dataGridView.Name = "dataGridView";
|
||||
this.dataGridView.ReadOnly = true;
|
||||
this.dataGridView.RowHeadersWidth = 51;
|
||||
this.dataGridView.RowTemplate.Height = 29;
|
||||
this.dataGridView.Size = new System.Drawing.Size(590, 426);
|
||||
this.dataGridView.Size = new System.Drawing.Size(649, 415);
|
||||
this.dataGridView.TabIndex = 2;
|
||||
//
|
||||
// FormShops
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.ClientSize = new System.Drawing.Size(868, 429);
|
||||
this.Controls.Add(this.ToolsPanel);
|
||||
this.Controls.Add(this.dataGridView);
|
||||
this.Name = "FormShops";
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Pizzeria;
|
||||
using PizzeriaContracts.BindingModels;
|
||||
using PizzeriaContracts.BusinessLogicsContracts;
|
||||
using PizzeriaContracts.DI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@ -35,15 +36,7 @@ namespace PizzeriaView
|
||||
{
|
||||
try
|
||||
{
|
||||
var list = _logic.ReadList(null);
|
||||
if (list != null)
|
||||
{
|
||||
dataGridView.DataSource = list;
|
||||
dataGridView.Columns["Id"].Visible = false;
|
||||
dataGridView.Columns["ShopPizzas"].Visible = false;
|
||||
dataGridView.Columns["ShopName"].AutoSizeMode =
|
||||
DataGridViewAutoSizeColumnMode.Fill;
|
||||
}
|
||||
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
|
||||
_logger.LogInformation("Загрузка магазинов");
|
||||
}
|
||||
catch (Exception ex)
|
||||
@ -55,7 +48,7 @@ namespace PizzeriaView
|
||||
|
||||
private void ButtonAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
var service = DependencyManager.Instance.Resolve<FormShop>();
|
||||
if (service is FormShop form)
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
@ -69,7 +62,7 @@ namespace PizzeriaView
|
||||
{
|
||||
if (dataGridView.SelectedRows.Count == 1)
|
||||
{
|
||||
var service = Program.ServiceProvider?.GetService(typeof(FormShop));
|
||||
var service = DependencyManager.Instance.Resolve<FormShop>();
|
||||
if (service is FormShop form)
|
||||
{
|
||||
form.Id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["Id"].Value);
|
||||
|
@ -11,7 +11,6 @@ using PizzeriaView;
|
||||
using PizzeriaBusinessLogic.OfficePackage;
|
||||
using Microsoft.EntityFrameworkCore.Design;
|
||||
using PizzeriaContracts.DI;
|
||||
using PizzeriaBusinessLogic.OfficePackage.Implements;
|
||||
|
||||
namespace Pizzeria
|
||||
{
|
||||
@ -62,34 +61,6 @@ namespace Pizzeria
|
||||
option.AddNLog("nlog.config");
|
||||
});
|
||||
|
||||
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
||||
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
||||
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
||||
DependencyManager.Instance.RegisterType<IPizzaLogic, PizzaLogic>();
|
||||
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
||||
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
||||
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
||||
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
||||
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
||||
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IClientLogic, ClientLogic>();
|
||||
services.AddTransient<IShopStorage, ShopStorage>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IComponentLogic, ComponentLogic>();
|
||||
services.AddTransient<IImplementerLogic, ImplementerLogic>();
|
||||
services.AddTransient<IOrderLogic, OrderLogic>();
|
||||
services.AddTransient<IPizzaLogic, PizzaLogic>();
|
||||
services.AddTransient<IReportLogic, ReportLogic>();
|
||||
services.AddTransient<IMessageInfoLogic, MessageInfoLogic>();
|
||||
services.AddTransient<IWorkProcess, WorkModeling>();
|
||||
services.AddTransient<IShopLogic, ShopLogic>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<FormMain>();
|
||||
DependencyManager.Instance.RegisterType<FormComponent>();
|
||||
DependencyManager.Instance.RegisterType<FormComponents>();
|
||||
@ -103,27 +74,14 @@ namespace Pizzeria
|
||||
DependencyManager.Instance.RegisterType<FormImplementers>();
|
||||
DependencyManager.Instance.RegisterType<FormImplementer>();
|
||||
DependencyManager.Instance.RegisterType<FormMail>();
|
||||
services.AddTransient<FormComponent>();
|
||||
services.AddTransient<FormComponents>();
|
||||
services.AddTransient<FormCreateOrder>();
|
||||
services.AddTransient<FormPizza>();
|
||||
services.AddTransient<FormPizzaComponent>();
|
||||
services.AddTransient<FormPizzas>();
|
||||
services.AddTransient<FormShop>();
|
||||
services.AddTransient<FormShops>();
|
||||
services.AddTransient<FormCreateSupply>();
|
||||
services.AddTransient<FormSellPizza>();
|
||||
services.AddTransient<FormMain>();
|
||||
services.AddTransient<FormReportPizzaComponents>();
|
||||
services.AddTransient<FormReportOrders>();
|
||||
services.AddTransient<FormClients>();
|
||||
services.AddTransient<EntityFrameworkDesignServicesBuilder>();
|
||||
services.AddTransient<FormReportShop>();
|
||||
services.AddTransient<FormReportGroupedOrders>();
|
||||
services.AddTransient<FormImplementers>();
|
||||
services.AddTransient<FormImplementer>();
|
||||
services.AddTransient<FormMail>();
|
||||
services.AddTransient<FormLetter>();
|
||||
|
||||
DependencyManager.Instance.RegisterType<FormShop>();
|
||||
DependencyManager.Instance.RegisterType<FormShops>();
|
||||
DependencyManager.Instance.RegisterType<FormSellPizza>();
|
||||
DependencyManager.Instance.RegisterType<FormReportShop>();
|
||||
DependencyManager.Instance.RegisterType<FormReportGroupedOrders>();
|
||||
DependencyManager.Instance.RegisterType<FormLetter>();
|
||||
DependencyManager.Instance.RegisterType<FormCreateSupply>();
|
||||
}
|
||||
|
||||
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
||||
|
Loading…
Reference in New Issue
Block a user