using AutoTurnOver.DB;
using AutoTurnOver.Models;
using AutoTurnOver.Services;
using Bailun.ServiceFabric;
using Dapper;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ShortagePush;
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Linq;

namespace AutoGeneratePurchaseAdvise
{
    class Program
    {
        static async Task Main(string[] args)
        {
            Console.WriteLine("采购建议计算任务启动...");
            
            try
            {

            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine(ex.StackTrace);
            }
          
            var builder = new HostBuilder().ConfigureServices((hostContext, services) =>
                {
                    services.AddHostedService<GeneratePurchaseAdviseBackgroundService>();
                    services.AddHostedService<FirstBackgroundService>();
                });

            await builder.RunConsoleAsync();
        }
    }
}
