public static EventModel LoadEventByID(long EventID) { var _event = _DL.Events.Get.ByID(EventID); // var _eventModel = new EventModel(); // Dictionary <string, string> dic = _event.Content.DocumentElement.SelectNodes("keys/key").Cast <XmlElement>() .ToDictionary(n => n.GetAttribute("name"), n => n.GetAttribute("value")); // _eventModel.Init(_event.Type.Type); // Add ApplicationID if (dic.Where(a => a.Key == "ApplicationID").Count() <= 0 && dic.Where(a => a.Key == "TagID").Count() > 0) { string TagID = dic.Where(a => a.Key == "TagID").Select(a => a.Value).First(); var tag = _DL.Tag.Get.ByID(long.Parse(TagID ?? "0")); if (tag != null) { dic.Add("ApplicationID", tag.ApplicationID.ToString()); } } // var keys = _eventModel.CheckKeys(dic); // _eventModel.FieldModel(keys); // _eventModel.Thumbnail = EventTemplate.GetThumbnail(_eventModel.Models, _eventModel.Type); // _eventModel.Content = EventTemplate.GetContent(keys, _eventModel.Type); // _eventModel.EventID = EventID; // return(_eventModel); }
public EventModel(Dictionary <string, string> dic, EN_EventType Type) { if (!EventTemplate.HasTemplate(Type)) { throw new ExodusException("Template not found"); } // Init(Type); // check keys var keys = CheckKeys(dic); // fill model FieldModel(keys); // Get Content Content = EventTemplate.GetContent(keys, Type); // Get ThumbNail Thumbnail = EventTemplate.GetThumbnail(Models, Type); // Add Event EventID = _DL.Events.Add.Event(this.Event); // Add Relations if (this.EventID != -1) { _DL.Events.Add.EventToUsers(this.EventID, RelatedUsers); } }