2024-04-03 10:30:37 +04:00
|
|
|
|
using GarmentFactoryBusinessLogic.BusinessLogics;
|
|
|
|
|
using GarmentFactoryBusinessLogic.OfficePackage.Implements;
|
|
|
|
|
using GarmentFactoryBusinessLogic.OfficePackage;
|
2024-03-06 09:21:43 +04:00
|
|
|
|
using GarmentFactoryContracts.BusinessLogicsContracts;
|
|
|
|
|
using GarmentFactoryContracts.StoragesContracts;
|
2024-03-20 10:21:07 +04:00
|
|
|
|
using GarmentFactoryDatabaseImplement.Implements;
|
2024-03-06 09:21:43 +04:00
|
|
|
|
using GarmentFactoryView;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NLog.Extensions.Logging;
|
2024-05-05 18:46:39 +04:00
|
|
|
|
using GarmentFactoryBusinessLogic.MailWorker;
|
|
|
|
|
using GarmentFactoryContracts.BindingModels;
|
2024-05-06 00:02:04 +04:00
|
|
|
|
using GarmentFactoryContracts.DependencyInjection;
|
2024-03-06 09:21:43 +04:00
|
|
|
|
|
2024-02-05 14:33:48 +04:00
|
|
|
|
namespace GarmentFactory
|
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The main entry point for the application.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
|
|
|
// see https://aka.ms/applicationconfiguration.
|
|
|
|
|
ApplicationConfiguration.Initialize();
|
2024-05-06 00:02:04 +04:00
|
|
|
|
InitDependency();
|
|
|
|
|
|
2024-05-05 18:46:39 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-05-06 00:02:04 +04:00
|
|
|
|
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
2024-05-05 18:46:39 +04:00
|
|
|
|
mailSender?.MailConfig(new MailConfigBindingModel
|
|
|
|
|
{
|
|
|
|
|
MailLogin = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
|
|
|
|
MailPassword = System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ?? string.Empty,
|
|
|
|
|
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ?? string.Empty,
|
|
|
|
|
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
|
|
|
|
PopHost = System.Configuration.ConfigurationManager.AppSettings["PopHost"] ?? string.Empty,
|
|
|
|
|
PopPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PopPort"])
|
|
|
|
|
});
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
var timer = new System.Threading.Timer(new TimerCallback(MailCheck!), null, 0, 100000);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2024-05-06 00:02:04 +04:00
|
|
|
|
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
2024-05-05 18:46:39 +04:00
|
|
|
|
logger?.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
|
|
|
|
|
2024-05-06 00:02:04 +04:00
|
|
|
|
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
2024-03-06 09:21:43 +04:00
|
|
|
|
}
|
2024-05-06 00:02:04 +04:00
|
|
|
|
|
|
|
|
|
private static void InitDependency()
|
2024-03-06 09:21:43 +04:00
|
|
|
|
{
|
2024-05-06 00:02:04 +04:00
|
|
|
|
DependencyManager.InitDependency();
|
|
|
|
|
DependencyManager.Instance.AddLogging(option =>
|
|
|
|
|
{
|
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
|
option.AddNLog("nlog.config");
|
|
|
|
|
});
|
|
|
|
|
DependencyManager.Instance.RegisterType<IComponentLogic, ComponentLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<ITextileLogic, TextileLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
2024-03-16 20:47:16 +04:00
|
|
|
|
|
2024-05-05 18:46:39 +04:00
|
|
|
|
|
2024-05-06 00:02:04 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
2024-04-03 10:30:37 +04:00
|
|
|
|
|
2024-05-06 00:02:04 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
|
|
|
|
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
2024-03-16 20:47:16 +04:00
|
|
|
|
|
2024-05-06 00:02:04 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<FormMain>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormComponent>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormComponents>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormTextile>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormTextileComponent>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormTextiles>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportTextileComponents>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormClients>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormImplementer>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormImplementers>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormMails>();
|
2024-04-17 10:42:00 +04:00
|
|
|
|
}
|
2024-05-06 00:02:04 +04:00
|
|
|
|
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
2024-05-05 18:46:39 +04:00
|
|
|
|
}
|
2024-02-05 14:33:48 +04:00
|
|
|
|
}
|