示例#1
0
        public static void SuccessFlag(RunningStatus theRuningStatusInSession)
        {
            _RunningFlag = false;
            theRuningStatusInSession.Status  = Status.Success;
            theRuningStatusInSession.EndTime = DateTime.Now.ToString();
            theRuningStatusInSession.AddInformationLine(Utility._Process_Success);

            TransferDataLogManager.GetLogInstance.AddInfo(string.Format("成功执行:{0}{1}详细信息是:{2}", theRuningStatusInSession.OperationDescription, Environment.NewLine, theRuningStatusInSession.RunningDetails));
        }
示例#2
0
        public static void ErrorFlag(RunningStatus theRuningStatusInSession, string exceptionMessage)
        {
            _RunningFlag = false;
            theRuningStatusInSession.Status  = Status.Error;
            theRuningStatusInSession.EndTime = DateTime.Now.ToString();
            theRuningStatusInSession.AddInformationLine(Utility.MakeRunningExceptionMsg(exceptionMessage));

            TransferDataLogManager.GetLogInstance.AddError(string.Format("出现了未在控制范围内的严重错误:{0}{1}详细信息是:{2}", theRuningStatusInSession.OperationDescription, Environment.NewLine, theRuningStatusInSession.RunningDetails));
        }
示例#3
0
        public static void StartFlag(RunningStatus theRuningStatusInSession)
        {
            if (_RunningFlag)
            {
                throw new ApplicationException(Utility._Error_RunningFlag_NotFit);
            }

            _RunningFlag = true;
            theRuningStatusInSession.Status    = Status.Running;
            theRuningStatusInSession.StartTime = DateTime.Now.ToString();
            theRuningStatusInSession.AddInformationLine(Utility._Process_Start);

            TransferDataLogManager.GetLogInstance.AddInfo(string.Format("开始执行:{0}", theRuningStatusInSession.OperationDescription));
        }
示例#4
0
        internal void BackUpData(DateTime?fromDay, DateTime?toDay, RunningStatus theRuningStatusInSession)
        {
            //备份源数据库
            TransferService.StartLittleProcess(theRuningStatusInSession, string.Format("{0}{1}", Utility._Process_BackUpDb, _DbName));
            string targetName = string.Format("{0}{1}{2}.bak", DiskOperations.DbBackUp_ForBackUpDirectory, _DbName, Utility.GetTimeStamp());

            SqlCommandRunner.BackUpDb(_DbName, targetName);

            //删减数据库备份
            TransferService.StartLittleProcess(theRuningStatusInSession, string.Format("{0}", Utility._Process_DelNonuseDbBackUp));
            theRuningStatusInSession.AddInformationLine(DiskOperations.DelFilesFromDirectory(DiskOperations.DbBackUp_ForBackUpDirectory, _DbName, targetName, _DefaultBackUpDbCount));

            //拷贝数据库用于数据筛选
            string copyDbName = _DbName + _OrginCopyDbSuffix;

            TransferService.StartLittleProcess(theRuningStatusInSession, string.Format("{0}{1}", Utility._Process_CopyDb, copyDbName));
            SqlCommandRunner.RestoreDbFromFile(copyDbName, DiskOperations.TempDirectory, targetName);

            //删除无用的表
            TransferService.StartLittleProcess(theRuningStatusInSession, Utility._Process_DelNonUseTable);
            theRuningStatusInSession.AddInformationLine(DropNonUseTable(copyDbName));

            //有用表数据筛选
            foreach (TableTransfer tt in _TablesToTransfer)
            {
                tt.BackUpData(fromDay, toDay, theRuningStatusInSession);
            }

            //将筛选完毕的数据库备份到指定地点用于打包压缩
            TransferService.StartLittleProcess(theRuningStatusInSession, string.Format("{0}{1}", Utility._Process_BackUpFiltedTable, copyDbName));
            BackUpFilteredDb(copyDbName);

            //删除无用的数据库拷贝
            TransferService.StartLittleProcess(theRuningStatusInSession, string.Format("{0}{1}", Utility._Process_DelNonUseDb, copyDbName));
            SqlCommandRunner.DeleteDb(copyDbName);
        }
示例#5
0
 internal void BackUpData(DateTime? fromDay, DateTime? toDay, RunningStatus theRuningStatusInSession)
 {
     TransferService.StartLittleProcess(theRuningStatusInSession, string.Format("{0}{1}", Utility._Process_FilterTable, _TableName));
     theRuningStatusInSession.AddInformationLine(_TableFilter.FilterTableData(fromDay, toDay));
 }
示例#6
0
 public static void StartLittleProcess(RunningStatus theRuningStatusInSession, string processName)
 {
     theRuningStatusInSession.AddInformationLine(string.Format("开始任务:{0}", processName));
 }