public IActionResult RunChecks() { string connStr = Configuration["pspdbinfo:ConnectionString"]; // do processing DateTime fromTime = DateTime.Now.AddDays(-1); DateTime toTime = DateTime.Now.AddDays(-1); string labelsConnStr = Configuration["psplabelsdbinfo:ConnectionString"]; var jobId = BackgroundJob.Enqueue( () => LabelCheckUtils.ProcessAllLabelChecks(labelsConnStr, connStr, fromTime, toTime)); return(RedirectToAction(nameof(Index))); }
public ActionResult CheckProcess(CheckProcessViewModel checkProcessViewModel) { try { string connStr = Configuration["pspdbinfo:ConnectionString"]; // do processing DateTime fromTime = checkProcessViewModel.CheckFromDate; DateTime toTime = checkProcessViewModel.CheckFromDate; string labelsConnStr = Configuration["psplabelsdbinfo:ConnectionString"]; var jobId = BackgroundJob.Enqueue( () => LabelCheckUtils.ProcessAllLabelChecks(labelsConnStr, connStr, fromTime, toTime)); //return Redirect("~/hangfire"); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public void PSPSQLMeasFetchTest() { string connStr = Configuration["pspdbinfo:ConnectionString"]; Assert.NotNull(connStr); // get measurement fetch helper PspDbHelper helper = new PspDbHelper() { ConnStr = connStr }; // fetch the measurement values DateTime fromTime = DateTime.Now.AddDays(-1); DateTime toTime = DateTime.Now.AddDays(-1); PspMeasurement meas = new PspMeasurement { PspTimeCol = "DATE_KEY", SqlStr = "select MAX(DATE_KEY) DATE_KEY, SUM(UI) UI from state_load_details where DATE_KEY BETWEEN :from_time AND :to_time group by DATE_KEY ORDER BY DATE_KEY ASC", PspValCol = "UI" }; List <PspTimeValTuple> tuples = helper.GetPSPMeasVals(meas, LabelCheckUtils.ConvertDateTimeToInt(fromTime), LabelCheckUtils.ConvertDateTimeToInt(toTime)); Assert.False(tuples.Count == 0); }