Ejemplo n.º 1
0
        protected virtual void CalcBasicPay()
        {
            var basicPayEarnRef = p_Processor.Run(new GetEarningQr(EarningCodeConstants.BasicPay));
            var handlerProvider = basicPayEarnRef.TaskHandlerProvider;

            var basicPayInstance = JobInstanceHelper.NewInstance <ITasq>
                                   (
                handlerProvider.TaskAssembly,
                handlerProvider.TaskClass,
                p_ProcessTracker,
                p_OldMasterData,
                p_NewMasterData,
                basicPayEarnRef
                                   );

            if (!handlerProvider.IsDefaultHandler)
            {
                var assembly = Assembly.Load(assemblyString: handlerProvider.HandlerAssembly);
                var type     = assembly.GetType(name: handlerProvider.HandlerClass);

                p_Processor.UsingAsHandler(type)
                .Run(basicPayInstance);
            }
            else
            {
                p_Processor.Run(basicPayInstance);
            }
        }
Ejemplo n.º 2
0
        public override IProcessTrackerBase Run(MasterProcessCmd request)
        {
            var jobTracker = p_Processor.Run(new GetNewJobInstanceCmd());

            var job = p_Processor.Run(new FindJobQr(request.JobID));

            if (job == null)
            {
                throw new AerishNullReferenceException("Job", request.JobID);
            }

            foreach (var jobParams in job.JobParameters)
            {
                var paramDic = request.Parameters[jobParams.Name];

                if (paramDic != null)
                {
                    paramDic.DataType   = jobParams.DataType;
                    paramDic.IsRequired = jobParams.IsRequired;
                    paramDic.MaxLength  = jobParams.MaxLength;
                }
            }

            jobTracker.AttachJob(job, request.Parameters);

            jobTracker.JobStarted();

            try
            {
                var handlerProvider = job.TaskHandlerProvider;

                var assembly = Assembly.Load(assemblyString: handlerProvider.TaskAssembly);
                var type     = assembly.GetType(handlerProvider.TaskClass);

                var instance = (ITasq)Activator.CreateInstance(type, args: new object[] { jobTracker });

                if (handlerProvider.IsDefaultHandler)
                {
                    p_Processor.Run(instance);
                }
                else
                {
                    var assemblyH = Assembly.Load(assemblyString: handlerProvider.HandlerAssembly);
                    var typeH     = assemblyH.GetType(name: handlerProvider.HandlerClass);

                    p_Processor.UsingAsHandler(typeH).Run(instance);
                }

                if (jobTracker.SaveContext == true)
                {
                    p_BaseDbContext.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                jobTracker.LogError(ex.InnermostException());
            }

            jobTracker.JobEnded();

            return(jobTracker);
        }