2024-02-06 12:37:25 +04:00
|
|
|
|
using GiftShopBusinessLogic.BusinessLogics;
|
2024-04-07 10:17:23 +04:00
|
|
|
|
using GiftShopBusinessLogic.OfficePackage.Implements;
|
|
|
|
|
using GiftShopBusinessLogic.OfficePackage;
|
2024-02-06 12:37:25 +04:00
|
|
|
|
using GiftShopContracts.BusinessLogicsContracts;
|
|
|
|
|
using GiftShopContracts.StoragesContracts;
|
2024-04-07 10:15:40 +04:00
|
|
|
|
using GiftShopDatabaseImplement.Implements;
|
2024-02-06 12:37:25 +04:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NLog.Extensions.Logging;
|
2024-05-16 10:17:58 +04:00
|
|
|
|
using GiftShopBusinessLogic.MailWorker;
|
|
|
|
|
using GiftShopContracts.BindingModels;
|
2024-05-17 13:28:57 +04:00
|
|
|
|
using GiftShopContracts.DI;
|
2024-02-06 12:37:25 +04:00
|
|
|
|
|
|
|
|
|
namespace GiftShopView
|
|
|
|
|
{
|
2024-05-17 13:28:57 +04:00
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
|
|
|
|
ApplicationConfiguration.Initialize();
|
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
|
InitDependency();
|
2024-05-16 10:17:58 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-05-17 13:28:57 +04:00
|
|
|
|
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
2024-05-16 10:17:58 +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"])
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var timer = new System.Threading.Timer(new TimerCallback(MailCheck!), null, 0, 100000);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
2024-05-17 13:28:57 +04:00
|
|
|
|
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
2024-05-16 10:17:58 +04:00
|
|
|
|
logger?.LogError(ex, "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
|
|
|
|
|
}
|
2024-05-17 13:28:57 +04:00
|
|
|
|
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void InitDependency()
|
|
|
|
|
{
|
|
|
|
|
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<IGiftLogic, GiftLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
2024-02-06 12:37:25 +04:00
|
|
|
|
|
2024-05-17 13:28:57 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
2024-05-16 10:17:58 +04:00
|
|
|
|
|
2024-05-17 13:28:57 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>(true);
|
2024-05-16 10:17:58 +04:00
|
|
|
|
|
2024-04-07 10:17:23 +04:00
|
|
|
|
|
2024-05-17 13:28:57 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<FormMain>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormComponent>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormComponents>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormGift>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormGiftComponent>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormGifts>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportGiftComponents>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormClients>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormImplementer>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormImplementers>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormMails>();
|
2024-05-16 10:17:58 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-17 13:28:57 +04:00
|
|
|
|
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
2024-05-16 10:17:58 +04:00
|
|
|
|
}
|
2024-02-06 12:37:25 +04:00
|
|
|
|
}
|