public ActionResult EditParam(EditParaVm p) { var u = db.mc_report_params.Find(p.Id); //List<string> errors = new List<string>(); try { var d = new DateTime(); if (DateTime.TryParse(p.Value, out d) || p.Value == "NOW") { if (!String.IsNullOrWhiteSpace(p.ValueModifier)) { u.value_modifier = Convert.ToInt32(p.ValueModifier).ToString(); if (string.IsNullOrWhiteSpace(p.ModifierInterval)) { throw new Exception("You must select a modifier interval if you are selecting a date modifier."); } u.modifier_interval = p.ModifierInterval; } } u.value_modifier = p.ValueModifier; u.current_value = p.Value; db.SaveChanges(); return(Json(new { success = true, Message = "Updated parameter value." + p.ModifierInterval, id = u.id })); } catch (Exception ex) { //errors.Add(ex.Message); return(Json(new { success = false, Message = "Failed to update parameter value. " + ex.Message, id = p.Id })); } //return PartialView(db.mc_scheduled_job_params.Find(p.id)); }
public ActionResult _GetImagesFromFileForm(int repId) { var m = new EditParaVm() { Id = repId }; return(PartialView(m)); }
public ActionResult _DeleteJobConfirm(int jobId, int repId, bool allJobs) { var m = new EditParaVm() { Id = jobId, Value = repId.ToString(), ValueModifier = allJobs.ToString() }; return(PartialView(m)); }
public ActionResult _DeleteReportConfirm(int repId) { var r = db.mc_reports.Find(repId); var m = new EditParaVm() { Id = r.id, Value = r.name }; return(PartialView(m)); }
public ActionResult _DeleteScheduleConfirm(int schedId, int repId) { var j = db.mc_scheduled_jobs.Count(x => x.deleted == false && x.complete == false && x.in_progress == false && x.schedule_id == schedId); var m = new EditParaVm() { Id = schedId, Value = repId.ToString(), ValueModifier = j.ToString() }; return(PartialView(m)); }
public ActionResult PostDeleteJob(EditParaVm p) { var jobId = p.Id; var f = db.mc_scheduled_jobs.Find(jobId); if (f != null) { //db.mc_scheduled_jobs.Remove(f); f.deleted = true; db.SaveChanges(); return(Json(new { Success = "True", Message = "Removed Job at Id:" + jobId, id = jobId })); } return(Json(new { Success = "False", Message = "Could not find job to remove at Id:" + jobId, id = jobId })); }
public ActionResult PostDeleteReport(EditParaVm p) { var reportId = p.Id; var f = db.mc_reports.Find(reportId); if (f != null) { //mark the schedule as deleted f.deleted = true; db.SaveChanges(); return(Json(new { Success = "True", Message = "Removed report at Id:" + reportId.ToString(), id = reportId })); } return(Json(new { Success = "False", Message = "Could not find report to remove at Id:" + reportId.ToString(), id = reportId })); }
public ActionResult EditParam(EditParaVm p) { var u = db.mc_scheduled_job_params.Find(p.Id); try { u.modifier_interval = p.ModifierInterval; u.value_modifier = p.ValueModifier; u.value = p.Value; db.SaveChanges(); return(Json(new { Success = "True", Message = "Updated parameter value.", id = u.id })); } catch (Exception) { return(Json(new { Success = "False", Message = "Failed to update parameter value.", id = p.Id })); } }
public ActionResult EditDescription(EditParaVm p) { var u = db.mc_reports.Find(p.Id); //List<string> errors = new List<string>(); try { u.schedule_description = p.Value; db.SaveChanges(); return(Json(new { success = true, Message = "Updated schedule description value." + p.Value, id = u.id })); } catch (Exception ex) { //errors.Add(ex.Message); return(Json(new { success = false, Message = "Failed to update schedule description value. " + ex.Message, id = p.Id })); } //return PartialView(db.mc_scheduled_job_params.Find(p.id)); }
public ActionResult EditParam(EditParaVm p) { var u = db.mc_global_variables.Find(p.Id); try { u.current_value = p.Value; db.SaveChanges(); return(Json(new { Success = "True", Message = "Updated parameter value.", id = u.id })); } catch (Exception) { return(Json(new { Success = "False", Message = "Failed to update parameter value.", id = p.Id })); } //return PartialView(db.mc_scheduled_job_params.Find(p.id)); }
public ActionResult PostDeleteSchedule(EditParaVm p) { var scheduleId = p.Id; var f = db.mc_schedule.Find(scheduleId); if (f != null) { //mark the schedule as deleted f.deleted = true; //now delete the jobs var jobs = db.mc_scheduled_jobs.Where(x => x.deleted == false && x.complete == false && x.in_progress == false && x.schedule_id == scheduleId).Select(x => x); foreach (var j in jobs) { j.deleted = true; } db.SaveChanges(); return(Json(new { Success = "True", Message = "Removed schedule at Id:" + scheduleId.ToString(), id = scheduleId })); } return(Json(new { Success = "False", Message = "Could not find schedule to remove at Id:" + scheduleId.ToString(), id = scheduleId })); }