/// <summary> /// Gets the details of the event for a member qualified /// </summary> /// <param name="eventId">The event Id</param> /// <param name="distributorId">The member Id</param> /// <param name="locale">The locale</param> /// <returns></returns> public static ServiceProvider.EventRestSvc.Event GetEventDetails(int eventId, string distributorId, string locale, bool isPublished = true) { if (eventId <= 0 || string.IsNullOrEmpty(distributorId) || string.IsNullOrEmpty(locale)) { return(null); } ServiceProvider.EventRestSvc.Event result = null; var memberCacheKey = string.Format("Member_EventDetails{0}", eventId); var eventDetailsList = HttpRuntime.Cache[memberCacheKey] as Dictionary <string, ServiceProvider.EventRestSvc.Event>; if (eventDetailsList == null || !eventDetailsList.Any() || !eventDetailsList.ContainsKey(distributorId)) { if (eventDetailsList == null) { eventDetailsList = new Dictionary <string, ServiceProvider.EventRestSvc.Event>(); } var proxy = ServiceClientProvider.GetEventDetailServiceProxy(); try { var request = new ServiceProvider.EventRestSvc.GetEventDetailsRequest() { EventId = eventId, LocaleCode = locale, MemberId = distributorId, isPublished = isPublished }; var response = proxy.GetEventDetails(request); if (response != null && response.GetEventDetailsResult != null && response.GetEventDetailsResult.errorCode == 0 && response.GetEventDetailsResult.Event != null) { result = response.GetEventDetailsResult.Event; eventDetailsList.Add(distributorId, result); } } catch (Exception ex) { LoggerHelper.Error( string.Format("GetEventDetails error calling service EventId:{0} ERR:{1}", eventId, ex.ToString())); } if (eventDetailsList.Any()) { HttpRuntime.Cache.Insert(memberCacheKey, eventDetailsList, null, DateTime.Now.AddMinutes(EventCacheMinutes), Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null); } } if (eventDetailsList != null && eventDetailsList.ContainsKey(distributorId) && result == null) { result = eventDetailsList.FirstOrDefault(e => e.Key == distributorId).Value; } return(result); }