2023-02-13 02:45:41 +04:00
|
|
|
|
using DressAtelierBusinessLogic.BusinessLogic;
|
2023-04-21 00:45:44 +04:00
|
|
|
|
using DressAtelierBusinessLogic.MailEmployee;
|
2023-03-26 22:22:12 +04:00
|
|
|
|
using DressAtelierBusinessLogic.OfficePackage;
|
|
|
|
|
using DressAtelierBusinessLogic.OfficePackage.Implements;
|
2023-04-21 00:45:44 +04:00
|
|
|
|
using DressAtelierContracts.BindingModels;
|
2023-02-13 02:45:41 +04:00
|
|
|
|
using DressAtelierContracts.BusinessLogicContracts;
|
2023-04-23 21:35:18 +04:00
|
|
|
|
using DressAtelierContracts.DI;
|
2023-02-13 02:45:41 +04:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NLog.Extensions.Logging;
|
|
|
|
|
|
2023-01-29 15:36:14 +04:00
|
|
|
|
namespace SewingDresses
|
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
2023-02-13 02:45:41 +04:00
|
|
|
|
|
2023-01-29 15:36:14 +04:00
|
|
|
|
/// <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();
|
2023-02-13 02:45:41 +04:00
|
|
|
|
var services = new ServiceCollection();
|
2023-04-23 21:35:18 +04:00
|
|
|
|
InitDependencies();
|
2023-04-21 00:45:44 +04:00
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
2023-04-23 21:35:18 +04:00
|
|
|
|
var mailSender = DependencyManager.Instance.Resolve<AbstractMailEmployee>();
|
2023-04-21 00:45:44 +04:00
|
|
|
|
mailSender?.MailConfig(new MailConfigBindingModel
|
|
|
|
|
{
|
|
|
|
|
Login = System.Configuration.ConfigurationManager.AppSettings["MailLogin"] ?? string.Empty,
|
|
|
|
|
Password = System.Configuration.ConfigurationManager.AppSettings["MailPassword"] ?? string.Empty,
|
|
|
|
|
SmtpClientHost = System.Configuration.ConfigurationManager.AppSettings["SmtpClientHost"] ?? string.Empty,
|
2023-04-22 19:35:25 +04:00
|
|
|
|
SmtpClientPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["SmtpClientPort"]),
|
2023-04-21 00:45:44 +04:00
|
|
|
|
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)
|
|
|
|
|
{
|
2023-04-23 21:35:18 +04:00
|
|
|
|
var logger = DependencyManager.Instance.Resolve<ILogger>();
|
2023-04-21 00:45:44 +04:00
|
|
|
|
logger?.LogError(ex, "Working with email error");
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
2023-01-29 15:36:14 +04:00
|
|
|
|
}
|
2023-02-13 02:45:41 +04:00
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
private static void InitDependencies()
|
2023-02-13 02:45:41 +04:00
|
|
|
|
{
|
2023-04-23 21:35:18 +04:00
|
|
|
|
DependencyManager.InitDependency();
|
|
|
|
|
|
|
|
|
|
DependencyManager.Instance.AddLogging(option =>
|
|
|
|
|
{
|
|
|
|
|
option.SetMinimumLevel(LogLevel.Information);
|
|
|
|
|
option.AddNLog("nlog.config");
|
2023-02-13 02:45:41 +04:00
|
|
|
|
});
|
2023-03-26 22:22:12 +04:00
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<IMaterialStorage, MaterialStorage>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IOrderStorage, OrderStorage>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IDressStorage, DressStorage>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IClientStorage, ClientStorage>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IEmployeeStorage, EmployeeStorage>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IMessageInfoStorage,MessageInfoStorage>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IBackupInfo, BackupInfo>();
|
|
|
|
|
|
|
|
|
|
DependencyManager.Instance.RegisterType<IMaterialLogic, MaterialLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IOrderLogic, OrderLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IDressLogic, DressLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IEmployeeLogic, EmployeeLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IBackupLogic, BackupLogic>();
|
2023-04-21 00:45:44 +04:00
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<IWorkImitation, WorkImitation>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractMailEmployee, MailKitEmployee>();
|
2023-03-26 22:22:12 +04:00
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
2023-03-26 22:22:12 +04:00
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
DependencyManager.Instance.RegisterType<FormMain>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormMaterial>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormMaterials>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormOrderCreation>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormDress>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormDressMaterial>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormDresses>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportDressMaterials>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormClients>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormEmployees>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormEmployee>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormEmails>();
|
2023-02-13 02:45:41 +04:00
|
|
|
|
}
|
|
|
|
|
|
2023-04-23 21:35:18 +04:00
|
|
|
|
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailEmployee>()?.MailCheck();
|
2023-04-21 00:45:44 +04:00
|
|
|
|
|
2023-01-29 15:36:14 +04:00
|
|
|
|
}
|
|
|
|
|
}
|