public static string ToDisplayString(this NotificationSection section) { switch (section) { case NotificationSection.PersonalDetails: return(typeof(PatientDetails).GetDisplayName()); case NotificationSection.HospitalDetails: return(typeof(HospitalDetails).GetDisplayName()); case NotificationSection.ClinicalDetails: return(typeof(ClinicalDetails).GetDisplayName()); case NotificationSection.TestResults: return(typeof(TestData).GetDisplayName()); case NotificationSection.ContactTracing: return(typeof(ContactTracing).GetDisplayName()); case NotificationSection.SocialRiskFactors: return(typeof(SocialRiskFactors).GetDisplayName()); case NotificationSection.TravelVisitorHistory: return("Travel/visitor history"); case NotificationSection.Comorbidities: return(typeof(ComorbidityDetails).GetDisplayName()); case NotificationSection.SocialContextAddresses: return(typeof(Notification).GetMemberDisplayName(nameof(Notification.SocialContextAddresses))); case NotificationSection.SocialContextVenues: return(typeof(Notification).GetMemberDisplayName(nameof(Notification.SocialContextVenues))); case NotificationSection.PreviousHistory: return(typeof(PreviousTbHistory).GetDisplayName()); case NotificationSection.TreatmentEvents: return(typeof(Notification).GetMemberDisplayName(nameof(Notification.TreatmentEvents))); case NotificationSection.MdrDetails: return(typeof(MDRDetails).GetDisplayName()); case NotificationSection.MBovisOtherCases: return(typeof(MBovisExposureToKnownCase).GetDisplayName()); case NotificationSection.MBovisUnpasteurisedMilk: return(typeof(MBovisUnpasteurisedMilkConsumption).GetDisplayName()); case NotificationSection.MBovisOccupation: return(typeof(MBovisOccupationExposure).GetDisplayName()); case NotificationSection.MBovisAnimalExposure: return(typeof(MBovisAnimalExposure).GetDisplayName()); default: throw new ArgumentOutOfRangeException(nameof(section), section, null); } }
public static string ToSubPath(this NotificationSection section) { switch (section) { case NotificationSection.PersonalDetails: return(NotificationSubPaths.EditPatientDetails); case NotificationSection.HospitalDetails: return(NotificationSubPaths.EditHospitalDetails); case NotificationSection.ClinicalDetails: return(NotificationSubPaths.EditClinicalDetails); case NotificationSection.TestResults: return(NotificationSubPaths.EditTestResults); case NotificationSection.ContactTracing: return(NotificationSubPaths.EditContactTracing); case NotificationSection.SocialRiskFactors: return(NotificationSubPaths.EditSocialRiskFactors); case NotificationSection.TravelVisitorHistory: return(NotificationSubPaths.EditTravel); case NotificationSection.Comorbidities: return(NotificationSubPaths.EditComorbidities); case NotificationSection.SocialContextAddresses: return(NotificationSubPaths.EditSocialContextAddresses); case NotificationSection.SocialContextVenues: return(NotificationSubPaths.EditSocialContextVenues); case NotificationSection.PreviousHistory: return(NotificationSubPaths.EditPreviousHistory); case NotificationSection.TreatmentEvents: return(NotificationSubPaths.EditTreatmentEvents); case NotificationSection.MdrDetails: return(NotificationSubPaths.EditMDRDetails); case NotificationSection.MBovisOtherCases: return(NotificationSubPaths.EditMBovisExposureToKnownCases); case NotificationSection.MBovisUnpasteurisedMilk: return(NotificationSubPaths.EditMBovisUnpasteurisedMilkConsumptions); case NotificationSection.MBovisOccupation: return(NotificationSubPaths.EditMBovisOccupationExposures); case NotificationSection.MBovisAnimalExposure: return(NotificationSubPaths.EditMBovisAnimalExposures); default: throw new ArgumentOutOfRangeException(nameof(section), section, null); } }
public static bool IsMBovis(this NotificationSection section) { // ReSharper disable once SwitchStatementHandlesSomeKnownEnumValuesWithDefault switch (section) { case NotificationSection.MBovisOtherCases: case NotificationSection.MBovisUnpasteurisedMilk: case NotificationSection.MBovisOccupation: case NotificationSection.MBovisAnimalExposure: return(true); default: return(false); } }
private static void Initialize() { if (!_initialized) { lock (_lock) { if (!_initialized) { try { NotificationSection section = ConfigurationManager.GetSection("lionsguard/notification") as NotificationSection; if (section != null) { _providers = new NotificationProviderCollection(); ProvidersHelper.InstantiateProviders(section.Providers, _providers, typeof(NotificationProvider)); _provider = _providers[section.DefaultProvider]; if (_provider == null) { throw new ConfigurationErrorsException("Default NotificationProvider not found in application configuration file.", section.ElementInformation.Properties["defaultProvider"].Source, section.ElementInformation.Properties["defaultProvider"].LineNumber); } if (!String.IsNullOrEmpty(section.AdminEmail)) { _adminEmail = section.AdminEmail; } if (!String.IsNullOrEmpty(section.EmailSubject)) { _emailSubject = section.EmailSubject; } if (!String.IsNullOrEmpty(section.SmtpServer)) { _smtpServer = section.SmtpServer; } } } catch (Exception ex) { _initException = ex; } _initialized = true; } } } if (_initException != null) { throw _initException; } }
private static void AddErrorMessagesIntoDictionary(NotificationSection displayName, List <string> errorMessages) { if (errorMessages == null || errorMessages.Count == 0) { return; } if (!NotifyErrorDictionary.ContainsKey(displayName)) { NotifyErrorDictionary.Add(displayName, errorMessages); } else { NotifyErrorDictionary[displayName].AddRange(errorMessages); } }
public static bool IsMdr(this NotificationSection section) { return(section == NotificationSection.MdrDetails); }