Exemple #1
0
        public Task Execute(IJobExecutionContext context)
        {
            using (var scope = _serviceProvider.CreateScope()) {
                var annualRe    = scope.ServiceProvider.GetRequiredService(typeof(AnnualLeaveRepository)) as AnnualLeaveRepository;
                var punchRe     = scope.ServiceProvider.GetRequiredService(typeof(PunchCardRepository)) as PunchCardRepository;
                var applyOtRe   = scope.ServiceProvider.GetRequiredService(typeof(ApplyOvertimeRepository)) as ApplyOvertimeRepository;
                var httpContext = scope.ServiceProvider.GetRequiredService(typeof(IHttpContextAccessor)) as IHttpContextAccessor;
                calSpLeave = new CalAnnualLeave(annualRe);
                calTime    = new CalWorkTime(punchRe, applyOtRe, httpContext);
                chkWarn    = new ChkPunchLogWarn(punchRe, httpContext);

                var errorJob = "other";
                try{
                    Console.WriteLine($"{definePara.dtNow()}  start job");
                    errorJob = "calSpLeave";
                    calSpLeave.start();
                    errorJob = "calworkTime";
                    calTime.start();
                    errorJob = "chkWarn";
                    chkWarn.start();
                    Console.WriteLine($"{definePara.dtNow()}  end job");
                }catch (Exception ex) {
                    string docPath = Environment.CurrentDirectory;
                    using (StreamWriter outputFile = new StreamWriter(Path.Combine(docPath, "errorLog.txt"), true)){
                        var str = $"{definePara.dtNow()} - MyJob:{errorJob}   ";
                        outputFile.WriteLine(str + ex.ToString() + "\r\n");
                    }
                }
            }
            return(Task.CompletedTask);
        }
Exemple #2
0
 public AdminFnController(AdminFnRepository a_repository, MasterRepository m_repository,
                          PunchCardRepository p_repository, AnnualLeaveRepository al_repository,
                          ApplyOvertimeRepository ap_repository,
                          IHttpContextAccessor httpContextAccessor) : base(httpContextAccessor)
 {
     this.aRepository = a_repository;
     this.mRepository = m_repository;
     this.pRepository = p_repository;
     this.chkWarn     = new ChkPunchLogWarn(p_repository, httpContextAccessor);
     this.calTime     = new CalWorkTime(p_repository, ap_repository, httpContextAccessor);
     this.calAnnual   = new CalAnnualLeave(al_repository);
 }
Exemple #3
0
 public MasterRepository(DBContext dbContext, AnnualLeaveRepository repository) : base(dbContext)
 {
     this.calAnnualDays = new CalAnnualLeave(repository);
 }
Exemple #4
0
 public AnnualLeaveRepository(DBContext dbContext, punchCardFunction fn) : base(dbContext)
 {
     calObj = new CalAnnualLeave(this);
 }