//获取指定类别字段的实际对应字段名称 public string GetDBFieldName(DataImportOpType curImportType, string FiledTitle) { DataTable QueryTable = null; switch (curImportType) { case DataImportOpType.UnitBaseData: QueryTable = UnitBaseData; break; case DataImportOpType.UnitDevelopData: QueryTable = UnitDevelopData; break; case DataImportOpType.WellDevelopData: QueryTable = WellDevelopData; break; default: break; } string ConditionStr = "FiledTitle='" + FiledTitle + "'"; DataRow[] Rows = QueryTable.Select(ConditionStr); if (Rows.Length == 0) { return(""); } return(Rows[0]["FiledName"].ToString()); }
public C_OpExcelImport(RunInfo curRunInfo, DataImportOpType curImportType, ExcelColumnMappingConfig curColumnConfig, DataSet curExcelFileData) { this.opSourceDB = opSourceDB; this.curRunInfo = curRunInfo; this.curColumnConfig = curColumnConfig; this.curExcelFileData = curExcelFileData; this.curImportType = curImportType; }
public ExcelFiledMappingConfig(DataSet curSet, string UserSelSheetName, DataImportOpType curImportType) { InitializeComponent(); this.curSet = curSet; InitSheets(); this.UserSelSheetName = UserSelSheetName; opMap = new BaseDataMappingTable(); this.curImportType = curImportType; }
//判断用户选择是什么数据导入,如果没有准确的数据,引用返回一个推荐的 public DataImportOpType JugeImportType(DataTable JugeDataTable, ref DataImportOpType Advice) { //判断是否为单元基本数据 decimal UnitBaseDataSimilarity = 0; if (JugeImportType(JugeDataTable, UnitBaseData, ref UnitBaseDataSimilarity)) { return(DataImportOpType.UnitBaseData); } //判断是否为单元开发数据 decimal UnitDevDataSimilarity = 0; if (JugeImportType(JugeDataTable, UnitDevelopData, ref UnitDevDataSimilarity)) { return(DataImportOpType.UnitDevelopData); } //判断是否为单井开发数据 decimal WellDevDataSimilarity = 0; if (JugeImportType(JugeDataTable, WellDevelopData, ref WellDevDataSimilarity)) { return(DataImportOpType.WellDevelopData); } //如果不能完全匹配,就计算一下相似度,引用返回一个比较接近的 if (UnitBaseDataSimilarity > UnitDevDataSimilarity) { if (UnitBaseDataSimilarity > WellDevDataSimilarity) { Advice = DataImportOpType.UnitBaseData; } else { Advice = DataImportOpType.WellDevelopData; } } else { if (UnitDevDataSimilarity > WellDevDataSimilarity) { Advice = DataImportOpType.UnitDevelopData; } else { Advice = DataImportOpType.WellDevelopData; } } return(DataImportOpType.None); }
private void InitImportType() { if (curExcelSet.Tables.Count <= 0) { return; } BaseDataMappingTable opMapping = new BaseDataMappingTable(); DataImportOpType SS = DataImportOpType.None; //获取当前文档对应的导入类型 DataImportOpType curImportType = opMapping.JugeImportType(curExcelSet.Tables[0], ref SS); if (curImportType == DataImportOpType.None) { //说明没有全匹配,不确定 curImportType = SS; } switch (curImportType) { case DataImportOpType.UnitBaseData: radio_UnitBase.Checked = true; break; case DataImportOpType.UnitDevelopData: radio_UnitDevolopData.Checked = true; break; case DataImportOpType.WellDevelopData: radio_WellDevelopData.Checked = true; break; default: break; } }