//========== END TAMPIL DATA DIMENSI DAN FAKTA ========== //========== ETL UPDATE DATA MART ========== private void btnUpdateETL_Click(object sender, EventArgs e) { try { splashScreenManager1.ShowWaitForm(); Cursor.Current = Cursors.WaitCursor; string lokasi = Environment.CurrentDirectory.ToString() + "\\Resources\\Package.dtsx"; DTSExecResult pkgResults_Sql; Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); Microsoft.SqlServer.Dts.Runtime.Package pkg = new Microsoft.SqlServer.Dts.Runtime.Package(); pkg = app.LoadPackage(lokasi, null); pkgResults_Sql = pkg.Execute(); splashScreenManager1.CloseWaitForm(); MessageBox.Show("Data berhasil di-Update.", "Pesan", MessageBoxButtons.OK, MessageBoxIcon.Information); TampilData(); } catch (System.Exception f) { MessageBox.Show(f.Message); } finally { Cursor.Current = Cursors.Default; } }
private void RunPackage(Extraction extraction, ExtractionJob job, ExtractionTrigger extractionTrigger) { var packagePath = extraction.PackagePath + extraction.PackageName + ".dtsx"; dts.Package package = _app.LoadPackage(packagePath, null); Log.WriteErrorLog(string.Format("Starting package execution for {0}-{1}.", _serviceName, extraction.Title)); //Update tigger to Running extractionTrigger.Status = PackageStatus.Running; extractionTrigger.Remark = "Package currently running..."; _dataManager.UpdateExtractionTrigger(_connectionString, extractionTrigger); //DD-mon-YYYY extraction.ScriptText = extraction.ScriptText.Replace("@StartDate", job.StartDate.GetOracleDate()); extraction.ScriptText = extraction.ScriptText.Replace("@EndDate", job.EndDate.GetOracleDate()); extraction.ScriptText = extraction.ScriptText.Replace("@FYYear", string.Format("FY{0}", job.EndDate.Year.ToString())); extraction.ScriptText = extraction.ScriptText.Replace("@Year", string.Format("{0}", job.EndDate.Year.ToString())); extraction.ScriptText = extraction.ScriptText.Replace("@Period", string.Format("M{0}", job.EndDate.Month.ToString().PadLeft(2, '0'))); package.Variables["StorProc"].Value = extraction.ScriptText;//"Script", true, "", extraction.ScriptText); var result = package.Execute(); if (result == dts.DTSExecResult.Success) { int ssisDuration = 0; //int.TryParse(Math.Round((package.ExecutionDuration / 1000.00), 2).ToString(), out ssisDuration); ssisDuration = (package.ExecutionDuration / 1000); Log.WriteErrorLog(string.Format("Package execution for {0}-{1} successfull.", _serviceName, extraction.Title)); //Update tigger to Done extractionTrigger.Status = PackageStatus.Done; //extractionTrigger.Remark = string.Format("{0}{1}lines extracted ({2})", string.Format("Package {0}-{1} successfully executed: ", _serviceName, extraction.Title), package.Variables["RecCount"].Value.ToString(), DateTimeExtensions.GetRealTime(ssisDuration)); extractionTrigger.Remark = string.Format("{0}{1}lines extracted ({2})", string.Format("Package {0}-{1} successfully executed: ", _serviceName, extraction.Title), package.Variables["RecCount"].Value.ToString(), HHMMSS(ssisDuration)); _dataManager.UpdateExtractionTrigger(_connectionString, extractionTrigger); //_Exp = _ProcessName & ": " & _ssisCount & " lines extracted (" & HHMMSS(_ssisDuration) & ")" } else { string errorMessage = string.Empty; foreach (var error in package.Errors) { errorMessage += error.Description; } Log.WriteErrorLog(string.Format("Package execution for {0}-{1} failed.{2}", _serviceName, extraction.Title, errorMessage)); //Update tigger to Fail extractionTrigger.Status = PackageStatus.Fail; extractionTrigger.Remark = string.Format("Package {0}-{1} failed.", _serviceName, extraction.Title) + "\n" + errorMessage; _dataManager.UpdateExtractionTrigger(_connectionString, extractionTrigger); } }
public void ExecutePackage() { string strPackagePath = @"C:\jinshan\SSISWork\SSIS_World\ISExtensions\ISExtensions\winForm.dtsx"; SSIS_Runtime.Application oApp = new SSIS_Runtime.Application(); SSIS_Runtime.Package oPackage = new SSIS_Runtime.Package(); oPackage = oApp.LoadPackage(strPackagePath, null); oPackage.Variables["Myvar"].Value = textBox1.Text.Trim(); //oPackage.Variables["MyParameter"].Value = textBox2.Text.Trim(); oPackage.Execute(); MessageBox.Show("Package Executed!"); }
public static DtsExecutionResult RunPackage(string path, Dictionary <string, Object> parameters) { DtsExecutionResult result = null; Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); Microsoft.SqlServer.Dts.Runtime.Package package = null; package = app.LoadPackage(path, null, false); var x = package.Variables; foreach (var item in x) { string p = item.Name; //Debug.Print(p.ToString()); if (parameters.ContainsKey(p)) { item.Value = parameters[item.Name]; } } Microsoft.SqlServer.Dts.Runtime.DTSExecResult results = package.Execute(); if (results == DTSExecResult.Failure) { foreach (var item in package.Errors) { string s = string.Format("{0}{1}{2}{1}{3}{1}{4}", item.Description, Environment.NewLine, item.ErrorCode, item.Source, item.SubComponent); Exception ex = new Exception(s); logger.Log(ex); } } result = new DtsExecutionResult(results); foreach (var item in package.Variables) { if (!item.SystemVariable) { result.Add(item.Name, item.Value); } } return(result); }
public ActionResult DownloadBrewReport(String _BatchKey, bool CreateLogFile = false) { // Parameterhandling const string FILENAME_TYPE = "xlsx"; const string EXCEL_TEMPLATE_NAME = "ExcelReport_BatchBrew_Template" + "." + FILENAME_TYPE; const string SSIS_PACKAGE = "ExcelReport_BatchBrew.dtsx"; const string FOLDER_BASE_SOURCE = "Areas\\PlantiT.Web.HeinekenMassafra.MES\\Excel"; const string FOLDER_BIN = "bin"; const string FOLDER_TEMPLATE = "template"; const string FOLDER_BASE_OUTPUT = "Areas\\PlantiT.Web.HeinekenMassafra.MES\\Excel\\output"; const string LOG_FILE_NAME = "DownloadBrewBatch_Log.txt"; const int WAITTIME_IN_MS = 1000; const int MAXWAITTIME_IN_MS = 30000; String sLocation = Assembly.GetExecutingAssembly().Location; // Get current directory Logger logger = null; long nBatchKey = 0; string sBatchName = String.Empty; string sBatchNumber = String.Empty; string sSAPMaterial = String.Empty; string sSAP_Batch = String.Empty; string sBrewLine = String.Empty; string sShortMaterial = String.Empty; string sSourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, FOLDER_BASE_SOURCE); string sDestinationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, FOLDER_BASE_OUTPUT); string sDestinationFilePath = String.Empty; string sFileName = String.Empty; DateTime dtCheckTime = DateTime.Now; List <CBatch> listBatch = null; // Log generieren if (CreateLogFile) { logger = new Logger(Path.Combine(sDestinationPath, LOG_FILE_NAME), true); } // Batch Key ermitteln try { nBatchKey = Convert.ToInt64(_BatchKey); } catch { return(new HttpNotFoundResult(String.Format("Invalid BatchKey: {0}", _BatchKey))); } // Batchdaten ermitteln String odataURI = String.Format("odata/ods/ZWebSAPInterfaceStatuses?$select=_BatchKey,BatchName,SAPMaterial,SAP_Batch,BatchProcessStartTime&$filter=_BatchKey eq {0}", _BatchKey); PGatewayConnection gatewayConnection = DependencyResolver.Current.GetService(typeof(PGatewayConnection)) as PGatewayConnection; try { listBatch = gatewayConnection.ReadItem <CODataResponse <CBatch> >(odataURI).Value; } catch { return(new HttpNotFoundResult(String.Format("OData query invalid for BatchKey: {0}", _BatchKey))); } // Daten prüfen if (listBatch == null || listBatch.Where(x => x._BatchKey == nBatchKey).Count() == 0) { return(new HttpNotFoundResult(String.Format("Data not found for BatchKey: {0}", _BatchKey))); } // Namen von Auftrag ermitteln sBatchName = listBatch.Where(x => x._BatchKey == nBatchKey).FirstOrDefault().BatchName; sBatchNumber = sBatchName.Substring(0, 12).Substring(sBatchName.Substring(0, 12).Length - 4, 4); sSAPMaterial = listBatch.Where(x => x._BatchKey == nBatchKey).FirstOrDefault().SAPMaterial; sSAP_Batch = listBatch.Where(x => x._BatchKey == nBatchKey).FirstOrDefault().SAP_Batch; sBrewLine = sSAP_Batch.Substring(5, 1); sShortMaterial = sSAPMaterial.Substring(sSAPMaterial.Length - 5); string FILENAME_PREFIX = (listBatch.Where(x => x._BatchKey == nBatchKey).FirstOrDefault().BatchProcessStartTime).ToString("yy"); // BatchName prüfen if (sBatchName.Equals(String.Empty)) { return(new HttpNotFoundResult(String.Format("No Batchname found for BatchKey: {0}", _BatchKey))); } // Nach Datei suchen sFileName = FILENAME_PREFIX + "_" + sBatchNumber + "_" + sBrewLine + "_1_" + sShortMaterial; Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); Microsoft.SqlServer.Dts.Runtime.Package package = null; MyEventListener eventListener = new MyEventListener(); //Load the SSIS Package which will be executed app.PackagePassword = "******"; String sPackageFilePath = Path.Combine(sSourcePath, FOLDER_BIN, SSIS_PACKAGE); // Execute try { // Load package package = app.LoadPackage(sPackageFilePath, eventListener); // Set values Variables vars = package.Variables; vars["User::InputBatchKey"].Value = nBatchKey; vars["User::InputDestinationFile"].Value = sFileName + "." + FILENAME_TYPE; vars["User::InputDestinationPath"].Value = sDestinationPath; vars["User::InputTemplateFilePath"].Value = Path.Combine(sSourcePath, FOLDER_TEMPLATE, EXCEL_TEMPLATE_NAME); vars["User::InputCreateLogFile"].Value = CreateLogFile; vars["User::InputLogFilePath"].Value = (logger != null) ? logger.FilePath : String.Empty; // Log erzeugen if (logger != null) { logger.Log("InputBatchKey", vars["User::InputBatchKey"].Value.ToString()); logger.Log("InputDestinationFile", vars["User::InputDestinationFile"].Value.ToString()); logger.Log("InputDestinationPath", vars["User::InputDestinationPath"].Value.ToString()); logger.Log("InputTemplateFilePath", vars["User::InputTemplateFilePath"].Value.ToString()); } vars["InputToOverwrite"].Value = true; DTSExecResult results = package.Execute(null, null, eventListener, null, null); } catch (Exception ex) { if (logger != null) { logger.Log("Error", String.Format("Error: {0} // Innermessage: {1}", ex.Message, (ex.InnerException != null) ? ex.InnerException.Message : String.Empty)); } return(new HttpNotFoundResult(String.Format("Error: {0} // Innermessage: {1}", ex.Message, (ex.InnerException != null) ? ex.InnerException.Message : String.Empty))); } // zyklisch prüfen ob Datei vorhanden ist, maximal MAXWAITTIME_IN_MS for (int i = 0; i < MAXWAITTIME_IN_MS; i += WAITTIME_IN_MS) { // erstmal eine Sekunde zeit geben, zyklisch prüfen System.Threading.Thread.Sleep(WAITTIME_IN_MS); // alle Dateien des Pfades holen die dem Suchmuster entsprechen DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(sDestinationPath)); var filesInPath = dirInfo.EnumerateFiles(String.Format("{0}*.{1}", sFileName, FILENAME_TYPE)); var file = filesInPath.Where(x => x.Name.Contains(sFileName)).OrderByDescending(x => x.LastWriteTime).FirstOrDefault(); // nur welche die eben erstellt wurde if (file == null) { continue; } // Falls eben erstellt... if (file.LastWriteTime >= dtCheckTime) { // gefunden, Abbruch sFileName = file.Name; break; } } // Pfad mit Datei erzeugen sDestinationFilePath = Path.Combine(sDestinationPath, sFileName); // Datei vorhanden? if (!System.IO.File.Exists(sDestinationFilePath)) { return(new HttpNotFoundResult(String.Format("Excel file could not created for BatchKey: {0}", _BatchKey))); } // Create data return stream byte[] fileData = System.IO.File.ReadAllBytes(sDestinationFilePath); string contentType = System.Web.MimeMapping.GetMimeMapping(sDestinationFilePath); // Datei entfernen System.IO.File.Delete(sDestinationFilePath); var cd = new System.Net.Mime.ContentDisposition() { // for example foo.bak FileName = sFileName, // always prompt the user for downloading, set to true if you want // the browser to try to show the file inline Inline = false, }; Response.AppendHeader("Content-Disposition", cd.ToString()); return(File(fileData, contentType)); }
public ActionResult DownloadBatchOverviewReport(String _TemplateKey, String _1stBatchKey, String _2ndBatchKey, String _BatchTypeKey, String _MaterialKey, String StartTime, String EndTime, bool CreateLogFile = false) { const string FILENAME_PREFIX = "BatchOverview_"; //const string FILENAME_PREFIX = "BatchOverview"; const string FILENAME_TYPE = "xlsx"; const string EXCEL_TEMPLATE_NAME = "ExcelReport_BatchOverview_Template.xlsx"; const string SSIS_PACKAGE = "ExcelReport_BatchOverview.dtsx"; const string FOLDER_BASE_SOURCE = "Areas\\PlantiT.Web.HeinekenMassafra.MES\\Excel"; const string FOLDER_BIN = "bin"; const string FOLDER_TEMPLATE = "template"; const string FOLDER_BASE_OUTPUT = "Areas\\PlantiT.Web.HeinekenMassafra.MES\\Excel\\output"; //const string FOLDER_BASE_OUTPUT = "Areas\\PlantiT.Web.HeinekenMassafra.MES\\Excel\\output\\"; const string LOG_FILE_NAME = "DownloadBatchOverview_Log.txt"; const int WAITTIME_IN_MS = 1000; const int MAXWAITTIME_IN_MS = 30000; String sLocation = Assembly.GetExecutingAssembly().Location; // Get current directory Logger logger = null; long nTemplateKey = 0; long n1stBatchKey = 0; long n2ndBatchKey = 0; long nBatchTypeKey = 0; long nMaterialKey = 0; DateTime dtStartTime = DateTime.MaxValue; DateTime dtEndTime = DateTime.MinValue; string sSourcePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, FOLDER_BASE_SOURCE); string sDestinationPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, FOLDER_BASE_OUTPUT); string sDestinationFilePath = String.Empty; string sFileName = String.Empty; DateTime dtCheckTime = DateTime.Now; // Log generieren if (CreateLogFile) { logger = new Logger(Path.Combine(sDestinationPath, LOG_FILE_NAME), true); } // Parameter ermitteln // TemplateKey try { nTemplateKey = Convert.ToInt64(_TemplateKey); } catch { } // 1stBatchKey try { n1stBatchKey = Convert.ToInt64(_1stBatchKey); } catch { } // 2ndBatchKey try { n2ndBatchKey = Convert.ToInt64(_2ndBatchKey); } catch { } // BatchTypeKey try { nBatchTypeKey = Convert.ToInt64(_BatchTypeKey); } catch { } // MaterialKey try { nMaterialKey = Convert.ToInt64(_MaterialKey); } catch { } // StartTime try { dtStartTime = Convert.ToDateTime(StartTime); } catch { } // EndTime try { dtEndTime = Convert.ToDateTime(EndTime); } catch { } // Nach Datei suchen sFileName = FILENAME_PREFIX + DateTime.Now.ToString().Replace(":", "").Replace('/', '.').Replace('-', '.'); //sFileName = FILENAME_PREFIX; Microsoft.SqlServer.Dts.Runtime.Application app = new Microsoft.SqlServer.Dts.Runtime.Application(); Microsoft.SqlServer.Dts.Runtime.Package package = null; MyEventListener eventListener = new MyEventListener(); //Load the SSIS Package which will be executed app.PackagePassword = "******"; String sPackageFilePath = Path.Combine(sSourcePath, FOLDER_BIN, SSIS_PACKAGE); // Execute try { // Load package package = app.LoadPackage(sPackageFilePath, eventListener); // Set values Variables vars = package.Variables; vars["User::InputTemplateKey"].Value = nTemplateKey; vars["User::Input1stBatchKey"].Value = n1stBatchKey; vars["User::Input2ndBatchKey"].Value = n2ndBatchKey; vars["User::InputBatchTypeKey"].Value = nBatchTypeKey; vars["User::InputMaterialKey"].Value = nMaterialKey; vars["User::InputStartTime"].Value = dtStartTime; vars["User::InputEndTime"].Value = dtEndTime; vars["User::InputDestinationFile"].Value = sFileName + "." + FILENAME_TYPE; vars["User::InputDestinationPath"].Value = sDestinationPath; vars["User::InputTemplateFilePath"].Value = Path.Combine(sSourcePath, FOLDER_TEMPLATE, EXCEL_TEMPLATE_NAME); vars["User::InputCreateLogFile"].Value = CreateLogFile; vars["User::InputLogFilePath"].Value = (logger != null) ? logger.FilePath : String.Empty; // Log erzeugen if (logger != null) { logger.Log("InputTemplateKey", vars["User::InputTemplateKey"].Value.ToString()); logger.Log("Input1stBatchKey", vars["User::Input1stBatchKey"].Value.ToString()); logger.Log("Input2ndBatchKey", vars["User::Input2ndBatchKey"].Value.ToString()); logger.Log("InputBatchTypeKey", vars["User::InputBatchTypeKey"].Value.ToString()); logger.Log("InputMaterialKey", vars["User::InputMaterialKey"].Value.ToString()); logger.Log("InputStartTime", vars["User::InputStartTime"].Value.ToString()); logger.Log("InputEndTime", vars["User::InputEndTime"].Value.ToString()); logger.Log("InputDestinationFile", vars["User::InputDestinationFile"].Value.ToString()); logger.Log("InputDestinationPath", vars["User::InputDestinationPath"].Value.ToString()); logger.Log("InputTemplateFilePath", vars["User::InputTemplateFilePath"].Value.ToString()); } vars["InputToOverwrite"].Value = true; DTSExecResult results = package.Execute(null, null, eventListener, null, null); } catch (Exception ex) { if (logger != null) { logger.Log("Error", String.Format("Error: {0} // Innermessage: {1}", ex.Message, (ex.InnerException != null) ? ex.InnerException.Message : String.Empty)); } return(new HttpNotFoundResult(String.Format("Error: {0} // Innermessage: {1}", ex.Message, (ex.InnerException != null) ? ex.InnerException.Message : String.Empty))); } // zyklisch prüfen ob Datei vorhanden ist, maximal MAXWAITTIME_IN_MS for (int i = 0; i < MAXWAITTIME_IN_MS; i += WAITTIME_IN_MS) { if (package.Errors.Count > 0) { foreach (var item in package.Errors) { if (logger != null) { logger.Log("Error", item.Description); } } break; } // erstmal eine Sekunde zeit geben, zyklisch prüfen System.Threading.Thread.Sleep(WAITTIME_IN_MS); // alle Dateien des Pfades holen die dem Suchmuster entsprechen DirectoryInfo dirInfo = new DirectoryInfo(Path.Combine(sDestinationPath)); var filesInPath = dirInfo.EnumerateFiles(String.Format("{0}*.{1}", sFileName, FILENAME_TYPE)); var file = filesInPath.Where(x => x.Name.Contains(sFileName)).OrderByDescending(x => x.LastWriteTime).FirstOrDefault(); // nur welche die eben erstellt wurde if (file == null) { continue; } // Falls eben erstellt... if (file.LastWriteTime >= dtCheckTime) { // gefunden, Abbruch sFileName = file.Name; break; } } // Pfad mit Datei erzeugen sDestinationFilePath = Path.Combine(sDestinationPath, sFileName); // Datei vorhanden? if (!System.IO.File.Exists(sDestinationFilePath)) { return(new HttpNotFoundResult("Excel file could not created!")); } // Create data return stream byte[] fileData = System.IO.File.ReadAllBytes(sDestinationFilePath); string contentType = System.Web.MimeMapping.GetMimeMapping(sDestinationFilePath); // Datei entfernen System.IO.File.Delete(sDestinationFilePath); var cd = new System.Net.Mime.ContentDisposition() { // for example foo.bak FileName = sFileName, // always prompt the user for downloading, set to true if you want // the browser to try to show the file inline Inline = false, }; Response.AppendHeader("Content-Disposition", cd.ToString()); return(File(fileData, contentType)); }
private void RunPackage(Processes processes, ProcessJob job, ProcessTrigger processTrigger) { var packagePath = processes.PackagePath + processes.PackageName + ".dtsx"; dts.Package package = _app.LoadPackage(packagePath, null); Log.WriteErrorLog(string.Format("Starting package execution for {0}---{1}.", _serviceName, processes.Title)); //Update tigger to Running processTrigger.Status = PackageStatus.Running; processTrigger.Remark = "Package currently running..."; _dataManager.UpdateProcessTrigger(_connectionString, processTrigger); var result = package.Execute(); if (result == dts.DTSExecResult.Success) { int ssisDuration = 0; ssisDuration = (package.ExecutionDuration / 1000); // int.TryParse(Math.Round((package.ExecutionDuration / 1000.00), 2).ToString(), out ssisDuration); var statusMessage = string.Format("Package execution for {0}-{1} successfull.", _serviceName, processes.Title); try { if (_currentProcess == Convert.ToInt32(processId) && Count() != 0) { //processTrigger.Remark = string.Format("Package {0}-{1} successfully executed,however cannot proceed with the next process ", _serviceName, processes.Title) + "Duration: (" + HHMMSS(ssisDuration) + ")"; processTrigger.Remark = string.Format("Package {0}-{1} successfully executed,however cannot proceed with the next process ", _serviceName, processes.Title) + "Duration- HH:MM:SS: (" + HHMMSS(ssisDuration) + ")"; processTrigger.Status = PackageStatus.Done; } else { processTrigger.Remark = string.Format("Package {0}-{1} successfully executed: ", _serviceName, processes.Title) + "Duration- HH:MM:SS: (" + HHMMSS(ssisDuration) + ")"; processTrigger.Status = PackageStatus.Done; } //processTrigger.Remark = string.Format("Package {0}-{1} successfully executed: ", _serviceName, processes.Title) + "Duration: (" + HHMMSS(ssisDuration) + ")"; //processTrigger.Status = PackageStatus.Done; var message = package.Variables["Message"].Value.ToString(); if (!string.IsNullOrEmpty(message)) { char firstLevelSeparator = '/'; char secondLevelSeparator = '|'; var firstLevels = message.Split(firstLevelSeparator); var secondLevels = firstLevels[2].Split(secondLevelSeparator); if (firstLevels[1] == "Failed") { statusMessage = string.Format("Package execution for {0}-{1} for operation {2} Fail.", _serviceName, processes.Title, firstLevels[0]) + "Duration- HH:MM:SS: (" + HHMMSS(ssisDuration) + ")"; processTrigger.Remark = string.Format("Package {0}-{1} for operation {2} execution failed: ", _serviceName, processes.Title, firstLevels[0]) + "Duration- HH:MM:SS: (" + HHMMSS(ssisDuration) + ")/n"; foreach (var s in secondLevels) { processTrigger.Remark += s + "/n"; } processTrigger.Status = PackageStatus.Fail; Log.WriteErrorLog(processTrigger.Remark); } else { //if (_redcount != 0) //{ // statusMessage = string.Format("Package execution for {0}-{1} for operation {2} successful.", _serviceName, processes.Title, firstLevels[0]) + "Duration: (" + HHMMSS(ssisDuration) + ")"; // processTrigger.Remark = string.Format("Package {0}-{1} for operation {2} execution successful: ", _serviceName, processes.Title, firstLevels[0]) + "Duration: (" + HHMMSS(ssisDuration) + ")"; //} //else //{ // statusMessage = string.Format("Package execution for {0}-{1} for operation {2} successful,however cannot proceed with the nest process", _serviceName, processes.Title, firstLevels[0]) + "Duration: (" + HHMMSS(ssisDuration) + ")"; // processTrigger.Remark = string.Format("Package {0}-{1} for operation {2} execution successful:however cannot proceed with the nest process ", _serviceName, processes.Title, firstLevels[0]) + "Duration: (" + HHMMSS(ssisDuration) + ")"; //} statusMessage = string.Format("Package execution for {0}-{1} for operation {2} successful.", _serviceName, processes.Title, firstLevels[0]) + "Duration- HH:MM:SS: (" + HHMMSS(ssisDuration) + ")"; processTrigger.Remark = string.Format("Package {0}-{1} for operation {2} execution successful: ", _serviceName, processes.Title, firstLevels[0]) + "Duration- HH:MM:SS: (" + HHMMSS(ssisDuration) + ")"; foreach (var s in secondLevels) { processTrigger.Remark += s; } processTrigger.Status = PackageStatus.Done; Log.WriteErrorLog(processTrigger.Remark); } } else { Log.WriteErrorLog("Message variable is empty."); } } catch (Exception ex) { Log.WriteErrorLog(ex.Message); } Log.WriteErrorLog(statusMessage); //Update tigger to Done _dataManager.UpdateProcessTrigger(_connectionString, processTrigger); //_Exp = _ProcessName & ": " & _ssisCount & " lines extracted (" & HHMMSS(_ssisDuration) & ")" } else { string errorMessage = string.Empty; foreach (var error in package.Errors) { errorMessage += error.Description; } Log.WriteErrorLog(string.Format("Package execution for {0}-{1} failed.", _serviceName, processes.Title)); //Update tigger to Fail processTrigger.Status = PackageStatus.Fail; processTrigger.Remark = string.Format("Package {0}-{1} failed.", _serviceName, processes.Title) + "\n" + errorMessage; _dataManager.UpdateProcessTrigger(_connectionString, processTrigger); } }