Пример #1
0
 private static async Task GetFileBDWJobAsync()
 {
     using (var client = new CSMFileServiceClient())
     {
         Task <ImportBDWTaskResponse> t      = client.GetFileBDWAsync(WebConfig.GetWebUsername(), WebConfig.GetWebPassword(), true);
         ImportBDWTaskResponse        result = await t;
     }
 }
Пример #2
0
        private static void SendMailTask(ImportBDWTaskResponse result)
        {
            _mailSender = TaskMailSender.GetTaskMailSender();

            if (result.NumOfError > 0)
            {
                _mailSender.NotifyImportContactSuccess(WebConfig.GetTaskEmailToAddress(), result);
            }

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

            Thread.Sleep(5000);
        }
Пример #3
0
        public void SaveLogSuccessOrFail(ImportBDWTaskResponse taskResponse)
        {
            if (taskResponse != null)
            {
                StringBuilder sb = new StringBuilder("");
                sb.AppendFormat("วัน เวลาที่ run task scheduler = {0}\n",
                                taskResponse.SchedDateTime.FormatDateTime(Constants.DateTimeFormat.DefaultFullDateTime));
                sb.AppendFormat("ElapsedTime = {0} (ms)\n", taskResponse.ElapsedTime);
                sb.Append(taskResponse.ToString());

                _auditLog           = new AuditLogEntity();
                _auditLog.Module    = Constants.Module.Batch;
                _auditLog.Action    = Constants.AuditAction.ImportBDW;
                _auditLog.IpAddress = ApplicationHelpers.GetClientIP();
                _auditLog.Status    = (taskResponse.StatusResponse.Status == Constants.StatusResponse.Failed) ? LogStatus.Fail : LogStatus.Success;
                _auditLog.Detail    = sb.ToString();
                AppLog.AuditLog(_auditLog);
            }
        }