Beispiel #1
0
 /// <summary>
 /// 获取任务文件列表
 /// </summary>
 /// <param name="block"></param>
 /// <param name="blockstatus"></param>
 /// <param name="starttime"></param>
 /// <param name="msg"></param>
 /// <returns></returns>
 public static DataTable getTaskList(string block, out int blockstatus, out DateTime starttime, out string msg)
 {
     Trans.Db.Model.NBlock_Info BlockInfo = Trans.Db.Data.NBlock_Info.Get("BlockCode=@Block", "", new object[] { block }, true);
     if (BlockInfo.BlockCode != block)
     {
         starttime   = new DateTime(1900, 1, 1);
         blockstatus = -1;
         msg         = "";
         return(null);
     }
     starttime   = BlockInfo.StartTime;
     blockstatus = BlockInfo.Status;
     msg         = "";
     if (BlockInfo.UploadSuccess.Year > 2000)
     {
         msg = msg + "上传完成于:" + BlockInfo.UploadSuccess.ToString("HH:mm:ss") + "<br/>";
     }
     if (BlockInfo.BackupSuccess.Year > 2000)
     {
         msg = msg + "备份完成于:" + BlockInfo.BackupSuccess.ToString("HH:mm:ss") + "<br/>";
     }
     if (BlockInfo.CoverSuccess.Year > 2000)
     {
         msg = msg + "覆盖完成于:" + BlockInfo.CoverSuccess.ToString("HH:mm:ss") + "<br/>";
     }
     if (BlockInfo.CancelTime.Year > 2000)
     {
         msg = msg + "用户取消于:" + BlockInfo.CancelTime.ToString("HH:mm:ss") + "<br/>";
     }
     if (BlockInfo.ErrorFinishTime.Year > 2000)
     {
         msg = msg + "出错取消于:" + BlockInfo.ErrorFinishTime.ToString("HH:mm:ss") + "<br/>";
     }
     return(Trans.Db.Data.NBlock_Info.GetTable("BlockCode=@Block", "RowId ASC", "*", new object[] { block }, true));
 }
 public bool RollBackSite()
 {
     try
     {
         //Trans.DataLayer.Model.Block BlockInfo = UploadTrace.GetBlockInfo(this.block);
         Trans.Db.Model.NBlock_Info BlockInfo = Trans.Db.Data.NBlock_Info.Get("BlockCode=@BlockCode", "", new object[] { this.block }, true);
         //string VMark = BlockInfo.VMark;
         string VMark = BlockInfo.ActionMark;
         this._BackupBlock = VMark;
         string              name             = this.SiteObj.SiteBaseInfo.NAME;
         DataTable           rollBackTaskList = UploadTrace.getRollBackTaskList(this.block);
         List <TaskFileInfo> list             = new List <TaskFileInfo>();
         foreach (DataRow dataRow in (InternalDataCollectionBase)rollBackTaskList.Rows)
         {
             string SrcPath = dataRow["FilePath"].ToString().Replace("..", "");
             string AimPath = dataRow["FilePath"].ToString();
             list.Add(new TaskFileInfo(SrcPath, AimPath));
         }
         int count = this.SiteObj.SiteBaseInfo.SERVLIST.Count;
         int num   = 1;
         foreach (WebSiteServer ServObj in this.SiteObj.SiteBaseInfo.SERVLIST)
         {
             string serverstatus = num.ToString() + "/" + count.ToString();
             foreach (TaskFileInfo FileObj in list)
             {
                 if (this._coverErrorServer == null)// || !(FileObj.FileName == this._coverErrorFile.FileName) || !(ServObj.NAME == this._coverErrorServer.NAME))
                 {
                     this.RollbackServ(ServObj, FileObj, name, this.block, serverstatus);
                 }
                 else
                 {
                     return(false);
                 }
             }
             ++num;
         }
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Beispiel #3
0
        /// <summary>
        /// 获取任务文件列表
        /// </summary>
        /// <param name="block"></param>
        /// <param name="blockstatus"></param>
        /// <param name="starttime"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static DataTable getTaskList(string block, out int blockstatus, out DateTime starttime, out string msg)
        {
            //  blockstatus = -1;
            //  msg = "";
            //  starttime = new DateTime(1900, 1, 1);
            //  string cmdText = "select * from Block(nolock) where VAL=@block order by ID asc";
            //  SqlConnection connection1 = new SqlConnection(UploadTrace.ConnString);
            //  msg = "";
            //  connection1.Open();
            //  SqlCommand sqlCommand = new SqlCommand(cmdText, connection1);
            //  sqlCommand.Parameters.Add(new SqlParameter("@block", (object)block));
            //  DateTime result1 = new DateTime(1900, 1, 1);
            //  DateTime result2 = new DateTime(1900, 1, 1);
            //  DateTime result3 = new DateTime(1900, 1, 1);
            //  DateTime result4 = new DateTime(1900, 1, 1);
            //  DateTime result5 = new DateTime(1900, 1, 1);
            //  SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();
            //  if (sqlDataReader.Read())
            //  {
            //      int.TryParse(sqlDataReader["status"].ToString(), out blockstatus);
            //      DateTime.TryParse(sqlDataReader["StartTime"].ToString(), out starttime);
            //      DateTime.TryParse(sqlDataReader["UploadSuccess"].ToString(), out result1);
            //      DateTime.TryParse(sqlDataReader["BackupSuccess"].ToString(), out result2);
            //      DateTime.TryParse(sqlDataReader["CoverSuccess"].ToString(), out result3);
            //      DateTime.TryParse(sqlDataReader["CancelTime"].ToString(), out result4);
            //      DateTime.TryParse(sqlDataReader["ErrorFinishTime"].ToString(), out result5);
            //      if (result1.Year > 2000)
            //          msg = msg + "上传完成于:" + result1.ToString("HH:mm:ss") + "<br/>";
            //      if (result2.Year > 2000)
            //          msg = msg + "备份完成于:" + result2.ToString("HH:mm:ss") + "<br/>";
            //      if (result3.Year > 2000)
            //          msg = msg + "覆盖完成于:" + result3.ToString("HH:mm:ss") + "<br/>";
            //      if (result4.Year > 2000)
            //          msg = msg + "用户取消于:" + result4.ToString("HH:mm:ss") + "<br/>";
            //      if (result5.Year > 2000)
            //          msg = msg + "出错取消于:" + result5.ToString("HH:mm:ss") + "<br/>";
            //      connection1.Close();

            //      DataTable dataTable = new DataTable();
            //      SqlConnection connection2 = new SqlConnection(UploadTrace.ConnString);
            //      connection2.Open();
            //      SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(new SqlCommand("select * from BlockTaskList(nolock) where Block=@block order by RowID asc", connection2)
            //      {
            //          Parameters = {
            //  new SqlParameter("@block", (object) block)
            //}
            //      });
            //      DataSet dataSet = new DataSet();
            //      ((DataAdapter)sqlDataAdapter).Fill(dataSet);
            //      connection2.Close();
            //      return dataSet.Tables[0];
            //  }
            //  else
            //  {
            //      connection1.Close();
            //      return (DataTable)null;
            //  }
            blockstatus = -1;
            Trans.Db.Model.NBlock_Info BlockInfo = Trans.Db.Data.NBlock_Info.Get("BlockCode=@Block", "", new object[] { block }, true);
            if (BlockInfo.BlockCode != block)
            {
                starttime   = new DateTime(1900, 1, 1);
                blockstatus = -1;
                msg         = "";
                return(null);
            }
            starttime   = BlockInfo.StartTime;
            blockstatus = BlockInfo.Status;
            msg         = "";
            if (BlockInfo.UploadSuccess.Year > 2000)
            {
                msg = msg + "上传完成于:" + BlockInfo.UploadSuccess.ToString("HH:mm:ss") + "<br/>";
            }
            if (BlockInfo.BackupSuccess.Year > 2000)
            {
                msg = msg + "备份完成于:" + BlockInfo.BackupSuccess.ToString("HH:mm:ss") + "<br/>";
            }
            if (BlockInfo.CoverSuccess.Year > 2000)
            {
                msg = msg + "覆盖完成于:" + BlockInfo.CoverSuccess.ToString("HH:mm:ss") + "<br/>";
            }
            if (BlockInfo.CancelTime.Year > 2000)
            {
                msg = msg + "用户取消于:" + BlockInfo.CancelTime.ToString("HH:mm:ss") + "<br/>";
            }
            if (BlockInfo.ErrorFinishTime.Year > 2000)
            {
                msg = msg + "出错取消于:" + BlockInfo.ErrorFinishTime.ToString("HH:mm:ss") + "<br/>";
            }
            return(Trans.Db.Data.NBlock_Task.GetTable("BlockCode=@Block", "ID ASC", "*", new object[] { block }, true));
        }