public String SetIgnore(string ignorelist)
        {
            Trace.WriteLine("STARTING IGNORE PROCEEDURE");
            Trace.WriteLine(ignorelist + " coming in from client");
            var _context = new Context();
            //List<SMJob> num = _context.SMJobs.ToList();
            // Trace.WriteLine("1 from ignore there are "+ num.Count+" jobs in the db");
            String[] a = ignorelist.Split(';');
            Trace.WriteLine(a.Count());
            foreach (string s in a)
            {
                String[] b = s.Split(':');
                SMJob job = _context.getSMJobByName(b[0]);

                if (job != null && b[0] != "")
                {
                    if (b[1].Equals("1"))
                    {
                        Trace.WriteLine("IGNORESERVICE: turning on ignore for " + job.Name);
                        job.alertsAllowed = false;
                    }
                    else
                    {
                        Trace.WriteLine("IGNORESERVICE: turning off ignore for " + job.Name);
                        job.alertsAllowed = true;
                    }
                    //_context.SMJobs.Add(job);
                    _context.SaveChanges();
                }
            }
            Trace.WriteLine("ENDING IGNORE PROCEEDURE");

            return "OK";
        }
Ejemplo n.º 2
0
        public void Ignore(string jobname, bool ignore)
        {
            var _context = new Context();

            SMJob job = _context.getSMJobByName(jobname);
            job.alertsAllowed = !ignore;
            _context.SaveChanges();
            List<SMJob> smjobs = _context.SMJobs.ToList();
            string json2 = JsonConvert.SerializeObject(smjobs);
            Clients.update(json2);
        }