Пример #1
0
        public void OnCallBack(Timer timer)
        {
            if (executing)
            {
                if (SmsGeneratorTimeOut.IsNull(0) > 0)
                {
                    timer.Change(SmsGeneratorTimeOut, Timeout.Infinite);
                }
                return;
            }

            executing = true;

            using (UnitOfWork unitOfWork = new UnitOfWork(new SimpleDataLayer(SenderHelper.GetConnection())))
            {
                if (SmsGeneratorTimeOut.IsNull(0) == 0)
                {
                    SmsGeneratorTimeOut = Convert.ToInt32(ConfigurationStatic.GetParameterValue(@"DoSoSmsGeneratorTimeOut", unitOfWork));
                }

                string exception = string.Empty;

                try
                {
                    var schedules = unitOfWork.Query <DoSoSmsSchedule>().Where(x => x.NextExecutionDate < DateTime.Now && x.IsActive && x.ExpiredOn == null);

                    foreach (var schedule in schedules)
                    {
                        exception += GenerateSmsFromSchedule(schedule, unitOfWork);
                    }
                }

                catch (Exception ex)
                { SenderHelper.CreateLogFileWithException(ex.ToString()); }

                if (!string.IsNullOrWhiteSpace(exception))
                {
                    SenderHelper.CreateLogFileWithException(exception);
                }

                if (SmsGeneratorTimeOut.IsNull(0) > 0)
                {
                    timer.Change(SmsGeneratorTimeOut, Timeout.Infinite);
                }
                executing = false;
            }
        }
Пример #2
0
        static void GetConfiguration(UnitOfWork unitOfWork)
        {
            if (ConfigurationWasTaken)
            {
                return;
            }
            try
            {
                SmtpServer            = ConfigurationStatic.GetParameterValue(@"DoSoEmailSmtpServer", unitOfWork);
                SmtpPort              = Convert.ToInt32(ConfigurationStatic.GetParameterValue(@"DoSoEmailSmtpPort", unitOfWork));
                SmtpEnableSsl         = Convert.ToBoolean(ConfigurationStatic.GetParameterValue(@"DoSoEmailEnableSslr", unitOfWork));
                UseDefaultCredentials = Convert.ToBoolean(ConfigurationStatic.GetParameterValue(@"DoSoEmailUseDefaultCredentials", unitOfWork));
                SmtpUserName          = ConfigurationStatic.GetParameterValue(@"DoSoEmailSmtpUserName", unitOfWork);
                SmtpPassword          = ConfigurationStatic.GetParameterValue(@"DoSoEmailSmtpPassword", unitOfWork);
                MailFrom              = ConfigurationStatic.GetParameterValue(@"DoSoEmailMailFrom", unitOfWork);
                EmailSendingTimeOut   = Convert.ToInt32(ConfigurationStatic.GetParameterValue(@"DoSoEmailSendingTimeOut", unitOfWork));

                ConfigurationWasTaken = true;
            }
            catch (Exception ex)
            {
                GeneratorHelper.CreateLogFileWithException(ex.ToString());
            }
        }
Пример #3
0
        static void GetConfiguration(UnitOfWork unitOfWork)
        {
            if (ConfigurationWasTaken)
            {
                return;
            }
            try
            {
                //var smsClientUsername = ConfigurationStatic.GetParameterValue(@"DoSoSmsClientUsername", unitOfWork);
                //var smsClientPassword = ConfigurationStatic.GetParameterValue(@"DoSoSmsClientPassword", unitOfWork);
                smsClientID = ConfigurationStatic.GetParameterValue(@"DoSoSmsClientID", unitOfWork);
                //var smsServiceID = ConfigurationStatic.GetParameterValue(@"DoSoSmsServiceID", unitOfWork);
                SmsSendingTimeOut = Convert.ToInt32(ConfigurationStatic.GetParameterValue(@"DoSoSmsSendingTimeOut", unitOfWork));
                smsBaseUrl        = ConfigurationStatic.GetParameterValue(@"DoSoSmsBaseUrl", unitOfWork);
                smsSenderName     = ConfigurationStatic.GetParameterValue(@"DoSoSmsSenderName", unitOfWork);
                smsSuccessCode    = ConfigurationStatic.GetParameterValue(@"DoSoSmssmsSuccessCode", unitOfWork);

                ConfigurationWasTaken = true;
            }
            catch (Exception ex)
            {
                GeneratorHelper.CreateLogFileWithException(ex.ToString());
            }
        }
Пример #4
0
        private void ConfigurationStaticController_EditValueChanged(object sender, EventArgs e, ConfigurationStatic config)
        {
            var edit     = sender as BaseEdit;
            var newvalue = edit.EditValue;

            config.ParameterValue = newvalue.ToString();
        }