private static async Task ReSubmitActivityToCBSHPSystem() { using (var client = new CSMSRServiceClient()) { Task <ReSubmitActivityToCBSHPSystemTaskResponse> t = client.ReSubmitActivityToCBSHPSystemAsync(WebConfig.GetWebUsername(), WebConfig.GetWebPassword()); ReSubmitActivityToCBSHPSystemTaskResponse result = await t; } }
public static void ReSubmitActivityToCBSHPSystem() { try { Logger.Info("I:--START--"); Task <ReSubmitActivityToCBSHPSystemTaskResponse> task; using (var client = new CSMSRServiceClient()) { task = client.ReSubmitActivityToCBSHPSystemAsync(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.NotifyReSubmitActivityToCBSHPSystemFailed(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.NotifyReSubmitActivityToCBSHPSystemFailed(WebConfig.GetTaskEmailToAddress(), DateTime.Now, new AggregateException(ex)); Thread.Sleep(5000); } }
private static async Task ReSubmitActivityToCBSHPSystem() { using (var client = new CSMSRServiceClient()) { Task <CSM.Service.Messages.SchedTask.ReSubmitActivityToCBSHPSystemTaskResponse> t = client.ReSubmitActivityToCBSHPSystemAsync(WebConfig.GetWebUsername(), WebConfig.GetWebPassword()); CSM.Service.Messages.SchedTask.ReSubmitActivityToCBSHPSystemTaskResponse result = await t.ConfigureAwait(false); } }