Exemple #1
0
        public Messenger(IConfiguration config, JobConfigRepo jobRepo, MessageRepo msgRepo, ExecutionRepo execRepo, SmtpConfigRepo smtpConfigRepo)
        {
            _config         = config;
            _jobRepo        = jobRepo;
            _msgRepo        = msgRepo;
            _execRepo       = execRepo;
            _smtpConfigRepo = smtpConfigRepo;

            _sqlClient = new SQLClientAdo();

            string configToExecute = _config["ExecuteOptions:JobName"];
            string smtpConfigName  = _config["ExecuteOptions:SmtpConfigName"];

            var jobConfig  = _jobRepo.GetByJobName(configToExecute);
            var smtpConfig = _smtpConfigRepo.GetByConfigName(smtpConfigName);

            //Create execution object to run job
            Execution = new Execution()
            {
                SysUser    = _config["ExecuteOptions:Caller"],
                StartTime  = DateTime.Now,
                JobConfig  = jobConfig,
                SmtpConfig = smtpConfig
            };

            _emailSender = new EmailSender(Execution.SmtpConfig);
        }
Exemple #2
0
        private void ProcessNew()
        {
            var sqlClientAdo = new SQLClientAdo();

            //Rows with name/value pairs for template matching
            dbRows = sqlClientAdo.GetDbRows(Execution.JobConfig);
            foreach (DbRow row in dbRows)
            {
                Message msg = row.GetMessage(Execution.Config.Sender);

                if (msg.Status != MessageStatus.Sent)
                {
                    Execution.NewSendFails++;
                }

                _msgRepo.Create(msg);
            }
        }
Exemple #3
0
        public void GetDbRows()
        {
            var sqlClientDAL = new SQLClientAdo();

            JobConfig cfg = new JobConfig()
            {
                ConnectionString = "Server=(localdb)\\MSSQLLocalDB;Database=Camris;Trusted_Connection=True;MultipleActiveResultSets=true",
                JobName          = "MedicaidCoverageChange",
                SenderAddress    = "*****@*****.**",
                ViewName         = "vwMedicaidCoverageChange",
                SenderName       = "Frank Linden"
            };
            //var actual = sqlClientDAL.GetDbRows(
            //    cfg);



            //    var expected = new List<DbViewRow>().FromJsonPath("SQLClientDAL\\GetMessages\\expected1.json").ToList();

            //    Assert.True(actual.IsEqual(expected));
        }
Exemple #4
0
        public Messenger(IConfiguration config, SyncConfigRepo configRepo, MessageRepo msgRepo, SyncExecutionRepo execRepo)
        {
            _config         = config;
            _syncConfigRepo = configRepo;
            _msgRepo        = msgRepo;
            _execRepo       = execRepo;

            _sqlClient = new SQLClientAdo();

            string configToExecute = _config["ExecuteOptions:JobName"];
            string smtpConfigName  = _config["ExecuteOptions:SmtpConfigName"];

            var syncConfig = _syncConfigRepo.GetByConfigName(configToExecute);


            //Create execution object to run job
            Execution = new SyncExecution()
            {
                SysUser   = _config["ExecuteOptions:Caller"],
                StartTime = DateTime.Now,
                Config    = syncConfig
            };
        }