Ejemplo n.º 1
0
        public TransactionDependency(TransactionSyncService trtSyncSvc, IStoreDataProvider storeProvider)
        {
            _trtSyncSvc = trtSyncSvc;
            var connectionString = ConfigurationManager.AppSettings["DATA.CONNECTIONSTRING"];
            var providerName     = ConfigurationManager.AppSettings["DATA.PROVIDER"];

            _storeProvider = storeProvider;

            var mapper = new ModelToTableMapper <OrderDetailDto>();

            mapper.AddMapping(c => c.OrderDetailUId, "OrderDetailUId");
            mapper.AddMapping(c => c.Order_UId, "Order_UId");
            //mapper.AddMapping(c => c.Product_Id, "Product_Id");
            //mapper.AddMapping(c => c.CostPrice, "CostPrice");
            //mapper.AddMapping(c => c.Discount, "Discount");
            //mapper.AddMapping(c => c.Price, "Price");
            //mapper.AddMapping(c => c.Quantiy, "Quantiy");
            //mapper.AddMapping(c => c.EntryDate, "EntryDate");

            tableDependency = new SqlTableDependency <OrderDetailDto>(connectionString, "[dbo].[OrderDetails]", mapper);
            tableDependency.TraceListener = new TextWriterTraceListener(Console.Out);
            tableDependency.OnChanged    += tableDependency_OnChanged;
            tableDependency.OnError      += tableDependency_OnError;
            tableDependency.TraceListener = new TextWriterTraceListener(File.Create("c:\\Iposlogs\\transactionlogoutput.txt"));
        }
Ejemplo n.º 2
0
 public ProcessFreshTransactionWorkflow(TransactionSyncService trtSyncSvc,
                                        IStoreDataProvider storeDataProvider, ISyncStoreDataProvider syncStoreProvider)
 {
     _trtSyncSvc        = trtSyncSvc;
     _storeDataProvider = storeDataProvider;
     _syncStoreProvider = syncStoreProvider;
 }
Ejemplo n.º 3
0
        public SpoilDependency(SpoilSyncService spoilSyncSvc, IStoreDataProvider storeProvider)
        {
            _spoilSyncSvc = spoilSyncSvc;
            var connectionString = ConfigurationManager.AppSettings["DATA.CONNECTIONSTRING"];
            var providerName     = ConfigurationManager.AppSettings["DATA.PROVIDER"];

            _storeProvider = storeProvider;

            var mapper = new ModelToTableMapper <SpoilDto>();

            mapper.AddMapping(c => c.StockRefNo, "Product_Id");

            tableDependency = new SqlTableDependency <SpoilDto>(connectionString, "[dbo].[Spoil]", mapper);
            tableDependency.TraceListener = new TextWriterTraceListener(Console.Out);
            tableDependency.OnChanged    += tableDependency_OnChanged;
            tableDependency.OnError      += tableDependency_OnError;
            tableDependency.TraceListener = new TextWriterTraceListener(File.Create("c:\\Iposlogs\\spoil-log-output.txt"));
        }
Ejemplo n.º 4
0
 public IposSyncService(TransactionSyncService trtSyncSvc, SpoilSyncService spoilSync, IStoreDataProvider storeProvider)
 {
     _trtDependency   = new TransactionDependency(trtSyncSvc, storeProvider);
     _spoilDependency = new SpoilDependency(spoilSync, storeProvider);
 }
Ejemplo n.º 5
0
 public ProcessSpoilWorkflow(IStoreDataProvider storeDataProvider, SpoilSyncService spoilSyncSvc, ISyncStoreDataProvider syncStoreProvider)
 {
     _spoilSyncSvc      = spoilSyncSvc;
     _storeDataProvider = storeDataProvider;
     _syncStoreProvider = syncStoreProvider;
 }
Ejemplo n.º 6
0
        public static void Run(TransactionSyncService transSvc, SpoilSyncService spoilSvc, IStoreDataProvider storeDataProvider)
        {
            HostFactory.Run(x =>
            {
                //x.DependsOnMsSql();
                x.UseSerilog();

                x.SetStartTimeout(TimeSpan.FromSeconds(60));

                x.Service <IposSyncService>(s =>
                {
                    s.ConstructUsing(name => new IposSyncService(transSvc, spoilSvc, storeDataProvider)); //3
                    s.WhenStarted(tc => tc.Start());                                                      //4
                    s.WhenStopped(tc => tc.Stop());
                });

                x.EnableServiceRecovery(recoveryOption =>
                {
                    recoveryOption.RestartService(5);
                });

                x.RunAsLocalSystem();                                           //6

                x.SetDescription("Ipos transaction upload to Ipos Analytics."); //7
                x.SetDisplayName("Ipos Cloud Sync");                            //8
                x.SetServiceName("IposCloudSync");

                x.StartAutomatically();
            });
        }