コード例 #1
0
ファイル: ReadFileHpProcess.cs プロジェクト: KKPBank/CSM
        private static void SendMailTask(ImportHpTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            if (Constants.StatusResponse.Success.Equals(result.StatusResponse.Status) && result.NumOfError > 0)
            {
                _mailSender.NotifyImportHPSuccess(WebConfig.GetTaskEmailToAddress(), result);
            }

            #region "กรณี File not found ไม่ส่งเมล์"
            //if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status) && result.FileList.Length > 0)
            //{
            //    if (!string.IsNullOrEmpty(result.FileList[0].ToString()))
            //    {
            //        _mailSender.NotifyImportHPFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.Description);
            //    }
            //}
            #endregion

            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyImportHPFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.Description);
            }

            Thread.Sleep(5000);
        }
コード例 #2
0
        private static void SendMailTask(ExportNCBTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyFailExportActvity(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.Description);
            }

            Thread.Sleep(5000);
        }
コード例 #3
0
ファイル: ServiceRequestProcess.cs プロジェクト: KKPBank/CSM
        private static void SendMailTask(CreateSrFromReplyEmailTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            if (Constants.StatusResponse.Success.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyCreateSrFromReplyEmailSuccess(WebConfig.GetTaskEmailToAddress(), result);
            }
            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyCreateSrFromReplyEmailFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.ErrorCode);
            }

            Thread.Sleep(5000);
        }
コード例 #4
0
ファイル: ServiceRequestProcess.cs プロジェクト: KKPBank/CSM
        private static void SendMailTask(ReSubmitActivityToCBSHPSystemTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            if (Constants.StatusResponse.Success.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyReSubmitActivityToCBSHPSystemSuccess(WebConfig.GetTaskEmailToAddress(), result);
            }
            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyReSubmitActivityToCBSHPSystemFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.ErrorCode);
            }

            Thread.Sleep(5000);
        }
コード例 #5
0
        private static void SendMailTask(ExportAFSTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            //if (Constants.StatusResponse.Success.Equals(result.StatusResponse.Status))
            //{
            //    _mailSender.NotifyExportActivitySuccess(WebConfig.GetTaskEmailToAddress(), result);
            //}
            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyExportActivityFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.Description);
            }

            Thread.Sleep(5000);
        }
コード例 #6
0
        private static void SendMailTask(ImportAFSTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            if (result.NumOfErrProp > 0 || result.NumOfErrSaleZone > 0)
            {
                _mailSender.NotifyImportAssetSuccess(WebConfig.GetTaskEmailToAddress(), result);
            }
            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyImportAssetFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.Description);
            }

            Thread.Sleep(5000);
        }
コード例 #7
0
ファイル: ReadFileCisProcess.cs プロジェクト: KKPBank/CSM
        private static void SendMailTask(ImportCISTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();
            if ((result.NumOfErrCor > 0) || (result.NumOfErrIndiv > 0) || (result.NumOfErrSub > 0) || (result.FileErrorList != null && result.FileErrorList.Length > 0))
            {
                _mailSender.NotifyImportCISFailed(WebConfig.GetTaskEmailToAddress(), result);
            }
            if (Constants.StatusResponse.Failed.Equals(result.StatusResponse.Status))
            {
                _mailSender.NotifyImportCISFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, result.StatusResponse.Description);
            }

            Thread.Sleep(5000);
        }
コード例 #8
0
ファイル: ServiceRequestProcess.cs プロジェクト: KKPBank/CSM
        public static void ReSubmitActivityToCARSystem()
        {
            try
            {
                Logger.Info("I:--START--");

                Task <ReSubmitActivityToCARSystemTaskResponse> task;
                using (var client = new CSMSRServiceClient())
                {
                    task = client.ReSubmitActivityToCARSystemAsync(WebConfig.GetTaskUsername(),
                                                                   WebConfig.GetTaskPassword());
                }

                while (!task.IsCompleted)
                {
                    Thread.Sleep(1000);
                }

                if (task.Exception != null)
                {
                    Logger.InfoFormat("O:--FAILED--:Exception/{0}", task.Exception);
                    Logger.Error("Exception occur:\n", task.Exception);

                    // Send mail to system administrator
                    _mailSender = TaskMailSender.GetTaskMailSender();
                    _mailSender.NotifyReSubmitActivityToCARSystemFailed(WebConfig.GetTaskEmailToAddress(), DateTime.Now, task.Exception);
                    Thread.Sleep(5000);
                }
                //else
                //{
                //    var result = task.GetAwaiter().GetResult();
                //    Logger.InfoFormat("O:--SUCCESS--:Task Result/{0}", result);

                //    // Send mail to system administrator
                //    SendMailTask(result);
                //}
            }
            catch (Exception ex)
            {
                Logger.InfoFormat("O:--FAILED--:Exception/{0}", ex.Message);
                Logger.Error("Exception occur:\n", ex);

                // Send mail to system administrator
                _mailSender = TaskMailSender.GetTaskMailSender();
                _mailSender.NotifyReSubmitActivityToCARSystemFailed(WebConfig.GetTaskEmailToAddress(), DateTime.Now, new AggregateException(ex));
                Thread.Sleep(5000);
            }
        }
コード例 #9
0
ファイル: MailProcess.cs プロジェクト: KKPBank/CSM
        public static void GetMailboxJobAsync()
        {
            try
            {
                Logger.Info("I:--START--");

                Task <JobTaskResponse> task;
                using (var client = new CSMMailServiceClient())
                {
                    task = client.GetMailboxAsync(WebConfig.GetTaskUsername(), WebConfig.GetTaskPassword());
                }

                while (!task.IsCompleted)
                {
                    Thread.Sleep(1000);
                }

                if (task.Exception != null)
                {
                    Logger.InfoFormat("O:--FAILED--:Exception/{0}", task.Exception);
                    Logger.Error("Exception occur:\n", task.Exception);

                    // Send mail to system administrator
                    _mailSender = TaskMailSender.GetTaskMailSender();
                    _mailSender.NotifySyncEmailFailed(WebConfig.GetTaskEmailToAddress(), DateTime.Now, task.Exception);
                    Thread.Sleep(5000);
                }
                else
                {
                    var result = task.GetAwaiter().GetResult();
                    Logger.InfoFormat("O:--SUCCESS--:Schedule DateTime/{0}:", result.SchedDateTime);

                    // Send mail to system administrator
                    SendMailTask(result);
                }
            }
            catch (Exception ex)
            {
                Logger.InfoFormat("O:--FAILED--:Exception/{0}", ex.Message);
                Logger.Error("Exception occur:\n", ex);

                // Send mail to system administrator
                _mailSender = TaskMailSender.GetTaskMailSender();
                _mailSender.NotifySyncEmailFailed(WebConfig.GetTaskEmailToAddress(), DateTime.Now, new AggregateException(ex));
                Thread.Sleep(5000);
            }
        }
コード例 #10
0
ファイル: MailProcess.cs プロジェクト: KKPBank/CSM
        private static void SendMailTask(JobTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();

            if (result.JobTaskResults != null && result.JobTaskResults.Length > 0)
            {
                foreach (var task in result.JobTaskResults.Where(x => x.StatusResponse.Status == Constants.StatusResponse.Failed))
                {
                    _mailSender.NotifySyncEmailFailed(WebConfig.GetTaskEmailToAddress(), result.SchedDateTime, task.StatusResponse.Description);
                }
            }
            else
            {
                Logger.InfoFormat("O:--Unable to Send Email Notification--:Total Results/{0}", 0);
            }

            Thread.Sleep(5000);
        }