示例#1
0
        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));
        }
示例#3
0
        public ActionResult _DeleteJobConfirm(int jobId, int repId, bool allJobs)
        {
            var m = new EditParaVm()
            {
                Id            = jobId,
                Value         = repId.ToString(),
                ValueModifier = allJobs.ToString()
            };

            return(PartialView(m));
        }
示例#4
0
        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));
        }
示例#5
0
        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));
        }
示例#6
0
        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 }));
        }
示例#7
0
        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 }));
        }
示例#8
0
        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 }));
            }
        }
示例#9
0
        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));
        }
示例#11
0
        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 }));
        }