public async Task <int> ReadCountByStatusAsync(EventStatus status)
 {
     using (var conn = connectionFactory.GetEddsPerformanceConnection())
     {
         return(await conn.QueryFirstOrDefaultAsync <int>(Resources.Event_ReadCountByStatus, new { status }));
     }
 }
Ejemplo n.º 2
0
 public DynamoNodeValueReadyEventArgs(RuntimeMirror mirror, Guid nodeGuid, EventStatus resultStatus, String errorString)
 {
     this.RuntimeMirror = mirror;
     this.NodeGuid      = nodeGuid;
     ResultStatus       = resultStatus;
     ErrorString        = errorString;
 }
Ejemplo n.º 3
0
 public NodeValueReadyEventArgs(ProtoCore.Mirror.RuntimeMirror mirror, uint nodeId, EventStatus resultStatus, String errorString)
 {
     this.RuntimeMirror = mirror;
     this.NodeId        = nodeId;
     ResultStatus       = resultStatus;
     ErrorString        = errorString;
 }
Ejemplo n.º 4
0
        public IEnumerator Poll()
        {
            float wait;

            wait = this._adaptivity.Initial;
            if (this._callback != null && this._callback())
            {
                this.Fire();
            }
            while (this._status == EventStatus.Running)
            {
                if (DateTime.Now > this._limit)
                {
                    lock (this)
                    {
                        if (this._status == EventStatus.Running)
                        {
                            this._status = EventStatus.Timedout;
                        }
                    }
                    yield break;
                }
                yield return(Yields.WaitForSeconds(wait));

                this._adaptivity.Next(ref wait);
                if (this._callback != null && this._callback())
                {
                    this.Fire();
                }
            }
        }
Ejemplo n.º 5
0
 public void UpdateQuestEvent(EventStatus es)
 {
     status = es;
     OnStatusUpdate?.Invoke(this, new OnStatusUpdateEventArgs {
         name = name, status = status
     });
 }
Ejemplo n.º 6
0
        /// <summary>
        /// Publish or cancel an event by changing the status of the event
        /// </summary>
        /// <param name="eventId">Event id</param>
        /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PatchEventSpotStatus(string eventId, EventStatus eventStatus)
        {
            if (string.IsNullOrWhiteSpace(eventId))
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.InvalidId);
            }

            string url = String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventSpots, "/", eventId);

            var patchRequests = new List <PatchRequest>();
            var patchRequest  = new PatchRequest("REPLACE", "#/status", eventStatus.ToString());

            patchRequests.Add(patchRequest);

            string json = patchRequests.ToJSON();

            RawApiResponse response = RestClient.Patch(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);

            try
            {
                var individualEvent = response.Get <IndividualEvent>();
                return(individualEvent);
            }
            catch (Exception ex)
            {
                throw new CtctException(ex.Message, ex);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Oks the specified event action.
        /// </summary>
        /// <param name="eventAction">The event action.</param>
        /// <param name="eventStatus">The event status.</param>
        /// <param name="data">The data.</param>
        /// <param name="msg">The MSG.</param>
        /// <returns></returns>
        protected IHttpActionResult Ok(ModelAction eventAction, EventStatus eventStatus, object data = null, string msg = null)
        {
            var action = eventAction.GetDescription().ToLower();

            if (string.IsNullOrEmpty(msg))
            {
                switch (eventStatus)
                {
                case EventStatus.Success:
                    msg = String.Format("{0} {1} com sucesso", string.Format("{0}(s)", Module.GetDescription()), action);
                    break;

                case EventStatus.Failure:
                    msg = String.Format("Um erro ocorreu. {0} não pode ser {1}", Module.GetDescription(), action);
                    break;

                case EventStatus.Pending:
                    msg = String.Format("{0} ação {1} está pendente no momento", action, Module.GetDescription());
                    break;

                case EventStatus.NoAction:
                    msg = String.Format("{0} está atualizado(a). Nenhuma ação foi realizada", Module.GetDescription());
                    break;
                }
            }
            var content = data == null ? (object)new { Message = msg } : new { Message = msg, Data = data };

            return(Ok(content));
        }
Ejemplo n.º 8
0
        public virtual void Deserialize(GenericReader reader)
        {
            var v = reader.ReadInt(); // version

            switch (v)
            {
            case 1:
                Running = reader.ReadBool();
                goto case 0;

            case 0:
                _Status = (EventStatus)reader.ReadInt();

                MonthStart = reader.ReadInt();
                DayStart   = reader.ReadInt();
                _Duration  = reader.ReadInt();
                break;
            }

            if (v == 0)
            {
                Running          = IsActive();
                InheritInsertion = true;
            }
        }
Ejemplo n.º 9
0
 public Event(Guid sensorId, String value, Int64 timestamp, EventStatus status)
 {
     SensorId  = sensorId;
     Value     = value;
     Timestamp = timestamp;
     Status    = status;
 }
Ejemplo n.º 10
0
 public NodesToCodeCompletedEventArgs(
     string outputData, EventStatus resultStatus, String errorString)
 {
     this.output       = outputData;
     this.ResultStatus = resultStatus;
     this.ErrorString  = errorString;
 }
Ejemplo n.º 11
0
 public NodeValueReadyEventArgs(RuntimeMirror mirror, Guid nodeGuid, EventStatus resultStatus, String errorString)
 {
     this.RuntimeMirror = mirror;
     this.NodeGuid = nodeGuid;
     ResultStatus = resultStatus;
     ErrorString = errorString;
 }
Ejemplo n.º 12
0
Archivo: Event.cs Proyecto: ame89/nfx
        private void setStatus(EventStatus status)
        {
            EventStatus priorStatus;

            lock (m_Lock)
            {
                priorStatus = m_Status;
                if (priorStatus == status)
                {
                    return;
                }
                m_Status = status;

                var schange = StatusChange;

                if (schange != null)
                {
                    schange(this, priorStatus);
                    var ih = EventHandler;
                    if (ih != null)
                    {
                        ih.EventStatusChange(this, priorStatus);
                    }
                }
            }
        }
Ejemplo n.º 13
0
 public NodesToCodeCompletedEventArgs(
     string outputData, EventStatus resultStatus, String errorString)
 {
     this.output = outputData;
     this.ResultStatus = resultStatus;
     this.ErrorString = errorString;
 }
Ejemplo n.º 14
0
        public EventEditor(EventEntry entry, FormStorage<EventStatus> storage)
        {
            _entry = entry;
            _eventMode = storage.Value;
            _storage = storage;

            InitializeComponent();

            if(_eventMode == EventStatus.Create)
            {
                this.Text += " - Create Event";
            }
            else
            {
                this.Text += " - Modify Event";

                buttonRemove.Enabled = true;
                textEventName.Text = _entry.EventName;
                timeStart.Value = _entry.EventActivationTime;
                timeEnd.Value = _entry.EventDeactivationTime;
                textDescription.Text = _entry.Description;
            }

            if (_storage.Value == EventStatus.Print)
            {
                this.buttonAccept.Visible = false;
                this.buttonCancel.Visible = false;
                this.buttonRemove.Visible = false;
                this.Shown += new EventHandler(Print);
            }
        }
Ejemplo n.º 15
0
 public IList<EventInfo> ListEvents(EventStatus Status)
 {
     var retVal = new List<EventInfo>();
     if (null == _conn)
         InitConnection();
     var cmd = new SQLiteCommand("SELECT Code, Description, Status, LogoURL FROM Events WHERE Status = @Status");
     cmd.Connection = _conn;
     if (_conn.State == System.Data.ConnectionState.Closed)
         _conn.Open();
     cmd.Parameters.Add(new SQLiteParameter("@Status", Status));
     SQLiteDataReader res = null;
     try
     {
         res = cmd.ExecuteReader();
         while (res.Read())
         {
             retVal.Add(new EventInfo() { Code = res.GetString(0), Description = res.GetString(1), Status = (EventStatus)Enum.Parse(typeof(EventStatus), res.GetInt32(2).ToString()), LogoURL = res.GetString(3) });
         }
         return retVal;
     }
     catch(Exception ex)
     {
         throw;
     }
     finally
     {
         if (null != res && !res.IsClosed)
             res.Close();
     }
 }
Ejemplo n.º 16
0
 // for reload
 public MovingConstructRange(int id, string notifier, DateTime timeStamp, string lineID, string directionID, int startMileage, int endMileage, int blockTypeId, string blocklane, string description, string IsExecute, int originalEvtid, EventStatus status)
     : this(id,notifier,timeStamp,lineID,directionID,startMileage,endMileage,blockTypeId,blocklane,description,IsExecute)
 {
     this.OrgEventId = originalEvtid;
      this.EventStatus = status;
      this.IsReload = true;
 }
Ejemplo n.º 17
0
 public NodeValueReadyEventArgs(ProtoCore.Mirror.RuntimeMirror mirror, uint nodeId, EventStatus resultStatus, String errorString)
 {
     this.RuntimeMirror = mirror;
     this.NodeId = nodeId;
     ResultStatus = resultStatus;
     ErrorString = errorString;
 }
Ejemplo n.º 18
0
 public IList<EventInfo> ListEvents(EventStatus Status)
 {
     var retVal = new List<EventInfo>();
     if(Status == EventStatus.Active)
         retVal.Add(cm);
     return retVal;
 }
Ejemplo n.º 19
0
    //the list keep track of what quest is coming next.
    //if the previous quest is DONE, tell player what is the next WAITING quest

    public QuestEvent(string n, string d, GameObject l)
    {
        id          = Guid.NewGuid().ToString();// this code will generate a unique sequence of identity for the id of the quest(000111-1000-1113..)
        name        = n;
        description = d;
        status      = EventStatus.WAITING;
        location    = l;
    }
        private EventStatus getEventStatus(int id)
        {
            m_command.CommandText = CustomerInvoiceJournal.GetEventStatus(id);
            object      b = m_command.ExecuteScalar();
            EventStatus m = (EventStatus)Enum.Parse(typeof(EventStatus), b.ToString());

            return(m);
        }
Ejemplo n.º 21
0
        public ActionResult DeleteConfirmed(int id)
        {
            EventStatus eventStatus = db.EventsStatus.Find(id);

            db.EventsStatus.Remove(eventStatus);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 22
0
 public OneTimeEvent(INotifier notifier, DateTime date, string name, TimeSpan time, EventStatus status)
 {
     Notifier     = notifier;
     Date         = date;
     Name         = name;
     NotifyBefore = time;
     Status       = status;
 }
Ejemplo n.º 23
0
 public OneTimeEvent(INotifier notifier, DateTime date)
 {
     Notifier     = notifier;
     Date         = date;
     Name         = "My Event";
     NotifyBefore = new TimeSpan(0, 5, 0);
     Status       = EventStatus.Active;
 }
Ejemplo n.º 24
0
 public void OnAfterDeserialize()
 {
     try {
         targetStatus = (has == null) ? default(EventStatus) : (EventStatus)Enum.Parse(typeof(EventStatus), has, true);
     } catch (ArgumentException e) {
         throw new FormatException(has + " is not a valid EventStatus", e);
     }
 }
Ejemplo n.º 25
0
 public void CancelEvent()
 {
     status = EventStatus.CANCELED;
     foreach (Invitation invitation in invitations)
     {
         invitation.NotifyParticipant(Description, Place, Started, Completed, Status);
     }
 }
Ejemplo n.º 26
0
 // ctor
 public Event(string description, string place, DateTime started, DateTime completed)
 {
     Description = description;
     Place       = place;
     Started     = started;
     Completed   = completed;
     status      = EventStatus.CREATED;
 }
Ejemplo n.º 27
0
 public CustomEvent(INotifier notifier, IEnumerable<DateTime> dates, string name, TimeSpan time, EventStatus status)
 {
     this.notifier = notifier;
     Dates = (IEnumerable<CustomEventDate>)dates.ToDictionary((current) => current, (current) => EventStatus.Active);
     Name = name;
     NotifyBefore = time;
     Status = status;
 }
Ejemplo n.º 28
0
 public NodesToCodeCompletedEventArgs(List <uint> inputNodeIds,
                                      List <SnapshotNode> outputNodes, EventStatus resultStatus, String errorString)
 {
     this.InputNodeIds = inputNodeIds;
     this.OutputNodes  = outputNodes;
     this.ResultStatus = resultStatus;
     this.ErrorString  = errorString;
 }
Ejemplo n.º 29
0
 protected void Change()
 {
     status = EventStatus.Change;
     if (onChange != null)
     {
         onChange(this);
     }
 }
Ejemplo n.º 30
0
 protected void End()
 {
     status = EventStatus.End;
     if (onEnd != null)
     {
         onEnd(this);
     }
 }
Ejemplo n.º 31
0
 public CustomEvent(INotifier notifier, IEnumerable<DateTime> dates) // зачем нам конструктори?
 {
     this.notifier = notifier;
     Dates = (IEnumerable<CustomEventDate>)dates.ToDictionary((current) => current, (current) => EventStatus.Active);
     Name = "My Event";
     NotifyBefore = new TimeSpan(0, 5, 0);
     Status = EventStatus.Active;
 }
Ejemplo n.º 32
0
        private EventStatus getEventStatus(int id)
        {
            m_command.CommandText = SalesReturn.GetEventStatus(id);
            object      b = m_command.ExecuteScalar();
            EventStatus m = (EventStatus)Enum.Parse(typeof(EventStatus), b.ToString());

            return(m);
        }
Ejemplo n.º 33
0
 public List <Event> getEvents(EventStatus status)
 {
     using (var service = new EventService())
     {
         var events = service.GetWhere(EventService.StatusCol == status);
         return(events);
     }
 }
Ejemplo n.º 34
0
 protected void Start()
 {
     status = EventStatus.Start;
     if (onStart != null)
     {
         onStart(this);
     }
 }
Ejemplo n.º 35
0
 public void ChangeStatus(EventStatus status)
 {
     Debug.Log(status.ToString());
     if (OnStatusChange != null)
     {
         OnStatusChange(status);
     }
 }
Ejemplo n.º 36
0
 public QuestEvent(string n, string d, GameObject loc)
 {
     id          = Guid.NewGuid().ToString();
     name        = n;
     description = d;
     status      = EventStatus.WAITING;
     location    = loc;
 }
Ejemplo n.º 37
0
 public Event()
 {
     _id          = int.MaxValue;
     _name        = "DefaultName";
     _type        = EventType.Info;
     _description = "";
     _status      = EventStatus.New;
 }
Ejemplo n.º 38
0
 public Event(string name, string address, string description, DateTime date, EventType type, EventStatus status)
 {
     this.Name = name;
     this.Address = address;
     this.Description = description;
     this.Date = date;
     this.Type = type;
     this.Status = status;
 }
Ejemplo n.º 39
0
        public IList<EventInfo> ListEvents(EventStatus Status)
        {
            var retVal = new List<EventInfo>();
            if (null == _conn)
                InitConnection();
            string statusClause = string.Empty;
            if(Status != EventStatus.None)
            {
                statusClause = " Status IN (";
                if (Status.HasFlag(EventStatus.Active))
                {
                    statusClause += string.Format("{0},", (int)EventStatus.Active);
                }
                if (Status.HasFlag(EventStatus.Closed))
                {
                    statusClause += string.Format("{0},", (int)EventStatus.Closed);
                }
                if (Status.HasFlag(EventStatus.Archived))
                {
                    statusClause += string.Format("{0},", (int)EventStatus.Archived);
                }
                if (statusClause.Substring(statusClause.Length - 1, 1) == ",")
                    statusClause = statusClause.Substring(0, statusClause.Length - 1);
                statusClause += ")";
            }
            var cmd = new SqlCommand(string.Format("SELECT Code, Description, Status, LogoURL FROM Events WHERE {0} ORDER BY Status, Code",statusClause));

            cmd.Connection = _conn;
            if (_conn.State == System.Data.ConnectionState.Closed)
                _conn.Open();
            cmd.Parameters.Add(new SqlParameter("@Status", Status));
            SqlDataReader res = null;
            try
            {
                res = cmd.ExecuteReader();
                while (res.Read())
                {
                    retVal.Add(new EventInfo() { Code = res.GetString(0), Description = res.GetString(1),
                        Status = (EventStatus)Enum.Parse(typeof(EventStatus), res.GetInt32(2).ToString()),
                        LogoURL = res.GetString(3),
                        StatusString = Enum.Parse(typeof(EventStatus), res.GetInt32(2).ToString()).ToString(),
                        IsOpen = (EventStatus.Active == (EventStatus)Enum.Parse(typeof(EventStatus), res.GetInt32(2).ToString()))
                    });
                }
                return retVal;
            }
            catch(Exception ex)
            {
                throw;
            }
            finally
            {
                if (null != res && !res.IsClosed)
                    res.Close();
            }
        }
Ejemplo n.º 40
0
 private MailMessage CreateMailMessage(EventStatus status, Event @event)
 {
     var message = new MailMessage
     {
         Subject = PrepareSubject(status),
         Body = PrepareBodyAsHtml(@event),
         From = PrepareSender(@event),
         IsBodyHtml = true
     };
     return message;
 }
Ejemplo n.º 41
0
 private void EventStatusChanged(
     BehaviorEvent sender, 
     EventStatus newStatus)
 {
     if (newStatus == EventStatus.Finished)
     {
         this.SendFreeObjects(sender.Token.Get<uint[]>());
         this.SendRecommendationRequest();
         this.paused = true;
     }
 }
Ejemplo n.º 42
0
        public GraphUpdateReadyEventArgs(GraphSyncData syncData, EventStatus resultStatus, String errorString)
        {
            this.SyncData = syncData;
            this.ResultStatus = resultStatus;
            this.ErrorString = errorString;

            if (string.IsNullOrEmpty(this.ErrorString))
                this.ErrorString = "";

            Errors = new List<ErrorObject>();
            Warnings = new List<ErrorObject>();
        }
Ejemplo n.º 43
0
        public void EventThread(EventEntry entry, EventStatus eventMode)
        {
            FormStorage<EventStatus> storage = new FormStorage<EventStatus>(eventMode);
            Application.Run(new EventEditor(entry, storage));

            if(_eventEditors.ContainsKey(Thread.CurrentThread))
            {
                _eventEditors.Remove(Thread.CurrentThread);
            }

            SAPS.Instance.Invoke(new EventDelegate(UpdateEvents), new object[] { entry, storage.Value });
        }
Ejemplo n.º 44
0
 private string PrepareSubject(EventStatus status)
 {
     //return String.Format("{0} termin", status.ToString());
     switch (status)
     {
         case EventStatus.New:
             return "Dodano nowy termin";
         case EventStatus.Updated:
             return "Edytowano termin";
         case EventStatus.Removed:
             return "Usunięto termin";
         default:
             throw new ArgumentOutOfRangeException(nameof(status), status, null);
     }
 }
Ejemplo n.º 45
0
    // Initialisiert alle Variablen
    void Init()
    {
        gameController = GameObject.FindGameObjectWithTag(Tags.gameController);
        gameStats = gameController.GetComponent<GameStats>();

        eventID = -1;

        source = GetComponent<AudioSource>();
        soundDistance = initialSoundDistance;
        source.maxDistance = soundDistance;
        nav = GetComponent<NavMeshAgent>();
        player = GameObject.FindGameObjectWithTag(Tags.player);
        playerMovement = player.GetComponent<Player_Movement>();
        ProtagonistSVISystem = player.GetComponent<SVI_I>();

        directDistanceFromPlayer = 0f;
        currentStatus = EventStatus.inactive;
    }
Ejemplo n.º 46
0
        private static bool IsAllowStatus(EventMode mode, EventStatus oldstatus, EventStatus newstatus)
        {
            if (newstatus == EventStatus.Abort || newstatus == EventStatus.Closed)
                        return false;

            switch (mode)
            {

                default:
                    if (oldstatus >= newstatus)
                        return false;
                    else
                        return true;

                   // break;
            }
        }
Ejemplo n.º 47
0
        private void UpdateEvents(EventEntry entry, EventStatus status)
        {
            switch (status)
            {
                case EventStatus.Cancel:
                    break;
                case EventStatus.Remove:
                    EventSystem.Instance.Events.Remove(entry);
                    break;
                case EventStatus.Modify:
                    break;
                case EventStatus.Create:
                    EventSystem.Instance.Events.Add(entry);
                    break;
            }

            BaseSystem.Instance.Serialize();
            EventTracker.Instance.UpdateEventTracker();
            SAPS.Instance.UpdateEventList();
        }
Ejemplo n.º 48
0
  /// <summary>
 /// Publish or cancel an event by changing the status of the event
 /// </summary>
 /// <param name="eventId">Event id</param>
 /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
 /// <returns>The updated event</returns>
 public IndividualEvent PatchEventSpotStatus(string eventId, EventStatus eventStatus)
 {
     if (string.IsNullOrWhiteSpace(eventId))
     {
         throw new IllegalArgumentException(Config.Errors.InvalidId);
     }
     return EventSpotService.PatchEventSpotStatus(this.AccessToken, this.APIKey, eventId, eventStatus);
 }
Ejemplo n.º 49
0
 private void StartEventThread(EventEntry entry, EventStatus eventMode)
 {
     if(!_eventEditors.ContainsValue(entry) || eventMode == EventStatus.Print)
     {
         Thread thread = new Thread(() => EventThread(entry, eventMode));
         _eventEditors.Add(thread, entry);
         thread.Start();
     }
 }
Ejemplo n.º 50
0
        /// <summary>
        /// Publish or cancel an event by changing the status of the event
        /// </summary>
        /// <param name="eventId">Event id</param>
        /// <param name="eventStatus">New status of the event. ACTIVE" and "CANCELLED are allowed</param>
        /// <returns>The updated event</returns>
        public IndividualEvent PatchEventSpotStatus(string eventId, EventStatus eventStatus)
        {
            if (string.IsNullOrWhiteSpace(eventId))
            {
                throw new IllegalArgumentException(CTCT.Resources.Errors.InvalidId);
            }

            string url = String.Concat(Settings.Endpoints.Default.BaseUrl, Settings.Endpoints.Default.EventSpots, "/", eventId);

            var patchRequests = new List<PatchRequest>();
            var patchRequest = new PatchRequest("REPLACE", "#/status", eventStatus.ToString());
            patchRequests.Add(patchRequest);

            string json = patchRequests.ToJSON();

            RawApiResponse response = RestClient.Patch(url, UserServiceContext.AccessToken, UserServiceContext.ApiKey, json);
            try
            {
                var individualEvent = response.Get<IndividualEvent>();
                return individualEvent;
            }
            catch (Exception ex)
            {
                throw new CtctException(ex.Message, ex);
            }
        }
Ejemplo n.º 51
0
        public void ReNewEvent()
        {
            this.m_eventid= Global.getEventId();

               _status = EventStatus.Null;
               m_isRenew = true;

            //   doModeControl((EventStatus)this.EventStatus);
               if (this.OnReNewEvent != null)
               this.OnReNewEvent(this, null);
        }
Ejemplo n.º 52
0
 public void Send(EventStatus status, Event @event)
 { 
     var message = CreateMailMessage(status, @event);
     SetRecipients(message, @event);
     Send(message);
 }
Ejemplo n.º 53
0
        private void doModeControl(EventStatus newStatus)
        {
            try
            {

                if (this.EventMode == EventMode.DontCare)
                    return;
                if (!IsAllowStatus(this.EventMode, EventStatus, newStatus))
                    return;
                switch (this.EventMode)
                {
                    case EventMode.AutoAuto:

                        Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                        //Execution.Execution.getBuilder().
                        Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);
                        this.EventStatus = EventStatus.Executing;
                        this.executePlan();

                        break;
                    case EventMode.DontCare:
                        this.EventStatus = EventStatus.Alarm;
                        break;
                    case EventMode.HalfAuto:

                        if (newStatus == EventStatus.Confirm)
                        {
                            Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                            Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);
                            this.EventStatus = EventStatus.Executing;
                            this.executePlan();

                        }
                        else if (newStatus == EventStatus.Alarm)
                            this.EventStatus = EventStatus.Alarm;

                        break;

                    case EventMode.HalfHalf:
                        if (newStatus == EventStatus.Confirm)
                        {
                            Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                            Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);
                            EventStatus = EventStatus.Confirm;
                        }
                        else if (newStatus == EventStatus.PlanCheck)
                        {

                            this.EventStatus = EventStatus.Executing;
                            this.executePlan();

                        }
                        else if (newStatus == EventStatus.Alarm)
                            this.EventStatus = EventStatus.Alarm;

                        break;

                    case EventMode.AutoHalf:
                        if (newStatus == EventStatus.Alarm)
                        {
                            Execution.Execution.getBuilder().InputIIP_Event(this.EventId);
                            Execution.Execution.getBuilder().GenerateExecutionTable(this.EventId);
                            this.EventStatus = EventStatus.Confirm;
                        }
                        else if (newStatus == EventStatus.PlanCheck)
                        {

                            this.EventStatus = EventStatus.Executing;
                            this.executePlan();

                        }

                        break;

                }
            }
            catch (Exception ex)
            {
                Util.SysLog("evterr.log", ex.Message + "," + ex.StackTrace);
                throw new Exception(ex.Message + "," + ex.StackTrace);
            }
        }
        public static bool? ModifyEventStatus(WpfScheduler.Event e, EventStatus es, int userLoggedInId)
        {
            string oldEventStatus = e.EventStatus.ToString();

            switch (es)
            {
                case EventStatus.CANCELED:
                    if (e.EventInfo.IsCanceled && e.EventInfo.IsCompleted == false 
                        && e.EventInfo.PatientSkips == false && e.EventInfo.IsConfirmed == false)
                    {
                        return null;
                    }

                    e.EventInfo.IsCanceled = true;
                    e.EventInfo.IsCompleted = false;
                    e.EventInfo.PatientSkips = false;
                    e.EventInfo.IsConfirmed = false;
                    break;
                case EventStatus.COMPLETED:
                    if (e.EventInfo.IsCanceled == false && e.EventInfo.IsCompleted
                        && e.EventInfo.PatientSkips == false && e.EventInfo.IsConfirmed == false)
                    {
                        return null;
                    }

                    e.EventInfo.IsCanceled = false;
                    e.EventInfo.IsCompleted = true;
                    e.EventInfo.PatientSkips = false;
                    e.EventInfo.IsConfirmed = false;
                    break;
                case EventStatus.PATIENT_SKIPS:
                    if (e.EventInfo.IsCanceled == false && e.EventInfo.IsCompleted
                        && e.EventInfo.PatientSkips && e.EventInfo.IsConfirmed == false)
                    {
                        return null;
                    }

                    e.EventInfo.IsCanceled = false;
                    e.EventInfo.IsCompleted = true;
                    e.EventInfo.PatientSkips = true;
                    e.EventInfo.IsConfirmed = false;
                    break;

                case EventStatus.CONFIRMED:
                    if (e.EventInfo.IsCanceled == false && e.EventInfo.PatientSkips == false
                        && e.EventInfo.IsCompleted == false && e.EventInfo.IsConfirmed)
                    {
                        return null;
                    }

                    e.EventInfo.IsCanceled = false;
                    e.EventInfo.IsCompleted = false;
                    e.EventInfo.PatientSkips = false;
                    e.EventInfo.IsConfirmed = true;
                    break;
                default:
                    return null;
            }

            if (es == EventStatus.PATIENT_SKIPS)
            {
                if (MessageBox.Show
                                (string.Format("¿Está seguro(a) que desea indicar que el paciente '{0}' "
                                    + "no asistió a su cita del día '{1}' que inició a las {2} hrs?",
                                        e.EventInfo.Patient.FirstName + " " + e.EventInfo.Patient.LastName,
                                        e.EventInfo.StartEvent.ToString("D"),
                                        e.EventInfo.StartEvent.ToString("HH:mm")),
                                    "Advertencia",
                                    MessageBoxButton.YesNo,
                                    MessageBoxImage.Warning
                                ) == MessageBoxResult.No)
                {
                    e.EventInfo.IsCanceled = false;
                    e.EventInfo.IsCompleted = false;
                    e.EventInfo.PatientSkips = false;
                    e.EventInfo.IsConfirmed = false;

                    return false;
                }
            }

            if (BusinessController.Instance.Update<Model.Event>(e.EventInfo))
            {
                bool eventStatusChangeRegistered = Utils.AddEventStatusChanges(oldEventStatus, e.EventStatus.ToString(), e.EventInfo.EventId, userLoggedInId);
                if (eventStatusChangeRegistered == false)
                {
                    MessageBox.Show("No se pudo guardar el cambio registrado en el estado de la cita", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return false;
                }

                CreateFunctionalityBasedOnEventStatus(e, es);

                return true;
            }

            MessageBox.Show("No pudo ser modificado el estado de la cita", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            return false;
        }
Ejemplo n.º 55
0
        public IEnumerator Poll()
        {
            float wait;

            wait = this._adaptivity.Initial;
            if (this._callback != null && this._callback()) this.Fire();
            while (this._status == EventStatus.Running)
            {
                if (DateTime.Now > this._limit)
                {
                    lock (this)
                    {
                        if (this._status == EventStatus.Running)
                            this._status = EventStatus.Timedout;
                    }
                    yield break;
                }
                yield return Yields.WaitForSeconds(wait);
                this._adaptivity.Next(ref wait);
                if (this._callback != null && this._callback()) this.Fire();
            }
        }
Ejemplo n.º 56
0
 public NodesToCodeCompletedEventArgs(List<uint> inputNodeIds,
     List<SnapshotNode> outputNodes, EventStatus resultStatus, String errorString)
 {
     this.InputNodeIds = inputNodeIds;
     this.OutputNodes = outputNodes;
     this.ResultStatus = resultStatus;
     this.ErrorString = errorString;
 }
Ejemplo n.º 57
0
 public void EventStatusChange(Event sender, EventStatus priorStatus)
 {
 }
Ejemplo n.º 58
0
 public FutureEvent(
     Adaptivity adaptivity,
     TimeSpan timeout,
     Action initialize,
     EventCallback callback)
 {
     this._adaptivity = adaptivity;
     this._limit = DateTime.Now + timeout;
     this._callback = callback;
     this._status = EventStatus.Running;
     if (initialize != null) initialize();
 }
        private static void CreateFunctionalityBasedOnEventStatus(WpfScheduler.Event e, EventStatus es)
        {   
            //Creating reminder for recurrent treatments
            if (es == EventStatus.COMPLETED && e.EventInfo.Treatment.Recurrent != null)
            {
                string reminderMessage = "El paciente '" + e.EventInfo.Patient.FirstName + " " + e.EventInfo.Patient.LastName + "'"
                                        + " con Exp. No. " + e.EventInfo.Patient.AssignedId + " tomó el tratamiento de '" + e.EventInfo.Treatment.Name + "' el día "
                                        + e.EventInfo.StartEvent.ToString("D") + " a las " + e.EventInfo.StartEvent.ToString("HH:mm") + " hrs. "
                                        + "\nDado que este tratamiento es recurrente es necesario que llame al paciente para agendar de nuevo una cita.";

                Model.Reminder reminderToAdd = new Model.Reminder()
                {
                    Message = reminderMessage,
                    AppearDate = e.EventInfo.StartEvent.AddDays(e.EventInfo.Treatment.Recurrent.Value),
                    CreatedDate = DateTime.Now,
                    RequireAdmin = true,
                    Seen = false,
                    SeenBy = null,
                    AutoGenerated = true
                };

                if (Controllers.BusinessController.Instance.Add<Model.Reminder>(reminderToAdd) == false)
                {
                    MessageBox.Show("No se pudo generar un recordatorio para esta cita que es de tratammiento recurrente", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }


            if (es == EventStatus.CANCELED)
            {
                //If the event is canceled, then increment UsesLeft to the selected instrument
                //TODO: Now the user is able to make an event regardless if there is instruments available.
                //      So, we can't increment the UsesLeft followint the old logic.
                //if (e.EventInfo.Instrument != null)
                //{
                //    e.EventInfo.Instrument.UsesLeft = e.EventInfo.Instrument.UsesLeft.Value + 1;
                //    if (BusinessController.Instance.Update<Model.Instrument>(e.EventInfo.Instrument) == false)
                //    {
                //        MessageBox.Show("No se pudo incrementar la cantidad de usos al instrumento que iba a ser utilizado en esta cita", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                //    }   
                //}

                //Send email to patient for recurrent canceled events
                List<Model.Event> canceledEventsInARow = GetPatientCanceledEventsInARow(e.EventInfo.Patient.PatientId, 3);
                List<Model.Event> canceledEventsOfSameTreatment = GetPatientCanceledEventsOfSameTreatment(e.EventInfo.Patient.PatientId, e.EventInfo.TreatmentId, 3);

                if (canceledEventsInARow != null || canceledEventsOfSameTreatment != null)
                {
                    new CanceledEventsSendEmailModal(canceledEventsInARow, canceledEventsOfSameTreatment, e.EventInfo.Patient, e.EventInfo.Treatment).ShowDialog();
                }
            }   
        }
Ejemplo n.º 60
0
 /// <summary>
 ///  parse method is called from the atom parser to populate an EventStatus node
 /// </summary>
 /// <param name="node">the xmlnode to parser</param>
 /// <returns>EventStatus object</returns>
 public static EventStatus parse(XmlNode node)
 {
     EventStatus eventStatus = null;
     if (String.Compare(node.NamespaceURI, BaseNameTable.gNamespace, true) == 0)
     {
         eventStatus = new EventStatus();
         if (node.Attributes != null)
         {
             eventStatus.Value = node.Attributes["value"].Value;
         }
     }
     return eventStatus;
 }