/// <summary> /// Returns the categories for the given EventPattern as a comma delimited string. /// </summary> /// <param name="e"></param> /// <returns></returns> public static string GetCategoryText(EventLR e) { var dal = XmlDal.DataModel; var text = ""; foreach (var item in e.Categories) { // ReSharper disable ConvertIfStatementToConditionalTernaryExpression if (String.IsNullOrEmpty(text)) { var category = dal.GetCategory(item.CategoryId); if (category == null) { text = "null"; } else if (category.Name == null) { text = "null"; } else { text = category.Name; } } else { var name = (dal.GetCategory(item.CategoryId) == null) ? "null" : dal.GetCategory(item.CategoryId).Name ?? "null"; text = $"{text}, {name}"; } // ReSharper restore ConvertIfStatementToConditionalTernaryExpression } return(text); }
public void Add(EventLR e) { var model = EventService.Add(); model.Item = e; Add(model); }
public static EventModel Add() { var e = new EventLR { ValueNames = GetValueNames() }; return(Add(e)); }
private EventLR GetCurrentSelectedRowItem() { EventLR model = null; if (dgvEvents.CurrentRow != null) { model = (EventLR)dgvEvents.CurrentRow.DataBoundItem; } return(model); }
public static EventModel Add(EventLR item) { var model = XmlDal.DataModel; return(new EventModel { Mode = InputMode.Add, SaveEventEvent = Save, Item = item, Events = model.EventsModel.Events.OrderBy(n => n.ToString()).ToList(), Categories = model.CategoriesModel.Categories.OrderBy(n => n.Name).ToList(), SourceTypes = model.Options.FileTypes.OrderBy(n => n).ToList(), }); }
/// <summary> /// Loads a single EventPattern into the Property object /// </summary> private static void LoadEvent(PropertyLookup p, EventLR value) { p.Event = value; if (value == null) { return; } p.EventIds.Add(value.EventId); var data = XmlDal.DataModel; p.Category = EventService.GetCategoryText(value); p.Categories = value.Categories; var e = data.GetEvent(value.FoldingEventId); if (e != null) { p.EndingEvent = e.ToString(); } }
public void AddEvent(EventLR e) { MainViewModel.AddEvent(e); }
public string GetCategoryText(EventLR item) { return(EventService.GetCategoryText(item)); }
public static void AddEvent(EventLR e) { _mEventViewModel.Add(e); }