コード例 #1
0
ファイル: HeatDataRepository.cs プロジェクト: c0d3m0nky/mty
 public HeatDataRepository(OenContext oenContext, HotmailHeatContext heatContext)
 {
     _oenContext = oenContext;
     _heatContext = heatContext;
 }
コード例 #2
0
        public CancelOnBulkingSettings(OenContext context)
            : base(context)
        {
            var settings = Context.Settings.ToArray();
            var missingSettings = new List<string>();
            
            if (ConfigurationManager.AppSettings[SmtpServerName] != null)
            {
                SmtpServer = ConfigurationManager.AppSettings[SmtpServerName];
            }
            else
            {
                missingSettings.Add(SmtpServerName);
            }

            var setting = settings.FirstOrDefault(s => s.Name == EnabledName);
            bool outB = false;

            if (setting != null && bool.TryParse(setting.Value,out outB))
            {
                Enabled = outB;
            }
            else
            {
                missingSettings.Add(EnabledName);
            }

            setting = settings.FirstOrDefault(s => s.Name == NotifyEmailsName);

            if (setting != null)
            {
                NotifyEmails = setting.Value.Split(NotifyEmailsDelimeter)
                       .Select(e => e.Trim())
                       .ToArray();
            }
            else
            {
                missingSettings.Add(NotifyEmailsName);
            }

            setting = settings.FirstOrDefault(s => s.Name == RunIntervalName);

            if (setting != null)
            {
                RunIntervalMinutes = int.Parse(setting.Value);
            }
            else
            {
                missingSettings.Add(RunIntervalName);
            }

            setting = settings.FirstOrDefault(s => s.Name == MinimumRecordsName);

            if (setting != null)
            {
                MinimumRecords = int.Parse(setting.Value);
            }
            else
            {
                missingSettings.Add(MinimumRecordsName);
            }

            setting = settings.FirstOrDefault(s => s.Name == MinimumInboxingName);

            if (setting != null)
            {
                MinimumInboxing = int.Parse(setting.Value);
            }
            else
            {
                missingSettings.Add(MinimumInboxingName);
            }

            setting = settings.FirstOrDefault(s => s.Name == ResetTimeName);

            if (setting != null)
            {
                ResetTime = TimeSpan.Parse(setting.Value);
            }
            else
            {
                missingSettings.Add(ResetTimeName);
            }

            if (missingSettings.Any())
            {
                throw new Exception(string.Format("Missing setting(s) {0}", string.Join(", ", missingSettings)));
            }

        }