public void Add(ImportRecordRow info)
 {
     this.Add(info.TradeDate, info.TableName, (int)info.SourceType, (int)info.ImportState, info.ImportCount, info.TotalCount, info.ImportDate, info.Comment);
 }
Exemple #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();
        }
        public ImportRecordRow GetImportRecordRow(DbDataReader reader)
        {
            ImportRecordRow row = new ImportRecordRow();

            row.Id = Convert.ToInt64(reader.GetValue(reader.GetOrdinal(C_Id)));
            row.TradeDate = Convert.ToString(reader.GetValue(reader.GetOrdinal(C_TradeDate)));
            row.TableName = Convert.ToString(reader.GetValue(reader.GetOrdinal(C_TableName)));
            row.SourceType = (ESourceType)Convert.ToInt32(reader.GetValue(reader.GetOrdinal(C_SourceType)));
            row.ImportState = (EImportStatus)Convert.ToInt32(reader.GetValue(reader.GetOrdinal(C_ImportState)));
            row.ImportCount = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(C_ImportCount)));
            row.TotalCount = Convert.ToInt32(reader.GetValue(reader.GetOrdinal(C_TotalCount)));
            row.ImportDate = Convert.ToDateTime(reader.GetValue(reader.GetOrdinal(C_ImportDate)));
            row.Comment = Convert.ToString(reader.GetValue(reader.GetOrdinal(C_Comment)));

            return row;
        }