Exemplo n.º 1
0
        public static void UpdateImportDate(string tradeDate, string tableName, DateTime date)
        {
            ImportRecordTable service = new ImportRecordTable();
            if (!service.Open())
                return;

            ImportRecordRow info = service.GetImportRecordRow(tradeDate, tableName);
            if (info != null)
            {
                service.UpdateImportDate(info.Id, date);
            }
            service.Close();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 将本地的文件导入状态同步到数据库。
        /// </summary>
        public virtual void SyncImportState2Remote()
        {
            if (string.IsNullOrEmpty(this.DateName) || string.IsNullOrEmpty(this.TableName))
                return;

            ImportRecordTable service = new ImportRecordTable();
            if (!service.Open())
                return;

            ImportRecordRow info = service.GetImportRecordRow(this.DateName, this.TableName);
            if (info == null)
            {
                info = new ImportRecordRow();
                info.TradeDate = DateName;
                info.TableName = this.TableName;
                info.SourceType = this.SourceType;
                info.ImportState = this.ImportState;
                info.ImportDate = System.DateTime.Now;
                service.Add(info);
            }
            else
            {
                //service.UpdateImportStatus(info.Id, this.ImportState);
                service.Update(info.Id, this.ImportState, this.CurrentIndex, this.TotalCount);
            }

            service.Close();
        }
Exemplo n.º 3
0
        /// <summary>
        /// 同步文件导入状态到本地。
        /// </summary>
        /// <returns>true:表示父类已经同步测完毕,子类不用再进行相关的同步操作</returns>
        public virtual bool SyncImportState2Local()
        {
            if (this.Date == null || string.IsNullOrEmpty(this.TableName))
            {
                this.ImportState = EImportStatus.NotDetected;
                return true;
            }

            ImportRecordTable service = new ImportRecordTable();
            ImportRecordRow info = service.GetImportRecordRow(this.DateName, this.TableName);

            // 交给子类处理;
            if (info == null || info.ImportState == EImportStatus.Init || info.ImportState == EImportStatus.NotDetected || info.ImportState == EImportStatus.Exception)
            {
                return false;
            }

            // 条件不具备,过滤掉;
            this.ImportState = info.ImportState;
            this.TotalCount = info.TotalCount;
            this.CurrentIndex = info.ImportCount;
            return true;
        }