コード例 #1
0
        public IHttpActionResult PutScheduleException(int id, ScheduleException scheduleException)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != scheduleException.Id)
            {
                return(BadRequest());
            }

            db.Entry(scheduleException).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ScheduleExceptionExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #2
0
        public IHttpActionResult GetScheduleException(int id)
        {
            ScheduleException scheduleException = db.ScheduleExceptions.Find(id);

            if (scheduleException == null)
            {
                return(NotFound());
            }

            return(Ok(scheduleException));
        }
コード例 #3
0
        public IHttpActionResult PostScheduleException(ScheduleException scheduleException)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ScheduleExceptions.Add(scheduleException);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = scheduleException.Id }, scheduleException));
        }
コード例 #4
0
        public IHttpActionResult DeleteScheduleException(int id)
        {
            ScheduleException scheduleException = db.ScheduleExceptions.Find(id);

            if (scheduleException == null)
            {
                return(NotFound());
            }

            db.ScheduleExceptions.Remove(scheduleException);
            db.SaveChanges();

            return(Ok(scheduleException));
        }
コード例 #5
0
        public virtual void Complete(bool success, bool recalculate = true
                                     , bool isException             = false, Exception lastEx = null, DateTime?exceptionTime = null)
        {
            if (!success)
            {
                ErrorIncrement();
            }

            if (isException)
            {
                ExecuteException = new ScheduleException()
                {
                    Ex = lastEx, LastTime = exceptionTime
                }
            }
            ;

            if (recalculate)
            {
                Recalculate();
            }

            Active = false;
        }
コード例 #6
0
 public virtual void Start()
 {
     ExecuteException = null;
     Active           = true;
 }