Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
        public ActionResult SummaryList(vSummaryList obj)
        {
            CalWorkTime cal = new CalWorkTime();
            //IQueryable<vEmployeeListSummary> model = cal.getEmployeeListSummary<vEmployeeListSummary>(obj.EmployeeName, obj.StartDate, obj.EndDate);
            var model = cal.GetEmployeeListSummary <vEmployeeListSummary>(obj.EmployeeName /*,obj.StartDate,obj.EndDate*/);

            return(View("SummaryList", model));
        }