public bool ReadFromDB(int taskID) { DataTable table; DatabaseCommand cmd = new DatabaseCommand(db); cmd.AppendFormat("Select * from TaskBackupSync where taskid = {0}", taskID); table = cmd.ExecuteSelectToTable(DatabaseCommandOptions.ThrowException | DatabaseCommandOptions.LogError); if (table == null || table.Rows.Count == 0) { return(false); } TaskID = Convert.ToInt32(table.Rows[0]["taskID"]); StartJobID = DatabaseFieldConvert.ToInt32(table.Rows[0]["StartJobID"]); Type = (JobType)DatabaseFieldConvert.ToInt32(table.Rows[0]["JobType"]); StatTaskStart = DatabaseFieldConvert.ToDateTime(table.Rows[0]["StartTS"]); StatTaskEnd = DatabaseFieldConvert.ToDateTime(table.Rows[0]["EndTS"]); AgentMachineName = table.Rows[0]["AgentMachineName"] as string; SourcePath = table.Rows[0]["SourcePath"] as string; DestinationPath = table.Rows[0]["DestinationPath"] as string; StatFileCount = Convert.ToInt64(table.Rows[0]["FileCount"]); StatFileCreateCount = Convert.ToInt64(table.Rows[0]["FileCreateCount"]); StatFileCopyCount = Convert.ToInt64(table.Rows[0]["FileCopyCount"]); StatFileCopyOKCount = Convert.ToInt64(table.Rows[0]["FileCopyOKCount"]); StatFileCopyErrorCount = Convert.ToInt64(table.Rows[0]["FileCopyErrorCount"]); StatFileDeleteCount = Convert.ToInt64(table.Rows[0]["FileDeleteCount"]); StatFileDeleteOKCount = Convert.ToInt64(table.Rows[0]["FileDeleteOKCount"]); StatFileDeleteErrorCount = Convert.ToInt64(table.Rows[0]["FileDeleteErrorCount"]); StatDirCount = Convert.ToInt64(table.Rows[0]["DirCount"]); StatDirCreateCount = Convert.ToInt64(table.Rows[0]["DirCreateCount"]); StatDirCreateOKCount = Convert.ToInt64(table.Rows[0]["DirCreateOKCount"]); StatDirCreateErrorCount = Convert.ToInt64(table.Rows[0]["DirCreateErrorCount"]); StatDirDeleteCount = Convert.ToInt64(table.Rows[0]["DirDeleteCount"]); StatDirDeleteOKCount = Convert.ToInt64(table.Rows[0]["DirDeleteOKCount"]); StatDirDeleteErrorCount = Convert.ToInt64(table.Rows[0]["DirDeleteErrorCount"]); StatByteCopyCount = Convert.ToInt64(table.Rows[0]["ByteCopyCount"]); StatByteCopyOKCount = Convert.ToInt64(table.Rows[0]["ByteCopyOKCount"]); StatErrorCount = Convert.ToInt64(table.Rows[0]["ErrorCount"]); return(true); }
public bool ReadFromDB(int taskID) { DataTable table; DatabaseCommand cmd = new DatabaseCommand(db); cmd.AppendFormat("Select * from TaskBackupSync where taskid = {0}", taskID); table = cmd.ExecuteSelectToTable(DatabaseCommandOptions.ThrowException | DatabaseCommandOptions.LogError); if (table == null || table.Rows.Count == 0) return false; TaskID = Convert.ToInt32(table.Rows[0]["taskID"]); StartJobID = DatabaseFieldConvert.ToInt32(table.Rows[0]["StartJobID"]); Type = (JobType)DatabaseFieldConvert.ToInt32(table.Rows[0]["JobType"]); StatTaskStart = DatabaseFieldConvert.ToDateTime(table.Rows[0]["StartTS"]); StatTaskEnd = DatabaseFieldConvert.ToDateTime(table.Rows[0]["EndTS"]); AgentMachineName = table.Rows[0]["AgentMachineName"] as string; SourcePath = table.Rows[0]["SourcePath"] as string; DestinationPath = table.Rows[0]["DestinationPath"] as string; StatFileCount = Convert.ToInt64(table.Rows[0]["FileCount"]); StatFileCreateCount = Convert.ToInt64(table.Rows[0]["FileCreateCount"]); StatFileCopyCount = Convert.ToInt64(table.Rows[0]["FileCopyCount"]); StatFileCopyOKCount = Convert.ToInt64(table.Rows[0]["FileCopyOKCount"]); StatFileCopyErrorCount = Convert.ToInt64(table.Rows[0]["FileCopyErrorCount"]); StatFileDeleteCount = Convert.ToInt64(table.Rows[0]["FileDeleteCount"]); StatFileDeleteOKCount = Convert.ToInt64(table.Rows[0]["FileDeleteOKCount"]); StatFileDeleteErrorCount = Convert.ToInt64(table.Rows[0]["FileDeleteErrorCount"]); StatDirCount = Convert.ToInt64(table.Rows[0]["DirCount"]); StatDirCreateCount = Convert.ToInt64(table.Rows[0]["DirCreateCount"]); StatDirCreateOKCount = Convert.ToInt64(table.Rows[0]["DirCreateOKCount"]); StatDirCreateErrorCount = Convert.ToInt64(table.Rows[0]["DirCreateErrorCount"]); StatDirDeleteCount = Convert.ToInt64(table.Rows[0]["DirDeleteCount"]); StatDirDeleteOKCount = Convert.ToInt64(table.Rows[0]["DirDeleteOKCount"]); StatDirDeleteErrorCount = Convert.ToInt64(table.Rows[0]["DirDeleteErrorCount"]); StatByteCopyCount = Convert.ToInt64(table.Rows[0]["ByteCopyCount"]); StatByteCopyOKCount = Convert.ToInt64(table.Rows[0]["ByteCopyOKCount"]); StatErrorCount = Convert.ToInt64(table.Rows[0]["ErrorCount"]); return true; }