DepartmentProject/DepartmentPortal/WindowServices/WindowServiceSyncStudentOrders/Program.cs

37 lines
1.1 KiB
C#
Raw Normal View History

using CoreDatabase;
using DepartmentContract.Logics.IGenericEntityLogic;
using System;
using System.Threading.Tasks;
using ToolsModule.ManagmentDependency;
using ToolsModule.ManagmentSecurity;
namespace WindowServiceSyncStudentOrders
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Start sync student orders");
try
{
DependencyManager.Instance.RegisterType<ISecurityManager, SecurityManager>();
DependencyManager.InitDependency();
var logic = DependencyManager.Instance.Resolve<IOrderSyncHistoryLogic>();
var task = Task.Run(() => logic.SyncOrders());
Task.WaitAll(new Task[] { task });
if (task.Result)
{
Console.WriteLine("Student orders sync success");
}
else
{
Console.WriteLine("Student orders sync fail");
}
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
}
}