private static void DeleteData(IEnumerable <dynamic> delDataList)
        {
            var    errorMessage = "";
            string id, size, sourcePath, targetPath;
            var    rsyncCmd = new RsyncCommand();

            SyncResultRecords.SyncResult resultRecord;
            foreach (var delData in delDataList)
            {
                id = size = sourcePath = targetPath = "";
                try
                {
                    id         = delData.id;
                    size       = "";
                    targetPath = GetReplaceHostPath(delData.target.ToString());
                    Log.WriteLog("Start delete from factory.(id:" + id + ")");
                    Log.WriteLog("targetPath :" + targetPath);

                    var targetDir = string.Join("\\", targetPath.Split('\\').Take(targetPath.Split('\\').Length - 1));
                    if (Directory.Exists(targetDir))
                    {
                        Directory.Delete(targetDir, true);
                    }

                    resultRecord = new SyncResultRecords.SyncResult
                    {
                        Id         = id,
                        Size       = size,
                        FinishTime = RsyncDateTime.GetNow(RsyncDateTime.TimeFormatType.YearSMonthSDateTimeChange),
                        SourcePath = sourcePath,
                        TargetPath = targetPath,
                        Status     = "Success",
                        Message    = targetPath.Replace("\\", "/") + " deleted is success.",
                    };
                    errorMessage = UpdateStatus(new List <SyncResultRecords.SyncResult> {
                        resultRecord
                    });
                }
                catch (Exception e)
                {
                    Log.WriteLog(e.Message, Log.Type.Exception);
                    resultRecord = new SyncResultRecords.SyncResult
                    {
                        Id         = id,
                        Size       = size,
                        FinishTime = RsyncDateTime.GetNow(RsyncDateTime.TimeFormatType.YearSMonthSDateTimeChange),
                        SourcePath = sourcePath,
                        TargetPath = targetPath,
                        Status     = "Failed",
                        Message    = targetPath.Replace("\\", "/") + " deleted is failed.",
                    };
                    errorMessage = UpdateStatus(new List <SyncResultRecords.SyncResult> {
                        resultRecord
                    });
                }

                if (errorMessage != "")
                {
                    resultRecord.Status   = "Failed";
                    resultRecord.Message += (resultRecord.Message != "" ? " " : "") + errorMessage;
                }
                SyncResultRecords.Add(resultRecord);
                Log.WriteLog("Delete from factory is finish.");
            }
        }
        private static void SyncData(IEnumerable <dynamic> syncDataList)
        {
            var    errorMessage = "";
            string id, size, sourcePath, targetPath;
            var    rsyncCmd = new RsyncCommand();

            SyncResultRecords.SyncResult resultRecord;
            foreach (var syncData in syncDataList)
            {
                id = size = sourcePath = targetPath = "";
                try
                {
                    id         = syncData.id;
                    size       = "";
                    sourcePath = GetReplaceHostPath(syncData.source.ToString());
                    targetPath = GetReplaceHostPath(syncData.target.ToString());
                    Log.WriteLog("Start sync to factory.(id:" + id + ")");
                    Log.WriteLog(sourcePath + " -> " + targetPath);
                    if (!File.Exists(sourcePath))
                    {
                        Log.WriteLog("No such file or directory.", Log.Type.Failed);
                        resultRecord = new SyncResultRecords.SyncResult
                        {
                            Id         = id,
                            Size       = size,
                            FinishTime = RsyncDateTime.GetNow(RsyncDateTime.TimeFormatType.YearSMonthSDateTimeChange),
                            SourcePath = sourcePath,
                            TargetPath = targetPath,
                            Status     = "Failed",
                            Message    = "No such file or directory.",
                        };
                        errorMessage = UpdateStatus(new List <SyncResultRecords.SyncResult> {
                            resultRecord
                        });
                    }
                    else
                    {
                        FileInfo file = new FileInfo(sourcePath);
                        size = file.Length.ToString();

                        rsyncCmd.ExeSyncCmd(sourcePath, targetPath);
                        if (rsyncCmd.ErrorMessage != "")
                        {
                            throw new Exception(rsyncCmd.ErrorMessage);
                        }
                        resultRecord = new SyncResultRecords.SyncResult
                        {
                            Id         = id,
                            Size       = size,
                            FinishTime = RsyncDateTime.GetNow(RsyncDateTime.TimeFormatType.YearSMonthSDateTimeChange),
                            SourcePath = sourcePath,
                            TargetPath = targetPath,
                            Status     = "Success",
                            Message    = targetPath.Replace("\\", "/") + " is already sync to factory.",
                        };
                        errorMessage = UpdateStatus(new List <SyncResultRecords.SyncResult> {
                            resultRecord
                        });
                    }
                }
                catch (Exception e)
                {
                    Log.WriteLog(e.Message, Log.Type.Exception);
                    resultRecord = new SyncResultRecords.SyncResult
                    {
                        Id         = id,
                        Size       = size,
                        FinishTime = RsyncDateTime.GetNow(RsyncDateTime.TimeFormatType.YearSMonthSDateTimeChange),
                        SourcePath = sourcePath,
                        TargetPath = targetPath,
                        Status     = "Failed",
                        Message    = targetPath.Replace("\\", "/") + " sync is failed.",
                    };
                    errorMessage = UpdateStatus(new List <SyncResultRecords.SyncResult> {
                        resultRecord
                    });
                }

                if (errorMessage != "")
                {
                    resultRecord.Status   = "Failed";
                    resultRecord.Message += (resultRecord.Message != "" ? " " : "") + errorMessage;
                }

                SyncResultRecords.Add(resultRecord);
                Log.WriteLog("Sync to factory is finish.");
            }
        }