2024-05-29 14:28:53 +04:00
|
|
|
using static System.Windows.Forms.DataFormats;
|
|
|
|
using System;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using HotelAbstractions.Logic;
|
|
|
|
using HotelDatabase.Implement;
|
2024-05-30 13:12:02 +04:00
|
|
|
using HotelMongoDB.StorageContracts;
|
|
|
|
using HotelMongoDB;
|
2024-05-29 14:28:53 +04:00
|
|
|
|
|
|
|
namespace HotelView
|
|
|
|
{
|
|
|
|
internal static class Program
|
|
|
|
{
|
|
|
|
private static ServiceProvider? _serviceProvider;
|
|
|
|
public static ServiceProvider? ServiceProvider => _serviceProvider;
|
|
|
|
|
2024-05-30 13:12:02 +04:00
|
|
|
public static bool isPostgreSQL = true;
|
|
|
|
|
2024-05-29 14:28:53 +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();
|
|
|
|
var services = new ServiceCollection();
|
|
|
|
ConfigureServices(services);
|
|
|
|
_serviceProvider = services.BuildServiceProvider();
|
|
|
|
Application.Run(_serviceProvider.GetRequiredService<FormMain>());
|
|
|
|
}
|
|
|
|
|
|
|
|
private static void ConfigureServices(ServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddTransient<IHotelLogic, HotelImplement>();
|
|
|
|
services.AddTransient<IRoomLogic, RoomImplement>();
|
|
|
|
services.AddTransient<IReservationLogic, ReservationImplement>();
|
|
|
|
services.AddTransient<IGuestLogic, GuestImplement>();
|
|
|
|
services.AddTransient<IServiceCheckLogic, ServiceCheckImplement>();
|
|
|
|
services.AddTransient<IServiceLogic, ServiceImplement>();
|
|
|
|
|
2024-05-30 13:12:02 +04:00
|
|
|
services.AddTransient<StorageModel, MongoDBImplement>();
|
|
|
|
|
2024-05-29 14:28:53 +04:00
|
|
|
services.AddTransient<FormMain>();
|
|
|
|
services.AddTransient<FormHotel>();
|
|
|
|
services.AddTransient<FormGuest>();
|
|
|
|
services.AddTransient<FormService>();
|
|
|
|
services.AddTransient<FormReservation>();
|
|
|
|
services.AddTransient<FormServiceCheck>();
|
|
|
|
services.AddTransient<FormRoom>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|