Exemple #1
0
        public ServiceJob()
        {
            dataSyncConfiguration = ConfigurationManager.GetSection("serviceSection") as DataSyncServiceSection;
            if (dataSyncConfiguration == null)
            {
                throw new Exception("It wasn't found any configuration section");
            }

            serviceSetting = dataSyncConfiguration.Services[serviceName];

            yearMonth = new YearMonth();

            PersianCalendar pcal = new PersianCalendar();

            currentYear  = pcal.GetYear(DateTime.Now);
            currentMonth = pcal.GetMonth(DateTime.Now);

            unitOfWork = NinjectContainer.Resolve <NeutrinoUnitOfWork>();
        }
Exemple #2
0
        protected override async void OnStart(string[] args)
        {
            // First we must get a reference to a scheduler
            NameValueCollection properties = new NameValueCollection
            {
                ["quartz.scheduler.instanceName"] = "Neutrino.Data.Synchronization",
                // Set thread count to 1 to force Triggers scheduled for the same time to
                // to be ordered by priority.
                ["quartz.threadPool.threadCount"] = "1",
                ["quartz.threadPool.type"]        = "Quartz.Simpl.SimpleThreadPool, Quartz",
                ["quartz.jobStore.type"]          = "Quartz.Simpl.RAMJobStore, Quartz"
            };

            dataSyncConfiguration = ConfigurationManager.GetSection("serviceSection") as DataSyncServiceSection;

            var mainSchehulerFactory = new StdSchedulerFactory(properties);

            mainScheduler = await mainSchehulerFactory.GetScheduler();


            // this service doesn't have any pre-required to get data
            await AddAcquireJobAsync <CompanyJob>(10);


            //this service doesn't have any pre-required to get data
            await AddAcquireJobAsync <BranchJob>(10);

            //this service doesn't have any pre-required to get data
            await AddAcquireJobAsync <PositionJob>(10);

            //this service doesn't have any pre-required to get data
            await AddAcquireJobAsync <DepartmentJob>(10);

            // this service doesn't have any pre-required to get data
            await AddAcquireJobAsync <GoodsCategoryTypesJob>(10);



            //this service needs a companyId to get data
            await AddAcquireJobAsync <GoodsJob>(9);

            //this service needs a branchId to get data
            await AddAcquireJobAsync <MembersJob>(8);

            //this service needs a companyId, a goodsId and the goodsCategoryType's Ids to get data
            await AddAcquireJobAsync <GoodsCategoryJob>(8);

            //this service needs the goods and branches data to save data
            await AddAcquireJobAsync <BranchSalesJob>(7);

            //this service needs the members and goods data to save data
            await AddAcquireJobAsync <InvoiceJob>(7);

            //this service needs the members and goods data to save data
            await AddAcquireJobAsync <PayrollJob>(7);

            //this service needs the members data to save data
            //await AddAcquireJobAsync<MemberReceiptJob>(7, jobExternalData);

            //this service needs the branch data to save data
            await AddAcquireJobAsync <BranchReceiptJob>(7);

            await mainScheduler.Start();


            //check not completed jobs
            await AddCheckNotCompletedJobAsync <PayrollJob>();

            //await AddCheckFailureJobAsync<MemberReceiptJob>(jobExternalData);

            await AddCheckNotCompletedJobAsync <BranchReceiptJob>();

            await AddCheckNotCompletedJobAsync <InvoiceJob>();

            await AddCheckNotCompletedJobAsync <BranchSalesJob>();

            //add report summery job
            await AddReportSummeryJobAsync <ReportSummeryJob>();
        }