2024-06-23 12:07:01 +04:00
|
|
|
using System;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using NLog.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Contracts.StorageContracts;
|
|
|
|
using DatabaseImplement.Implements;
|
|
|
|
using Contracts.BusinessLogicContracts;
|
|
|
|
using BusinessLogic.BusinessLogic;
|
2024-06-24 18:53:31 +04:00
|
|
|
using BusinessLogic.OfficePackage.Implements;
|
|
|
|
using BusinessLogic.OfficePackage;
|
2024-06-24 19:26:39 +04:00
|
|
|
using System.Text;
|
2024-06-23 12:07:01 +04:00
|
|
|
|
2024-05-09 17:45:03 +04:00
|
|
|
namespace WinFormsApp
|
|
|
|
{
|
|
|
|
internal static class Program
|
|
|
|
{
|
2024-06-23 12:07:01 +04:00
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
2024-05-09 17:45:03 +04:00
|
|
|
/// <summary>
|
|
|
|
/// The main entry point for the application.
|
|
|
|
/// </summary>
|
|
|
|
[STAThread]
|
|
|
|
static void Main()
|
|
|
|
{
|
2024-06-24 19:26:39 +04:00
|
|
|
|
|
|
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
2024-05-09 17:45:03 +04:00
|
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
|
|
// see https://aka.ms/applicationconfiguration.
|
|
|
|
ApplicationConfiguration.Initialize();
|
2024-06-23 12:07:01 +04:00
|
|
|
var services = new ServiceCollection();
|
|
|
|
ConfigureServices(services);
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
|
|
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
|
|
}
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddLogging(option =>
|
|
|
|
{
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
});
|
|
|
|
services.AddTransient<ISupplyStorage, SupplyStorage>();
|
|
|
|
//services.AddTransient<ISupplyDocStorage, SupplyDocStorage>();
|
|
|
|
services.AddTransient<IProductStorage, ProductStorage>();
|
|
|
|
services.AddTransient<ISupplierStorage, SupplierStorage>();
|
2024-06-24 16:23:42 +04:00
|
|
|
services.AddTransient<IMediaFileStorage, MediaFileStorage>();
|
2024-06-23 12:07:01 +04:00
|
|
|
|
|
|
|
services.AddTransient<ISupplyLogic, SupplyLogic>();
|
|
|
|
services.AddTransient<ISupplierLogic, SupplierLogic>();
|
|
|
|
services.AddTransient<IProductLogic, ProductLogic>();
|
2024-06-24 16:23:42 +04:00
|
|
|
services.AddTransient<IMediaFileLogic, MediaFileLogic>();
|
2024-06-24 19:26:39 +04:00
|
|
|
services.AddTransient<IReportLogic, ReportLogic>();
|
2024-06-23 12:07:01 +04:00
|
|
|
|
2024-06-24 18:53:31 +04:00
|
|
|
services.AddTransient<AbstractSaveToPdf, SaveToPdf>();
|
2024-06-25 20:24:29 +04:00
|
|
|
services.AddTransient<AbstractSaveToPdfCheque, SaveToPdfCheque>();
|
2024-06-25 21:12:06 +04:00
|
|
|
services.AddTransient<AbstractSaveToPdfPricelist, SaveToPdfPricelist>();
|
2024-06-24 18:53:31 +04:00
|
|
|
|
2024-06-23 12:07:01 +04:00
|
|
|
services.AddTransient<FormMain>();
|
2024-06-23 14:01:09 +04:00
|
|
|
services.AddTransient<FormProducts>();
|
2024-06-23 17:04:26 +04:00
|
|
|
services.AddTransient<FormSuppliers>();
|
2024-06-23 23:07:41 +04:00
|
|
|
services.AddTransient<FormSupplier>();
|
2024-06-23 21:35:37 +04:00
|
|
|
services.AddTransient<FormSupply>();
|
|
|
|
services.AddTransient<FormSupplyProduct>();
|
2024-06-23 23:07:41 +04:00
|
|
|
services.AddTransient<FormSupplierProduct>();
|
2024-06-24 15:08:29 +04:00
|
|
|
services.AddTransient<FormMediaFiles>();
|
2024-06-25 13:37:33 +04:00
|
|
|
services.AddTransient<FormPreviewPDF>();
|
2024-06-25 18:32:16 +04:00
|
|
|
services.AddTransient<FormStatistics>();
|
2024-05-09 17:45:03 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|