This commit is contained in:
Калышев Ян 2023-06-14 03:33:23 -07:00
parent b7261a5bde
commit d0f44687ad
23 changed files with 611 additions and 79 deletions

1
.gitignore vendored
View File

@ -399,3 +399,4 @@ FodyWeavers.xsd
*.sln.iml
ImplementationExtensions/
BusinessLogicImplementationExtensions/

View File

@ -21,6 +21,7 @@ namespace BlacksmithWorkshopListImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IManufactureStorage, ManufactureStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
}
}
}

View File

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

View File

@ -0,0 +1,36 @@
using BlacksmithWorkshopBusinessLogic.BusinessLogics;
using BlacksmithWorkshopBusinessLogic.MailWorker;
using BlacksmithWorkshopBusinessLogic.OfficePackage.Implements;
using BlacksmithWorkshopBusinessLogic.OfficePackage;
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopContracts.DI;
using ManufactureCompanyBusinessLogic.BusinessLogics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlacksmithWorkshopBusinessLogic
{
public class BusinessLogicImplementationExtension : IBusinessLogicImplementationExtension
{
public void RegisterServices()
{
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IShopLogic, ShopLogic>();
DependencyManager.Instance.RegisterType<IManufactureLogic, ManufactureLogic>();
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
}
}
}

View File

@ -14,13 +14,18 @@ namespace BlacksmithWorkshopContracts.Attributes
public int Width { get; private set; }
public GridViewAutoSize GridViewAutoSize { get; private set; }
public bool IsUseAutoSize { get; private set; }
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None, bool isUseAutoSize = false)
public bool FormattedDate { get; private set; }
public bool FormattedNumber { get; private set; }
public ColumnAttribute(string title = "", bool visible = true, int width = 0, GridViewAutoSize gridViewAutoSize = GridViewAutoSize.None,
bool isUseAutoSize = false, bool formattedDate = false, bool formattedNumber = false)
{
Title = title;
Visible = visible;
Width = width;
GridViewAutoSize = gridViewAutoSize;
IsUseAutoSize = isUseAutoSize;
FormattedDate = formattedDate;
FormattedNumber = formattedNumber;
}
}
}

View File

@ -31,6 +31,14 @@ namespace BlacksmithWorkshopContracts.DI
}
// регистрируем зависимости
ext.RegisterServices();
var bsExtensions = ServiceProviderLoader.GetBusinessLogicImplementationExtensions();
if (bsExtensions == null)
{
throw new ArgumentNullException("Отсутствуют компоненты для загрузки зависимостей бизнес-логики");
}
// регистрируем зависимости
bsExtensions.RegisterServices();
}
/// <summary>
/// Регистрация логгера

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BlacksmithWorkshopContracts.DI
{
public interface IBusinessLogicImplementationExtension
{
/// <summary>
/// Регистрация сервисов бизнес-логики
/// </summary>
public void RegisterServices();
}
}

View File

@ -50,5 +50,36 @@ namespace BlacksmithWorkshopContracts.DI
}
return $"{directory?.FullName}\\ImplementationExtensions";
}
/// <summary>
/// Загрузка всех классов-реализаций IBusinessLogicImplementationExtension
/// </summary>
/// <returns></returns>
public static IBusinessLogicImplementationExtension? GetBusinessLogicImplementationExtensions()
{
IBusinessLogicImplementationExtension? source = null;
var files = Directory.GetFiles(TryGetBusinessLogicImplementationExtensionsFolder(), "*.dll", SearchOption.AllDirectories);
foreach (var file in files.Distinct())
{
Assembly asm = Assembly.LoadFrom(file);
foreach (var t in asm.GetExportedTypes())
{
if (t.IsClass && typeof(IBusinessLogicImplementationExtension).IsAssignableFrom(t))
{
source = (IBusinessLogicImplementationExtension)Activator.CreateInstance(t)!;
break;
}
}
}
return source;
}
private static string TryGetBusinessLogicImplementationExtensionsFolder()
{
var directory = new DirectoryInfo(Directory.GetCurrentDirectory());
while (directory != null && !directory.GetDirectories("BusinessLogicImplementationExtensions", SearchOption.AllDirectories).Any(x => x.Name == "BusinessLogicImplementationExtensions"))
{
directory = directory.Parent;
}
return $"{directory?.FullName}\\BusinessLogicImplementationExtensions";
}
}
}

View File

@ -17,7 +17,7 @@ namespace BlacksmithWorkshopContracts.ViewModels
public int? ClientId { get; set; }
[Column(title: "Отправитель", width: 150)]
public string SenderName { get; set; } = string.Empty;
[Column(title: "Дата письма", width: 150)]
[Column(title: "Дата письма", width: 150, formattedDate: true)]
public DateTime DateDelivery { get; set; }
[Column(title: "Заголовок", width: 150)]
public string Subject { get; set; } = string.Empty;

View File

@ -33,9 +33,9 @@ namespace BlacksmithWorkshopContracts.ViewModels
public double Sum { get; set; }
[Column(title: "Статус", width: 150)]
public OrderStatus Status { get; set; } = OrderStatus.Неизвестен;
[Column(title: "Дата создания", width: 150)]
[Column(title: "Дата создания", width: 150, formattedDate: true)]
public DateTime DateCreate { get; set; } = DateTime.Now;
[Column(title: "Дата выполнения", width: 150)]
[Column(title: "Дата выполнения", width: 150, formattedDate: true)]
public DateTime? DateImplement { get; set; }
}
}

View File

@ -4,23 +4,24 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BlacksmithWorkshopContracts.Attributes;
using BlacksmithWorkshopDataModels.Models;
namespace BlacksmithWorkshopContracts.ViewModels
{
public class ShopViewModel : IShopModel
{
[Column(visible: false)]
public int Id { get; set; }
[DisplayName("Название магазина")]
[Column(title: "Название магазина", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string ShopName { get; set; } = string.Empty;
[DisplayName("Адрес магазина")]
[Column(title: "Адрес магазина", gridViewAutoSize: GridViewAutoSize.Fill, isUseAutoSize: true)]
public string Address { get; set; } = string.Empty;
[DisplayName("Дата открытия")]
[Column(title: "Дата открытия", width: 150, formattedDate: true)]
public DateTime DateOpening { get; set; } = DateTime.Now;
[DisplayName("Вместимость магазина")]
[Column(title: "Вместимость магазина", width: 100)]
public int Capacity { get; set; }
[Column(visible: false)]
public Dictionary<int, (IManufactureModel, int)> ListManufacture
{
get;

View File

@ -21,6 +21,7 @@ namespace BlacksmithWorkshopDatabaseImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IManufactureStorage, ManufactureStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
}
}
}

View File

@ -0,0 +1,379 @@
// <auto-generated />
using System;
using BlacksmithWorkshopDatabaseImplement;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace BlacksmithWorkshopDatabaseImplement.Migrations
{
[DbContext(typeof(BlacksmithWorkshopDatabase))]
[Migration("20230614100035_Init")]
partial class Init
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "7.0.5")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder);
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ClientFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Email")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Clients");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ComponentName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Cost")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Components");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Implementer", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ImplementerFIO")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Password")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Qualification")
.HasColumnType("int");
b.Property<int>("WorkExperience")
.HasColumnType("int");
b.HasKey("Id");
b.ToTable("Implementers");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("ManufactureName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<double>("Price")
.HasColumnType("float");
b.HasKey("Id");
b.ToTable("Manufactures");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ManufactureComponent", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ComponentId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ManufactureId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ComponentId");
b.HasIndex("ManufactureId");
b.ToTable("ManufactureComponents");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.MessageInfo", b =>
{
b.Property<string>("MessageId")
.HasColumnType("nvarchar(450)");
b.Property<string>("Body")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int?>("ClientId")
.HasColumnType("int");
b.Property<DateTime>("DateDelivery")
.HasColumnType("datetime2");
b.Property<bool>("IsRead")
.HasColumnType("bit");
b.Property<string>("ReplyText")
.HasColumnType("nvarchar(max)");
b.Property<string>("SenderName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<string>("Subject")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("MessageId");
b.HasIndex("ClientId");
b.ToTable("MessageInfos");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("ClientId")
.HasColumnType("int");
b.Property<int>("Count")
.HasColumnType("int");
b.Property<DateTime>("DateCreate")
.HasColumnType("datetime2");
b.Property<DateTime?>("DateImplement")
.HasColumnType("datetime2");
b.Property<int?>("ImplementerId")
.HasColumnType("int");
b.Property<int>("ManufactureId")
.HasColumnType("int");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<double>("Sum")
.HasColumnType("float");
b.HasKey("Id");
b.HasIndex("ClientId");
b.HasIndex("ImplementerId");
b.HasIndex("ManufactureId");
b.ToTable("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<string>("Address")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.Property<int>("Capacity")
.HasColumnType("int");
b.Property<DateTime>("DateOpening")
.HasColumnType("datetime2");
b.Property<string>("ShopName")
.IsRequired()
.HasColumnType("nvarchar(max)");
b.HasKey("Id");
b.ToTable("Shops");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ShopManufacture", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("Id"));
b.Property<int>("Count")
.HasColumnType("int");
b.Property<int>("ManufactureId")
.HasColumnType("int");
b.Property<int>("ShopId")
.HasColumnType("int");
b.HasKey("Id");
b.HasIndex("ManufactureId");
b.HasIndex("ShopId");
b.ToTable("ListManufacture");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ManufactureComponent", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Component", "Component")
.WithMany("ManufactureComponents")
.HasForeignKey("ComponentId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("Components")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Component");
b.Navigation("Manufacture");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.MessageInfo", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
.WithMany()
.HasForeignKey("ClientId");
b.Navigation("Client");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Order", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Client", "Client")
.WithMany("Orders")
.HasForeignKey("ClientId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Implementer", "Implementer")
.WithMany("Orders")
.HasForeignKey("ImplementerId");
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany("Orders")
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Client");
b.Navigation("Implementer");
b.Navigation("Manufacture");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.ShopManufacture", b =>
{
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", "Manufacture")
.WithMany()
.HasForeignKey("ManufactureId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("BlacksmithWorkshopDatabaseImplement.Models.Shop", "Shop")
.WithMany("Manufactures")
.HasForeignKey("ShopId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Manufacture");
b.Navigation("Shop");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Client", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Component", b =>
{
b.Navigation("ManufactureComponents");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Implementer", b =>
{
b.Navigation("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Manufacture", b =>
{
b.Navigation("Components");
b.Navigation("Orders");
});
modelBuilder.Entity("BlacksmithWorkshopDatabaseImplement.Models.Shop", b =>
{
b.Navigation("Manufactures");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -21,6 +21,7 @@ namespace BlacksmithWorkshopFileImplement
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
DependencyManager.Instance.RegisterType<IManufactureStorage, ManufactureStorage>();
DependencyManager.Instance.RegisterType<IBackUpInfo, BackUpInfo>();
DependencyManager.Instance.RegisterType<IShopStorage, ShopStorage>();
}
}
}

View File

@ -44,6 +44,14 @@ namespace BlacksmithWorkshopView
{
column.Width = columnAttr.Width;
}
if (columnAttr.FormattedDate && (column.ValueType == typeof(DateTime) || column.ValueType == typeof(DateTime?)))
{
column.DefaultCellStyle.Format = "dd MMMM, yy HH:mm:ss";
}
if (columnAttr.FormattedNumber && column.ValueType == typeof(double))
{
column.DefaultCellStyle.Format = "N2";
}
}
}
}

View File

@ -51,7 +51,6 @@
buttonRef = new Button();
buttonAddManufactureInShop = new Button();
buttonSellManufacture = new Button();
messagesToolStripMenuItem = new ToolStripMenuItem();
menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)dataGridView).BeginInit();
SuspendLayout();
@ -62,8 +61,8 @@
menuStrip1.Items.AddRange(new ToolStripItem[] { guideToolStripMenuItem, отчетыToolStripMenuItem, workToolStripMenuItem, messagesToolStripMenuItem, backupToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new Padding(6, 3, 0, 3);
menuStrip1.Size = new Size(1470, 30);
menuStrip1.Padding = new Padding(5, 2, 0, 2);
menuStrip1.Size = new Size(1286, 24);
menuStrip1.TabIndex = 0;
menuStrip1.Text = "menuStrip1";
//
@ -71,41 +70,41 @@
//
guideToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentsToolStripMenuItem, goodsToolStripMenuItem, ShopsToolStripMenuItem, clientsToolStripMenuItem, implemntersToolStripMenuItem });
guideToolStripMenuItem.Name = "guideToolStripMenuItem";
guideToolStripMenuItem.Size = new Size(108, 24);
guideToolStripMenuItem.Size = new Size(87, 20);
guideToolStripMenuItem.Text = "Справочник";
//
// componentsToolStripMenuItem
//
componentsToolStripMenuItem.Name = "componentsToolStripMenuItem";
componentsToolStripMenuItem.Size = new Size(185, 26);
componentsToolStripMenuItem.Size = new Size(149, 22);
componentsToolStripMenuItem.Text = "Компоненты";
componentsToolStripMenuItem.Click += ComponentsToolStripMenuItem_Click;
//
// goodsToolStripMenuItem
//
goodsToolStripMenuItem.Name = "goodsToolStripMenuItem";
goodsToolStripMenuItem.Size = new Size(185, 26);
goodsToolStripMenuItem.Size = new Size(149, 22);
goodsToolStripMenuItem.Text = "Изделия";
goodsToolStripMenuItem.Click += GoodsToolStripMenuItem_Click;
//
// ShopsToolStripMenuItem
//
ShopsToolStripMenuItem.Name = "ShopsToolStripMenuItem";
ShopsToolStripMenuItem.Size = new Size(185, 26);
ShopsToolStripMenuItem.Size = new Size(149, 22);
ShopsToolStripMenuItem.Text = "Магазины";
ShopsToolStripMenuItem.Click += ShopsToolStripMenuItem_Click;
//
// clientsToolStripMenuItem
//
clientsToolStripMenuItem.Name = "clientsToolStripMenuItem";
clientsToolStripMenuItem.Size = new Size(185, 26);
clientsToolStripMenuItem.Size = new Size(149, 22);
clientsToolStripMenuItem.Text = "Клиенты";
clientsToolStripMenuItem.Click += ClientsToolStripMenuItem_Click;
//
// implemntersToolStripMenuItem
//
implemntersToolStripMenuItem.Name = "implemntersToolStripMenuItem";
implemntersToolStripMenuItem.Size = new Size(185, 26);
implemntersToolStripMenuItem.Size = new Size(149, 22);
implemntersToolStripMenuItem.Text = "Исполнители";
implemntersToolStripMenuItem.Click += ImplemntersToolStripMenuItem_Click;
//
@ -113,69 +112,69 @@
//
отчетыToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { componentListToolStripMenuItem, componentsManufactureToolStripMenuItem, orderListToolStripMenuItem, shopListToolStripMenuItem, shopsCapacityToolStripMenuItem, ordersByDateToolStripMenuItem });
отчетыToolStripMenuItem.Name = "отчетыToolStripMenuItem";
отчетыToolStripMenuItem.Size = new Size(73, 24);
отчетыToolStripMenuItem.Size = new Size(60, 20);
отчетыToolStripMenuItem.Text = "Отчеты";
//
// componentListToolStripMenuItem
//
componentListToolStripMenuItem.Name = "componentListToolStripMenuItem";
componentListToolStripMenuItem.Size = new Size(276, 26);
componentListToolStripMenuItem.Size = new Size(219, 22);
componentListToolStripMenuItem.Text = "Список коспонентов";
componentListToolStripMenuItem.Click += ComponentListToolStripMenuItem_Click;
//
// componentsManufactureToolStripMenuItem
//
componentsManufactureToolStripMenuItem.Name = "componentsManufactureToolStripMenuItem";
componentsManufactureToolStripMenuItem.Size = new Size(276, 26);
componentsManufactureToolStripMenuItem.Size = new Size(219, 22);
componentsManufactureToolStripMenuItem.Text = "Компоненты по изделиям";
componentsManufactureToolStripMenuItem.Click += ComponentManufacturesToolStripMenuItem_Click;
//
// orderListToolStripMenuItem
//
orderListToolStripMenuItem.Name = "orderListToolStripMenuItem";
orderListToolStripMenuItem.Size = new Size(276, 26);
orderListToolStripMenuItem.Size = new Size(219, 22);
orderListToolStripMenuItem.Text = "Список заказов";
orderListToolStripMenuItem.Click += OrderListToolStripMenuItem_Click;
//
// shopListToolStripMenuItem
//
shopListToolStripMenuItem.Name = "shopListToolStripMenuItem";
shopListToolStripMenuItem.Size = new Size(276, 26);
shopListToolStripMenuItem.Size = new Size(219, 22);
shopListToolStripMenuItem.Text = "Список магазинов";
shopListToolStripMenuItem.Click += ShopsListToolStripMenuItem_Click;
//
// shopsCapacityToolStripMenuItem
//
shopsCapacityToolStripMenuItem.Name = "shopsCapacityToolStripMenuItem";
shopsCapacityToolStripMenuItem.Size = new Size(276, 26);
shopsCapacityToolStripMenuItem.Size = new Size(219, 22);
shopsCapacityToolStripMenuItem.Text = "Загруженность магазинов";
shopsCapacityToolStripMenuItem.Click += ShopsCapacityStripMenuItem_Click;
//
// ordersByDateToolStripMenuItem
//
ordersByDateToolStripMenuItem.Name = "ordersByDateToolStripMenuItem";
ordersByDateToolStripMenuItem.Size = new Size(276, 26);
ordersByDateToolStripMenuItem.Size = new Size(219, 22);
ordersByDateToolStripMenuItem.Text = "Заказы по датам";
ordersByDateToolStripMenuItem.Click += OrdersByDateToolStripMenuItem_Click;
//
// workToolStripMenuItem
//
workToolStripMenuItem.Name = "workToolStripMenuItem";
workToolStripMenuItem.Size = new Size(114, 24);
workToolStripMenuItem.Size = new Size(92, 20);
workToolStripMenuItem.Text = "Запуск работ";
workToolStripMenuItem.Click += WorkStartToolStripMenuItem_Click;
//
// messagesToolStripMenuItem
//
messagesToolStripMenuItem.Name = "messagesToolStripMenuItem";
messagesToolStripMenuItem.Size = new Size(77, 24);
messagesToolStripMenuItem.Size = new Size(62, 20);
messagesToolStripMenuItem.Text = "Письма";
messagesToolStripMenuItem.Click += messagesToolStripMenuItem_Click;
//
// backupToolStripMenuItem
//
backupToolStripMenuItem.Name = "backupToolStripMenuItem";
backupToolStripMenuItem.Size = new Size(122, 24);
backupToolStripMenuItem.Size = new Size(97, 20);
backupToolStripMenuItem.Text = "Создать бэкап";
backupToolStripMenuItem.Click += backupToolStripMenuItem_Click;
//
@ -185,20 +184,22 @@
dataGridView.AllowUserToDeleteRows = false;
dataGridView.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Location = new Point(11, 31);
dataGridView.Location = new Point(10, 23);
dataGridView.Margin = new Padding(3, 2, 3, 2);
dataGridView.Name = "dataGridView";
dataGridView.ReadOnly = true;
dataGridView.RowHeadersWidth = 51;
dataGridView.RowTemplate.Height = 29;
dataGridView.Size = new Size(1149, 381);
dataGridView.Size = new Size(1005, 286);
dataGridView.TabIndex = 1;
//
// buttonCreateOrder
//
buttonCreateOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonCreateOrder.Location = new Point(1183, 71);
buttonCreateOrder.Location = new Point(1035, 53);
buttonCreateOrder.Margin = new Padding(3, 2, 3, 2);
buttonCreateOrder.Name = "buttonCreateOrder";
buttonCreateOrder.Size = new Size(247, 29);
buttonCreateOrder.Size = new Size(216, 22);
buttonCreateOrder.TabIndex = 2;
buttonCreateOrder.Text = "Создать заказ";
buttonCreateOrder.UseVisualStyleBackColor = true;
@ -207,9 +208,10 @@
// buttonIssuedOrder
//
buttonIssuedOrder.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonIssuedOrder.Location = new Point(1183, 127);
buttonIssuedOrder.Location = new Point(1035, 95);
buttonIssuedOrder.Margin = new Padding(3, 2, 3, 2);
buttonIssuedOrder.Name = "buttonIssuedOrder";
buttonIssuedOrder.Size = new Size(247, 29);
buttonIssuedOrder.Size = new Size(216, 22);
buttonIssuedOrder.TabIndex = 5;
buttonIssuedOrder.Text = "Заказ выдан";
buttonIssuedOrder.UseVisualStyleBackColor = true;
@ -218,9 +220,10 @@
// buttonRef
//
buttonRef.Anchor = AnchorStyles.Top | AnchorStyles.Right;
buttonRef.Location = new Point(1183, 181);
buttonRef.Location = new Point(1035, 136);
buttonRef.Margin = new Padding(3, 2, 3, 2);
buttonRef.Name = "buttonRef";
buttonRef.Size = new Size(247, 29);
buttonRef.Size = new Size(216, 22);
buttonRef.TabIndex = 6;
buttonRef.Text = "Обновить список";
buttonRef.UseVisualStyleBackColor = true;
@ -228,10 +231,9 @@
//
// buttonAddManufactureInShop
//
buttonAddManufactureInShop.Location = new Point(1026, 231);
buttonAddManufactureInShop.Margin = new Padding(3, 4, 3, 4);
buttonAddManufactureInShop.Location = new Point(1035, 186);
buttonAddManufactureInShop.Name = "buttonAddManufactureInShop";
buttonAddManufactureInShop.Size = new Size(247, 29);
buttonAddManufactureInShop.Size = new Size(216, 22);
buttonAddManufactureInShop.TabIndex = 7;
buttonAddManufactureInShop.Text = "Пополнение магазина";
buttonAddManufactureInShop.UseVisualStyleBackColor = true;
@ -239,27 +241,19 @@
//
// buttonSellManufacture
//
buttonSellManufacture.Location = new Point(1026, 285);
buttonSellManufacture.Margin = new Padding(3, 4, 3, 4);
buttonSellManufacture.Location = new Point(1035, 214);
buttonSellManufacture.Name = "buttonSellManufacture";
buttonSellManufacture.Size = new Size(247, 31);
buttonSellManufacture.Size = new Size(216, 23);
buttonSellManufacture.TabIndex = 8;
buttonSellManufacture.Text = "Продать изделие";
buttonSellManufacture.UseVisualStyleBackColor = true;
buttonSellManufacture.Click += ButtonSellManufacture_Click;
//
// messagesToolStripMenuItem
//
messagesToolStripMenuItem.Name = "messagesToolStripMenuItem";
messagesToolStripMenuItem.Size = new Size(77, 24);
messagesToolStripMenuItem.Text = "Письма";
messagesToolStripMenuItem.Click += messagesToolStripMenuItem_Click;
//
// FormMain
//
AutoScaleDimensions = new SizeF(8F, 20F);
AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(1470, 425);
ClientSize = new Size(1286, 319);
Controls.Add(buttonRef);
Controls.Add(buttonIssuedOrder);
Controls.Add(buttonCreateOrder);
@ -268,6 +262,7 @@
Controls.Add(dataGridView);
Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1;
Margin = new Padding(3, 2, 3, 2);
Name = "FormMain";
Text = "Кузнечная мастерская";
Load += FormMain_Load;

View File

@ -133,7 +133,7 @@ namespace BlacksmithWorkshopView
}
private void buttonAddManufactureInShop_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShopManufacture));
var service = DependencyManager.Instance.Resolve<FormShopManufacture>();
if (service is FormShopManufacture form)
{
form.ShowDialog();
@ -141,7 +141,7 @@ namespace BlacksmithWorkshopView
}
private void ShopsToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormShops));
var service = DependencyManager.Instance.Resolve<FormShops>();
if (service is FormShops form)
{
form.ShowDialog();
@ -149,7 +149,7 @@ namespace BlacksmithWorkshopView
}
private void ButtonSellManufacture_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormSellManufacture));
var service = DependencyManager.Instance.Resolve<FormSellManufacture>();
if (service is FormSellManufacture form)
{
form.ShowDialog();
@ -167,7 +167,7 @@ namespace BlacksmithWorkshopView
}
private void ShopsCapacityStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportShopManufactures));
var service = DependencyManager.Instance.Resolve<FormReportShopManufactures>();
if (service is FormReportShopManufactures form)
{
form.ShowDialog();
@ -175,7 +175,7 @@ namespace BlacksmithWorkshopView
}
private void OrdersByDateToolStripMenuItem_Click(object sender, EventArgs e)
{
var service = Program.ServiceProvider?.GetService(typeof(FormReportOrdersByDate));
var service = DependencyManager.Instance.Resolve<FormReportOrdersByDate>();
if (service is FormReportOrdersByDate form)
{
form.ShowDialog();

View File

@ -1,4 +1,64 @@
<root>
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">

View File

@ -1,4 +1,5 @@
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopContracts.DI;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
@ -59,7 +60,7 @@ namespace BlacksmithWorkshopView
{
if (dataGridView.SelectedRows.Count == 1)
{
var service = Program.ServiceProvider?.GetService(typeof(FormMessage));
var service = DependencyManager.Instance.Resolve<FormMessage>();
if (service is FormMessage form)
{
form.Id = dataGridView.SelectedRows[0].Cells["MessageId"].Value.ToString();

View File

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using BlacksmithWorkshopContracts.BindingModels;
using BlacksmithWorkshopContracts.BusinessLogicsContracts;
using BlacksmithWorkshopContracts.DI;
namespace BlacksmithWorkshopView
{
@ -31,14 +32,7 @@ namespace BlacksmithWorkshopView
{
try
{
var list = _logic.ReadList(null);
if (list != null)
{
dataGridView.DataSource = list;
dataGridView.Columns["Id"].Visible = false;
dataGridView.Columns["ListManufacture"].Visible = false;
dataGridView.Columns["ShopName"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;
}
dataGridView.FillAndConfigGrid(_logic.ReadList(null));
_logger.LogInformation("Загрузка магазинов");
}
catch (Exception ex)
@ -49,7 +43,7 @@ namespace BlacksmithWorkshopView
}
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)
@ -62,7 +56,7 @@ namespace BlacksmithWorkshopView
{
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);

View File

@ -59,15 +59,6 @@ namespace BlacksmithWorkshopView
option.AddNLog("nlog.config");
});
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
DependencyManager.Instance.RegisterType<IManufactureLogic, ManufactureLogic>();
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
DependencyManager.Instance.RegisterType<IShopLogic, ShopLogic>();
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();