Browse Source

【修改】excel导入方法:增加字段类型是布尔值时的判断;

北屯中职分支
dyy 10 months ago
parent
commit
0e289c14f4
1 changed files with 16 additions and 2 deletions
  1. +16
    -2
      Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs

+ 16
- 2
Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Excel/Import/ExcelImportBLL.cs View File

@@ -321,7 +321,7 @@ namespace Learun.Application.Excel
throw (new Exception("【" + col.F_ColName + "】 此项数据为必填项")); throw (new Exception("【" + col.F_ColName + "】 此项数据为必填项"));
} }
} }
if (dbType == System.Data.DbType.DateTime || dbType == System.Data.DbType.Decimal)
if (dbType == System.Data.DbType.DateTime || dbType == System.Data.DbType.Decimal || dbType == System.Data.DbType.Boolean)
{ {
if (string.IsNullOrEmpty(dr[col.F_ColName].ToString())) if (string.IsNullOrEmpty(dr[col.F_ColName].ToString()))
{ {
@@ -349,7 +349,21 @@ namespace Learun.Application.Excel
dataItemMap.Add(col.F_DataItemCode, dataItemList); dataItemMap.Add(col.F_DataItemCode, dataItemList);
} }
dataItemName = FindDataItemValue(dataItemMap[col.F_DataItemCode], dr[col.F_ColName].ToString(), col.F_ColName, col.F_IsMandatory ?? false); dataItemName = FindDataItemValue(dataItemMap[col.F_DataItemCode], dr[col.F_ColName].ToString(), col.F_ColName, col.F_IsMandatory ?? false);
dp.Add(col.F_Name, dataItemName, dbType);
if (dbType == System.Data.DbType.Boolean)
{
if (string.IsNullOrEmpty(dr[col.F_ColName].ToString()) || string.IsNullOrEmpty(dataItemName))
{
dp.Add(col.F_Name, null, dbType);
}
else
{
dp.Add(col.F_Name, dataItemName, dbType);
}
}
else
{
dp.Add(col.F_Name, dataItemName, dbType);
}
IsOnlyOne(col, sqlonly, dataItemName, entity.F_DbId, dbType); IsOnlyOne(col, sqlonly, dataItemName, entity.F_DbId, dbType);
break; break;
case 3://数据表 case 3://数据表


Loading…
Cancel
Save