SVN r314
SVN-Revision: r314
This commit is contained in:
@@ -98,6 +98,14 @@ namespace Lskj.Control
|
||||
/// 源表格
|
||||
/// </summary>
|
||||
private GridControlEx _gridEx;
|
||||
/// <summary>
|
||||
/// 导入返回控件名
|
||||
/// </summary>
|
||||
public string ImportReturnName = string.Empty;
|
||||
/// <summary>
|
||||
/// 导入返回控件值
|
||||
/// </summary>
|
||||
public string ImportReturnValue = string.Empty;
|
||||
|
||||
public FrmImport()
|
||||
: this("", "", "", null, "", "", "", "")
|
||||
@@ -378,14 +386,40 @@ namespace Lskj.Control
|
||||
failedData.Columns.Add("import_errormsg");
|
||||
if (!failedData.Columns.Contains(this._importFlag))
|
||||
failedData.Columns.Add(this._importFlag);
|
||||
if (!string.IsNullOrWhiteSpace(this.ImportReturnName))
|
||||
{
|
||||
if (!failedData.Columns.Contains(this.ImportReturnName))
|
||||
failedData.Columns.Add(this.ImportReturnName);
|
||||
}
|
||||
for (int i = 0; i < dt.Rows.Count; i++)
|
||||
{
|
||||
dt.Rows[i][_importFlag] = "1";
|
||||
if (!string.IsNullOrWhiteSpace(this.ImportReturnName))
|
||||
{
|
||||
dt.Rows[i][ImportReturnName] = ImportReturnValue;
|
||||
}
|
||||
}
|
||||
//所有导入的主键集合
|
||||
List<string> parmaryKeys= new List<string>();
|
||||
|
||||
//根据全表字段类型进行默认填充
|
||||
int currRow = 0;
|
||||
foreach (DataRow dr in dt.Rows)
|
||||
{
|
||||
if (this.SysModel.ImportPrimarykeyVerify && !string.IsNullOrWhiteSpace(_parmaryKey) )
|
||||
{
|
||||
if (parmaryKeys.Contains(dr[_parmaryKey]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
parmaryKeys.Add(dr[_parmaryKey] + "");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
rowNum = (currRow + 1) + "";
|
||||
DataRow tmpRow = datatb.NewRow();
|
||||
foreach (DataColumn dc in datatb.Columns)
|
||||
@@ -1192,34 +1226,3 @@ namespace Lskj.Control
|
||||
string[] fields = model.UnionFields.Trim(',').Split(',');
|
||||
DataRow rowResult = BaseImpl.GetDataRowResult(unionValues);
|
||||
if (rowResult != null)
|
||||
{
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
string field = fields[i];
|
||||
string value = rowResult.Table.Columns.Contains(field) ? rowResult[field] + "" : null;
|
||||
rowItem[field] = value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// 设置为空
|
||||
for (int i = 0; i < fields.Length; i++)
|
||||
{
|
||||
string field = fields[i];
|
||||
rowItem[field] = DBNull.Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogHelper.Instance.WriteError(ex);
|
||||
LogUtil.WriteError("计算列关联字段--错误-->" + unionValues, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user