/// <summary> /// Execute this step. /// </summary> protected override void ExecuteMain() { string log = string.Empty; try { this.Status = StepStatusEnum.Executing; var exporter = new DataExporter(); bool result = exporter.DoSequence(out log); if (result) { if (exporter.SuccessTableCount == exporter.SourceTableList.Count) { if (exporter.CompressAndCopyExceptions.Count <= 0) { this.Status = StepStatusEnum.Pass; this.ResultDetail = new StepResultDetail("Successfully exported data from SQL Server {0}. Total data file(s) processed: {1}".FormatWith(Settings.Default.DataExporter_ServerName, exporter.SuccessTableCount)); } else { this.Status = StepStatusEnum.Warning; this.ResultDetail = new StepResultDetail("Successfully exported data from SQL Server {0}. Total data file(s) processed: {1}. However, not all of them were compressed and copied to {2} successfully, you may need to check detailed log and then manually compress and copy them.".FormatWith(Settings.Default.DataExporter_ServerName, exporter.SuccessTableCount, Settings.Default.TransferFolder)); } } else { this.Status = StepStatusEnum.Failed; this.ResultDetail = new StepResultDetail("Error has occurred, please check log."); } } else { this.Status = StepStatusEnum.Failed; this.ResultDetail = new StepResultDetail("Error has occurred, please check log."); } } catch (Exception ex) { this.Status = StepStatusEnum.Failed; this.ResultDetail = new StepResultDetail("Error has occurred, please check log.", ExceptionHelper.CentralProcessSingle2(ex)); } finally { if (this.ResultDetail != null) { if (!string.IsNullOrEmpty(log)) { this.ResultDetail.Message += "Execution log: \r\n{0}".FormatWith(log); } Log.Info(this.ResultDetail.Message); } } }