public static SKColor ToColor(this AlertLevelEnum level) { SKColor Color; switch (level) { case AlertLevelEnum.INFO: Color = SKColor.Parse("#6781c0"); break; case AlertLevelEnum.WARNING: Color = SKColor.Parse("#dbc66e"); break; case AlertLevelEnum.DANGER: Color = SKColor.Parse("#dd6a6b"); break; case AlertLevelEnum.SUCCESS: Color = SKColor.Parse("#6bdd9b"); break; } return(Color); }
public static string ToColorString(this AlertLevelEnum level) { string Color = string.Empty; switch (level) { case AlertLevelEnum.INFO: Color = "#6781c0"; break; case AlertLevelEnum.WARNING: Color = "#dbc66e"; break; case AlertLevelEnum.DANGER: Color = "#dd6a6b"; break; case AlertLevelEnum.SUCCESS: Color = "#6bdd9b"; break; } return(Color); }
public int Load(byte[] buffer, long offset) { long value; BufferTools.ReadNumberFromBuffer(buffer, offset, num_bytes, out value); if (Enum.IsDefined(typeof(AlertLevelEnum), value)) { this.value = (AlertLevelEnum)value; } return(num_bytes); }
public async Task WriteAlertLevel(AlertLevelEnum level) { if (!IsServiceStarted) throw new ServiceNotInitializedException(); try { var alertLevel = this.immediateDeviceService.GetCharacteristics(GattCharacteristicUuids.AlertLevel).FirstOrDefault(); byte[] levelValue = new byte[] { (byte)level }; var response = await alertLevel.WriteValueAsync(levelValue.AsBuffer(), GattWriteOption.WriteWithoutResponse); } catch (Exception e) { string errorMessage = e.Message; } }
public void Insert(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription) { var item = new AlertLevelEnum(); item.Guid = Guid; item.EnumX = EnumX; item.Lookup = Lookup; item.Description = Description; item.LongDescription = LongDescription; item.Save(UserName); }
public async Task WriteAlertLevel(AlertLevelEnum level) { if (!IsServiceStarted) { throw new ServiceNotInitializedException(); } try { var alertLevel = this.immediateDeviceService.GetCharacteristics(GattCharacteristicUuids.AlertLevel).FirstOrDefault(); byte[] levelValue = new byte[] { (byte)level }; var response = await alertLevel.WriteValueAsync(levelValue.AsBuffer(), GattWriteOption.WriteWithoutResponse); } catch (Exception e) { string errorMessage = e.Message; } }
public static LevelEnum ConvertEnum(AlertLevelEnum alertLevelEnum) { switch (alertLevelEnum) { case AlertLevelEnum.High: return(LevelEnum.High); case AlertLevelEnum.Medium: return(LevelEnum.Medium); case AlertLevelEnum.Low: return(LevelEnum.Low); default: throw new InvalidDataException(alertLevelEnum + " is invalid"); } }
protected void SetupEventHandlers() { AlertsGridPanel.DataSourceCreated += delegate(AlertDataSource source) { if (!String.IsNullOrEmpty(ComponentFilter.Text)) { source.Component = SearchHelper.LeadingAndTrailingWildCard(ComponentFilter.Text); } if (LevelFilter.SelectedIndex > 0) { source.Level = AlertLevelEnum.GetEnum(LevelFilter.SelectedValue); } if (CategoryFilter.SelectedIndex > 0) { source.Category = AlertCategoryEnum.GetEnum(CategoryFilter.SelectedValue); } source.DateFormats = InsertDateCalendarExtender.Format; if (!String.IsNullOrEmpty(InsertDateFilter.Text)) { source.InsertTime = InsertDateFilter.Text; } }; DeleteConfirmationBox.Confirmed += delegate(object data) { if (data == null) { return; } ArrayList keys = (ArrayList)data; for (int i = 0; i < keys.Count; i++) { _theController.DeleteAlertItem(keys[i] as ServerEntityKey); } OnAlertDeleted(); }; DeleteAllConfirmationBox.Confirmed += DeleteAllConfirmDialog_Confirmed; // TODO: We should do this in GridPager.InitializeGridPager() AlertsGridPanel.TheGrid.DataBound += delegate { GridPagerTop.Refresh(); }; }
public async void WriteAlertLevelCharacteristicAsync(AlertLevelEnum level) { if (!IsServiceStarted) { throw new ServiceNotInitializedException(new Exception()); } try { if (linkLossDeviceService == null) { return; } byte[] levelValue = new byte[] { (byte)level }; var response = await alertLevel.WriteValueAsync(levelValue.AsBuffer()); } catch (Exception e) { string errorMessage = e.Message; } }
protected override void OnInit(EventArgs e) { base.OnInit(e); GridPagerTop.InitializeGridPager(SR.GridPagerAlertSingleItemFound, SR.GridPagerAlertMultipleItemsFound, AlertsGridPanel.AlertGrid, delegate { return(AlertsGridPanel.ResultCount); }, ImageServerConstants.GridViewPagerPosition.Top); AlertsGridPanel.Pager = GridPagerTop; GridPagerTop.Reset(); ClearInsertDateButton.OnClientClick = ScriptHelper.ClearDate(InsertDateFilter.ClientID, InsertDateCalendarExtender.ClientID); IList <AlertLevelEnum> levelEnums = AlertLevelEnum.GetAll(); IList <AlertCategoryEnum> categoryEnums = AlertCategoryEnum.GetAll(); int prevSelectedIndex = LevelFilter.SelectedIndex; LevelFilter.Items.Clear(); LevelFilter.Items.Add(new ListItem(SR.Any, string.Empty)); foreach (AlertLevelEnum ale in levelEnums) { LevelFilter.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(ale), ale.Lookup)); } LevelFilter.SelectedIndex = prevSelectedIndex; prevSelectedIndex = CategoryFilter.SelectedIndex; CategoryFilter.Items.Clear(); CategoryFilter.Items.Add(new ListItem(SR.Any, string.Empty)); foreach (AlertCategoryEnum ace in categoryEnums) { CategoryFilter.Items.Add(new ListItem(ServerEnumDescription.GetLocalizedDescription(ace), ace.Lookup)); } CategoryFilter.SelectedIndex = prevSelectedIndex; DeleteAllAlertsButton.Roles = AuthorityTokens.Admin.Alert.Delete; DeleteAlertButton.Roles = AuthorityTokens.Admin.Alert.Delete; SetupEventHandlers(); }
private static void WriteToDatabase(ImageServer.Common.Alert alert) { XmlDocument doc = CreateXmlContent(alert); AlertUpdateColumns columns = new AlertUpdateColumns(); columns.AlertCategoryEnum = AlertCategoryEnum.GetEnum(alert.Category.ToString()); columns.AlertLevelEnum = AlertLevelEnum.GetEnum(alert.Level.ToString()); columns.Component = alert.Source.Name; columns.Content = doc; columns.InsertTime = Platform.Time; columns.Source = alert.Source.Host; columns.TypeCode = alert.Code; IPersistentStore store = PersistentStoreRegistry.GetDefaultStore(); using (IUpdateContext ctx = store.OpenUpdateContext(UpdateContextSyncMode.Flush)) { IAlertEntityBroker alertBroker = ctx.GetBroker <IAlertEntityBroker>(); alertBroker.Insert(columns); ctx.Commit(); } }
public void Update(Guid Guid, short EnumX, string Lookup, string Description, string LongDescription) { var item = new AlertLevelEnum(); item.MarkOld(); item.IsLoaded = true; item.Guid = Guid; item.EnumX = EnumX; item.Lookup = Lookup; item.Description = Description; item.LongDescription = LongDescription; item.Save(UserName); }
public async void WriteAlertLevelCharacteristicAsync(AlertLevelEnum level) { if (!IsServiceStarted) throw new ServiceNotInitializedException(new Exception()); try { if (linkLossDeviceService == null) return; byte[] levelValue = new byte[] { (byte)level }; var response = await alertLevel.WriteValueAsync(levelValue.AsBuffer()); } catch (Exception e) { string errorMessage = e.Message; } }