public void Execute(int id) { JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var taskresult = this.PreviousTaskResult.TaskData; _service.PopulateVID(taskresult.FilePath); _taskResult = new dlxTaskResult() { IsSuccess = true, }; jobItem.Status = true; jobItem.Description = "VID Bulk Insert Successful"; jobItem.EndDate = DateTime.UtcNow; _service.JobItemLog(jobItem); } catch (Exception ex) { Console.Write(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "VID Bulk Insert Failed" }; jobItem.Status = false; jobItem.Description = _taskResult.ErrorMessage; jobItem.EndDate = DateTime.UtcNow; _service.JobItemLog(jobItem); } }
public void Execute(int id) { JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var taskresult = this.PreviousTaskResult.TaskData; _searvice.InsertPriceReport(); _taskResult = new dlxTaskResult() { IsSuccess = true, TaskData = taskresult }; jobItem.Status = true; jobItem.Description = "Process Price Report Successful"; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } catch (Exception ex) { Console.WriteLine(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Process Price Report Task Failed" }; jobItem.Status = false; jobItem.Description = string.Format("Error: {0} Inner Exception: {1} Error Message: {2}", _taskResult.ErrorMessage, ex.InnerException == null ? "" : ex.InnerException.ToString(), ex.Message); jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } }
public void Execute(int id) { FTPUtils utils = null; JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var ftpConfig = _searvice.GetFtpConfig(FtpConfigurationType.PipelineOrder); utils = new FTPUtils(ftpConfig); utils.DownloadFile(); if (utils.DownloadFileName == null) { _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Pipe Line Order Download Failed as file is not exists" }; jobItem.Status = false; jobItem.Description = _taskResult.ErrorMessage; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } else { _taskResult = new dlxTaskResult() { IsSuccess = true, TaskData = new dlxTaskData() { FilePath = utils.DownloadFileName } }; jobItem.Status = true; jobItem.Description = "Pipe Line Order Download Successful"; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } } catch (Exception ex) { Console.Write(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Pipe Line Order Download Failed", TaskData = new dlxTaskData() { FilePath = utils.DownloadFileName } }; jobItem.Status = false; //jobItem.Description = _taskResult.ErrorMessage; jobItem.Description = string.Format("Error: {0} Inner Exception: {1} Error Message: {2}", _taskResult.ErrorMessage, ex.InnerException == null ? "" : ex.InnerException.ToString(), ex.Message); jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } }
public void Execute(int id) { FTPUtils utils = null; JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var taskresult = this.PreviousTaskResult.TaskData; var ftpConfig = _searvice.GetFtpConfig(FtpConfigurationType.Announcement); utils = new FTPUtils(ftpConfig); bool success = utils.Archive(new FileInfo(taskresult.FilePath).Name); if (!success) { _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Announcement Archive Failed." }; jobItem.Status = false; jobItem.Description = _taskResult.ErrorMessage; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } else { _taskResult = new dlxTaskResult() { IsSuccess = true //TaskData = new dlxTaskData() { FilePath = utils.DownloadFileName } }; jobItem.Status = true; jobItem.Description = "Announcement Archive Successful"; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } } catch (Exception ex) { Console.Write(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Announcement Archive Failed" }; jobItem.Status = false; //jobItem.Description = _taskResult.ErrorMessage; jobItem.Description = string.Format("Error: {0} Inner Exception: {1} Error Message: {2}", _taskResult.ErrorMessage, ex.InnerException == null ? "" : ex.InnerException.ToString(), ex.Message); jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); }; }
public void Execute(int id) { FTPUtils utils = null; JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var ftpConfig = _searvice.GetFtpConfig(FtpConfigurationType.VID); utils = new FTPUtils(ftpConfig); utils.DownloadFile(); if (utils.DownloadFileName == null) { _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "VID Download Failed file is not exist" }; jobItem.Status = false; jobItem.Description = _taskResult.ErrorMessage; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } else { _taskResult = new dlxTaskResult() { IsSuccess = true, TaskData = new dlxTaskData() { FilePath = utils.DownloadFileName } }; jobItem.Status = true; jobItem.Description = "VID Download Successful"; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); } } catch (Exception ex) { Console.Write(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "VID Download Failed" }; jobItem.Status = false; jobItem.Description = _taskResult.ErrorMessage; jobItem.EndDate = DateTime.UtcNow; _searvice.JobItemLog(jobItem); }; }
/// <summary> /// Bulk insert Announcement file into a staging table /// </summary> /// <param name="id">Announcement task id</param> public void Execute(int id) { JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var taskresult = this.PreviousTaskResult.TaskData; var ftpConfig = _service.GetFtpConfig(FtpConfigurationType.Announcement); string filePath = string.IsNullOrEmpty(_fileName) ? taskresult.FilePath : string.Format("{0}{1}/{2}", ftpConfig.DownloadLocalDirectory, ftpConfig.FtpDirecrory, _fileName); string fileName = filePath.Substring(filePath.LastIndexOf("/") + 1); var validationResult = _service.ValidateAnnouncement(fileName); if (!validationResult.IsSucceeded) { throw new Exception(validationResult.Message); } int recordsImported = _service.PopulateAnnouncement(filePath); //taskresult.NoOfRecordImported = recordsImported; _taskResult = new dlxTaskResult() { IsSuccess = true, //TaskData = new dlxTaskData() { FilePath = taskresult.FilePath } TaskData = string.IsNullOrEmpty(_fileName) ? taskresult : new dlxTaskData { NoOfRecordImported = recordsImported, FilePath = filePath } }; jobItem.Status = true; jobItem.Description = "Announcement Bulk Insert Successful"; jobItem.EndDate = DateTime.UtcNow; _service.JobItemLog(jobItem); } catch (Exception ex) { //Console.Write(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Announcement Bulk Insert Failed." }; jobItem.Status = false; //jobItem.Description = _taskResult.ErrorMessage; jobItem.Description = string.Format("Error: {0} Inner Exception: {1} Error Message: {2}", _taskResult.ErrorMessage, ex.InnerException == null ? "" : ex.InnerException.ToString(), ex.Message); jobItem.EndDate = DateTime.UtcNow; _service.JobItemLog(jobItem); } }
/// <summary> /// Bulk insert PipeLine order file into a staging table /// </summary> /// <param name="id">PipeLine order task id</param> public void Execute(int id) { JobItem jobItem = new JobItem(); jobItem.StartDate = DateTime.UtcNow; jobItem.JobId = id; jobItem.TaskName = Name; try { var taskresult = this.PreviousTaskResult.TaskData; var ftpConfig = _service.GetFtpConfig(FtpConfigurationType.PipelineOrder); string filePath = string.IsNullOrEmpty(_fileName) ? taskresult.FilePath : string.Format("{0}{1}/{2}", ftpConfig.DownloadLocalDirectory, ftpConfig.FtpDirecrory, _fileName); int recordsImported = _service.PopulatePipeLineOrder(filePath); //taskresult.NoOfRecordImported = recordsImported; _taskResult = new dlxTaskResult() { IsSuccess = true, TaskData = string.IsNullOrEmpty(_fileName) ? taskresult: new dlxTaskData { NoOfRecordImported = recordsImported, FilePath = filePath } }; jobItem.Status = true; jobItem.Description = "Pipe line order Bulk Insert Successful"; jobItem.EndDate = DateTime.UtcNow; _service.JobItemLog(jobItem); } catch (Exception ex) { Console.Write(ex.Message); _taskResult = new dlxTaskResult() { IsSuccess = false, ErrorMessage = "Pipe line order Bulk Insert Failed" }; jobItem.Status = false; jobItem.Description = string.Format("Error: {0} Inner Exception: {1} Error Message: {2}", _taskResult.ErrorMessage, ex.InnerException == null ? "" : ex.InnerException.ToString(), ex.Message); jobItem.EndDate = DateTime.UtcNow; _service.JobItemLog(jobItem); } }