2024-05-06 20:38:44 +04:00
|
|
|
|
using AbstractLawFirmBusinessLogic.BusinessLogic;
|
2024-04-07 22:21:31 +04:00
|
|
|
|
using AbstractLawFirmBusinessLogic.OfficePackage.Implements;
|
|
|
|
|
using AbstractLawFirmBusinessLogic.OfficePackage;
|
2024-02-27 19:44:44 +04:00
|
|
|
|
using AbstractLawFirmContracts.BusinessLogicsContracts;
|
|
|
|
|
using AbstractLawFirmContracts.StoragesContracts;
|
2024-03-26 00:07:11 +04:00
|
|
|
|
using AbstractLawFirmDatabaseImplement.Implements;
|
2024-05-06 20:38:44 +04:00
|
|
|
|
using AbstractLawFirmBusinessLogic.MailWorker;
|
2024-02-11 18:24:54 +04:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
|
using NLog.Extensions.Logging;
|
2024-02-27 19:44:44 +04:00
|
|
|
|
using System;
|
2024-04-20 14:07:58 +04:00
|
|
|
|
using AbstractLawFirmDataBaseImplement.Implements;
|
2024-05-06 20:38:44 +04:00
|
|
|
|
using AbstractLawFirmBusinessLogic.MailWorker;
|
2024-05-22 00:37:34 +04:00
|
|
|
|
using AbstractLawFirmContracts.DI;
|
|
|
|
|
using DocumentFormat.OpenXml.Spreadsheet;
|
2024-05-06 20:38:44 +04:00
|
|
|
|
using AbstractLawFirmContracts.BindingModels;
|
2024-02-11 18:24:54 +04:00
|
|
|
|
|
2024-02-14 00:11:21 +04:00
|
|
|
|
namespace LawFirmView
|
2024-02-11 18:24:54 +04:00
|
|
|
|
{
|
|
|
|
|
internal static class Program
|
|
|
|
|
{
|
|
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
|
|
|
/// <summary>
|
2024-02-27 19:44:44 +04:00
|
|
|
|
/// The main entry point for the application.
|
2024-02-11 18:24:54 +04:00
|
|
|
|
/// </summary>
|
|
|
|
|
[STAThread]
|
|
|
|
|
static void Main()
|
|
|
|
|
{
|
2024-02-27 19:44:44 +04:00
|
|
|
|
// To customize application configuration such as set high DPI settings or default font,
|
|
|
|
|
// see https://aka.ms/applicationconfiguration.
|
2024-02-11 18:24:54 +04:00
|
|
|
|
ApplicationConfiguration.Initialize();
|
2024-05-22 00:37:34 +04:00
|
|
|
|
InitDependency();
|
2024-05-06 20:38:44 +04:00
|
|
|
|
try
|
|
|
|
|
{
|
2024-05-22 00:37:34 +04:00
|
|
|
|
var mailSender = DependencyManager.Instance.Resolve<AbstractMailWorker>();
|
2024-05-06 20:38:44 +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)
|
|
|
|
|
{
|
|
|
|
|
var logger = _serviceProvider.GetService<ILogger>();
|
2024-05-08 10:53:31 +04:00
|
|
|
|
logger?.LogError(ex, "Error");
|
2024-05-06 20:38:44 +04:00
|
|
|
|
}
|
|
|
|
|
|
2024-05-22 00:37:34 +04:00
|
|
|
|
Application.Run(DependencyManager.Instance.Resolve<FormMain>());
|
2024-05-06 20:38:44 +04:00
|
|
|
|
}
|
2024-05-22 00:37:34 +04:00
|
|
|
|
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<IDocumentLogic, DocumentLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IReportLogic, ReportLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IClientLogic, ClientLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IBackUpLogic, BackUpLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IImplementerLogic, ImplementerLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IMessageInfoLogic, MessageInfoLogic>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToWord, SaveToWord>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToExcel, SaveToExcel>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractSaveToPdf, SaveToPdf>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<IWorkProcess, WorkModeling>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<AbstractMailWorker, MailKitWorker>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormMain>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormComponent>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormComponents>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormCreateOrder>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormDocument>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormDocumentComponent>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormDocuments>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportDocumentComponents>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormReportOrders>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormClients>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<Исполнители>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormImplementer>();
|
|
|
|
|
DependencyManager.Instance.RegisterType<FormMail>();
|
2024-05-06 20:38:44 +04:00
|
|
|
|
}
|
2024-05-22 00:37:34 +04:00
|
|
|
|
private static void MailCheck(object obj) => DependencyManager.Instance.Resolve<AbstractMailWorker>()?.MailCheck();
|
|
|
|
|
|
|
|
|
|
|
2024-05-06 20:38:44 +04:00
|
|
|
|
}
|
2024-02-11 18:24:54 +04:00
|
|
|
|
}
|