/// <summary> /// Handles CriticalReached event from FuelTanks. Adds a log entry to LogActivity. /// </summary> /// <param name="sender"></param> private void HandleCriticalReached(FuelTank sender) { UIDispatcher.Invoke(() => { LogActivity.Add(new LogEntry(Colors.Red, $"{DateTime.Now.ToLocalTime()}: Poziom w zbiorniku {sender.Name} spadł do poziomu krytycznego, potrzebna pilna dostawa.")); }); }
/// <summary> /// Handles WarningReached event from FuelTanks. Adds a log entry to LogActivity. /// </summary> /// <param name="sender">Sender.</param> private void HandleWarningReached(FuelTank sender) { UIDispatcher.Invoke(() => { LogActivity.Add(new LogEntry(Colors.Yellow, $"{DateTime.Now.ToLocalTime()}: Poziom w zbiorniku {sender.Name}. spadł do poziomu zagrożenia, potrzebna dostawa.")); }); }
public ActionResult AddStep(string dbServer, Guid jobID) { JobSteps jobSteps = new JobSteps(); int stepID = jobSteps.addStep(dbServer, jobID); LogActivity log = new LogActivity(); log.Add(User.Identity.Name, dbServer, jobID, "Add Step"); return(RedirectToAction("EditStep", "Edit", new { dbServer = dbServer, jobID = jobID, stepID = stepID })); }
public ActionResult MoveStepDown(string dbServer, Guid jobID, int stepID) { JobSteps jobSteps = new JobSteps(); jobSteps.moveStepDown(dbServer, jobID, stepID); LogActivity log = new LogActivity(); log.Add(User.Identity.Name, dbServer, jobID, "Re-order Step"); return(RedirectToAction("Steps", "Edit", new { dbServer = dbServer, jobID = jobID })); }
public ActionResult StartJob(JobDetailsModel step) { ConnectSqlServer connection = new ConnectSqlServer(); Server server = connection.Connect(step.ServerName); server.JobServer.GetJobByID(step.JobID).Start(step.StepName); server.ConnectionContext.Disconnect(); LogActivity log = new LogActivity(); log.Add(User.Identity.Name, step.ServerName, step.JobID, "Start Job"); return(RedirectToAction("Index", "Schedule", new { dbServer = step.ServerName })); }
public ActionResult DeleteSchedule(string dbServer, Guid jobID, Guid scheduleUID) { JobSchedules jobschedules = new JobSchedules(); jobschedules.deleteSchedule(dbServer, jobID, scheduleUID); ViewBag.ServerName = dbServer; ViewBag.JobID = jobID; LogActivity log = new LogActivity(); log.Add(User.Identity.Name, dbServer, jobID, "Delete Schedule"); return(RedirectToAction("Schedules", "Edit", new { dbServer = dbServer, jobID = jobID })); }
public ActionResult General(JobDetailsModel jobDetail) { if (ModelState.IsValid) { JobDetails jobDetails = new JobDetails(); jobDetails.saveGeneral(jobDetail); TempData["message"] = "Job successfuly updated"; LogActivity log = new LogActivity(); log.Add(User.Identity.Name, jobDetail.ServerName, jobDetail.JobID, "Edit Job"); return(RedirectToAction("General", "Edit", new { dbServer = jobDetail.ServerName, jobID = jobDetail.JobID })); } else { ViewBag.ServerName = jobDetail.ServerName; ViewBag.JobID = jobDetail.JobID; return(View(jobDetail)); } }
public ActionResult EditSchedule(JobScheduleDetailsModel schedule) { if (ModelState.IsValid) { JobSchedules jobschedules = new JobSchedules(); jobschedules.saveScheduleDetails(schedule); ViewBag.ServerName = schedule.ServerName; ViewBag.JobID = schedule.JobID; LogActivity log = new LogActivity(); log.Add(User.Identity.Name, schedule.ServerName, schedule.JobID, "Edit Schedule"); return(RedirectToAction("Schedules", "Edit", new { dbServer = ViewBag.ServerName, jobID = ViewBag.JobID })); } else { PopulateDropDowns dropdown = new PopulateDropDowns(); List <SelectListItem> frequencyTypes = new List <SelectListItem>(); List <SelectListItem> subdayTypes = new List <SelectListItem>(); List <SelectListItem> freqRelativeIntervals = new List <SelectListItem>(); List <SelectListItem> monthlyFrequency = new List <SelectListItem>(); frequencyTypes = dropdown.getFrequencyTypes(); ViewBag.FreqTypes = frequencyTypes; subdayTypes = dropdown.getSubdayTypes(); ViewBag.SubDayTypes = subdayTypes; freqRelativeIntervals = dropdown.getFreqRelativeIntervals(); ViewBag.FreqRelativeIntervals = freqRelativeIntervals; monthlyFrequency = dropdown.getMonthlyFrequency(); ViewBag.MonthlyFrequency = monthlyFrequency; ViewBag.ServerName = schedule.ServerName; ViewBag.JobID = schedule.JobID; return(View(schedule)); } }
public ActionResult EditStep(JobStepDetailsModel step) { if (ModelState.IsValid) { JobSteps jobSteps = new JobSteps(); jobSteps.saveStepDetails(step); ViewBag.ServerName = step.ServerName; ViewBag.JobID = step.JobID; LogActivity log = new LogActivity(); log.Add(User.Identity.Name, step.ServerName, step.JobID, "Edit Step"); return(RedirectToAction("Steps", "Edit", new { dbServer = step.ServerName, jobID = step.JobID })); } else { PopulateDropDowns dropdown = new PopulateDropDowns(); List <SelectListItem> databaseList = new List <SelectListItem>(); List <SelectListItem> proxyList = new List <SelectListItem>(); List <SelectListItem> actionList = new List <SelectListItem>(); databaseList = dropdown.getDatabases(step.ServerName); ViewBag.DatabaseList = databaseList; proxyList = dropdown.getProxies(step.ServerName, AgentSubSystem.TransactSql); ViewBag.ProxyList = proxyList; actionList = dropdown.getActions(step.ServerName, step.JobID, step.StepNo); ViewBag.ActionList = actionList; ViewBag.ServerName = step.ServerName; ViewBag.JobID = step.JobID; return(View(step)); } }