Beispiel #1
0
        public static MvcHtmlString EventImportanceIcon(this HtmlHelper htmlHelper, EventImportance importance)
        {
            var img = new TagBuilder("img");

            img.Attributes.Add("src", GetEventImportanceImageUrl(importance));
            img.Attributes.Add("title", EnumHelper.EnumToString(importance));
            return(new MvcHtmlString(img.ToString()));
        }
Beispiel #2
0
        public void AddEventMarker(string name, string description, EventImportance importance)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                DriverStation.ReportError("Shuffleboard event name was not specified", true);
                return;
            }

            m_eventsTable.GetSubTable(name).GetEntry("Info").SetStringArray(new string[] { description, importance.GetName() });
        }
Beispiel #3
0
 public static string GetName(this EventImportance importance)
 {
     return(importance switch
     {
         EventImportance.Trivial => "TRIVIAL",
         EventImportance.Low => "LOW",
         EventImportance.Normal => "NORMAL",
         EventImportance.High => "HIGH",
         EventImportance.Critical => "CRITICAL",
         _ => "NORMAL"
     });
Beispiel #4
0
 /// <summary>
 /// Обновляет данные о последнем уведомлении
 /// </summary>
 public void Update(Notification notification, EventImportance importance)
 {
     if (notification == null)
     {
         throw new ArgumentNullException("notification");
     }
     Address         = notification.Address;
     Type            = notification.Type;
     EventImportance = importance;
     CreateDate      = notification.CreationDate;
     EventId         = notification.EventId;
     NotificationId  = notification.Id;
 }
Beispiel #5
0
        public IBulbCacheReadObject GetActual(
            Guid accountId,
            Guid statusId,
            DateTime processDate,
            EventImportance noSignalImportance)
        {
            var request = new AccountCacheRequest()
            {
                AccountId = accountId,
                ObjectId  = statusId
            };
            var data = AllCaches.StatusDatas.Find(request);

            // статус актуальный
            if (data.Actual(processDate))
            {
                return(data);
            }

            // статус протух
            IBulbCacheReadObject rStatus = null;

            using (var rStatus2 = AllCaches.StatusDatas.Write(request))
            {
                rStatus = rStatus2;
                if (rStatus.Actual(processDate))
                {
                    return(rStatus);
                }

                var signal = BulbSignal.CreateNoSignal(accountId, data.ActualDate, noSignalImportance);
                //var signal = new BulbSignal()
                //{
                //    AccountId = accountId,
                //    IsSpace = true,
                //    ActualDate = EventHelper.InfiniteActualDate,
                //    ProcessDate = processDate,
                //    StartDate = data.ActualDate, // data.ActualDate всегда меньше processDate
                //    Status = noSignalStatus,
                //    Message = "Нет данных",
                //    NoSignalImportance = noSignalImportance
                //};
                ProlongOrChangeStatus(signal, statusId);
            }
            UpdateParentByChild(rStatus);
            return(rStatus);
        }
Beispiel #6
0
        public static BulbSignal CreateNoSignal(Guid accountId, DateTime startDate, EventImportance noSignalImportance)
        {
            var noSignalStatus = MonitoringStatusHelper.Get(noSignalImportance);
            var signal         = new BulbSignal()
            {
                AccountId          = accountId,
                StartDate          = startDate,
                ProcessDate        = startDate,
                ActualDate         = EventHelper.InfiniteActualDate,
                Message            = "Нет сигнала",
                Status             = noSignalStatus,
                NoSignalImportance = EventImportance.Unknown,
                IsSpace            = true
            };

            return(signal);
        }
Beispiel #7
0
 public static BulbSignal Create(DateTime processDate, Event eventObj, EventImportance noSignalImportance, Guid accountId)
 {
     if (eventObj == null)
     {
         throw new ArgumentNullException("eventObj");
     }
     return(new BulbSignal()
     {
         AccountId = accountId,
         EventId = eventObj.Id,
         IsSpace = eventObj.IsSpace,
         ActualDate = eventObj.ActualDate,
         Message = eventObj.Message,
         Status = MonitoringStatusHelper.Get(eventObj.Importance),
         NoSignalImportance = noSignalImportance,
         ProcessDate = processDate,
         StartDate = eventObj.StartDate
     });
 }
 public static string GetSystemName(EventImportance importance)
 {
     if (importance == EventImportance.Alarm)
     {
         return("alarm");
     }
     if (importance == EventImportance.Warning)
     {
         return("warning");
     }
     if (importance == EventImportance.Success)
     {
         return("success");
     }
     if (importance == EventImportance.Unknown)
     {
         return("unknown");
     }
     throw new Exception("Неизвестное значение EventImportance: " + importance);
 }
Beispiel #9
0
 public static MonitoringStatus Get(EventImportance eventImportance)
 {
     if (eventImportance == EventImportance.Alarm)
     {
         return(MonitoringStatus.Alarm);
     }
     if (eventImportance == EventImportance.Warning)
     {
         return(MonitoringStatus.Warning);
     }
     if (eventImportance == EventImportance.Success)
     {
         return(MonitoringStatus.Success);
     }
     if (eventImportance == EventImportance.Unknown)
     {
         return(MonitoringStatus.Unknown);
     }
     throw new Exception("неизвестное значение EventImportance: " + eventImportance);
 }
Beispiel #10
0
        public static string GetEventImportanceImageUrl(EventImportance importance)
        {
            var url = new UrlHelper(HttpContext.Current.Request.RequestContext);

            if (importance == EventImportance.Alarm)
            {
                return(url.Content("~/Content/Icons/Circle-Red.png"));
            }

            if (importance == EventImportance.Warning)
            {
                return(url.Content("~/Content/Icons/Circle-Yellow.png"));
            }

            if (importance == EventImportance.Success)
            {
                return(url.Content("~/Content/Icons/Circle-Green.png"));
            }

            return(url.Content("~/Content/Icons/Circle-Gray.png"));
        }
Beispiel #11
0
 public T SetImportance(EventImportance value)
 {
     Importance = value;
     return(this as T);
 }
Beispiel #12
0
 public static void AddEventMarker(string name, EventImportance importance)
 {
     AddEventMarker(name, "", importance);
 }
Beispiel #13
0
 public static void AddEventMarker(string name, string description, EventImportance importance)
 {
     recordingController.AddEventMarker(name, description, importance);
 }