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 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); }; }