private void PublishEvents() { try { _emailService.EmailServerAccount = _fsWebService.GetEmailServerConfiguration(); if (!_emailService.IsValid()) { FotoShoutUtils.Log.LogManager.Error(_logger, "There is not enough email server info, so there will be no email sent out to guests for this event.\r\n"); } } catch (HttpClientServiceException ex) { FotoShoutUtils.Log.LogManager.Error(_logger, ex.Message + "\r\n"); } catch (Exception ex) { FotoShoutUtils.Log.LogManager.Error(_logger, ex.ToString() + "\r\n"); } try { IEnumerable <EventTDO> tdos = _fsWebService.GetEvents("Open"); if (!tdos.Any()) { FotoShoutUtils.Log.LogManager.Info(_logger, "There is no opening events for the current user.\r\n"); return; } foreach (EventTDO tdo in tdos) { EventTDO ev = _fsWebService.GetEvent(tdo.EventId); PostProcessEvent(ev); PublishEvent(ev); } } catch (Exception ex) { FotoShoutUtils.Log.LogManager.Error(_logger, ex.ToString() + "\r\n"); } }
private void UploadEventsData() { FotoShoutUtils.Log.LogManager.Info(_logger, "Getting events..."); IEnumerable <EventTDO> events = _fsClientService.GetEvents("Open"); if (!events.Any()) { FotoShoutUtils.Log.LogManager.Info(_logger, "There is no events in the local machine for the current FotoShout user."); return; } IEnumerable <EventTDO> serverEvents = _fsServerService.GetEvents("All"); foreach (EventTDO ev in events) { bool processSync = (!string.IsNullOrEmpty(AppConfig.SyncAction) && !AppConfig.SyncAction.Equals(FotoShoutUtils.Constants.ASV_SYNCACTION_PROVISION, StringComparison.InvariantCultureIgnoreCase)); if (!processSync) { EventTDO serverEvent = serverEvents.Where(se => se.EventId == ev.EventId && se.EventName.Equals(ev.EventName, StringComparison.InvariantCulture)).SingleOrDefault(); processSync = (serverEvent != null); } if (processSync) { UploadEventData(ev); } else { FotoShoutUtils.Log.LogManager.Info(_logger, string.Format("The \"{0}\" event was locally created on the PC, so its photos won't be uploaded to the central server.", ev.EventName)); } } }