|
|
@@ -536,7 +536,7 @@ namespace Learun.Application.Form |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
GetInstanceTableData(TableTree, tableComponts, formSchemeModel.dbId, keyValue,processIdName, null, res); |
|
|
|
GetInstanceTableData(TableTree, tableComponts, formSchemeModel.dbId, keyValue, processIdName, null, res); |
|
|
|
return res; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
@@ -615,11 +615,11 @@ namespace Learun.Application.Form |
|
|
|
{ |
|
|
|
foreach (FormCompontModel formitem in itemCompont.Value) |
|
|
|
{ |
|
|
|
if (formitem.type=="upload") |
|
|
|
if (formitem.type == "upload") |
|
|
|
{ |
|
|
|
foreach (var resitem in res) |
|
|
|
{ |
|
|
|
if (resitem.Value.Rows.Count>0) |
|
|
|
if (resitem.Value.Rows.Count > 0) |
|
|
|
{ |
|
|
|
if (resitem.Value.Rows[0][formitem.field] != null) |
|
|
|
uploadfieldkeyvalue.Add(formitem.id, resitem.Value.Rows[0][formitem.field].ToString()); |
|
|
@@ -675,7 +675,7 @@ namespace Learun.Application.Form |
|
|
|
#endregion |
|
|
|
|
|
|
|
#region 表单组件按表进行分类 |
|
|
|
List<string> ruleCodes = new List<string>(); |
|
|
|
List<string> ruleCodes = new List<string>(); |
|
|
|
|
|
|
|
string processIdFiled = ""; |
|
|
|
Dictionary<string, List<FormCompontModel>> tableMap = new Dictionary<string, List<FormCompontModel>>(); |
|
|
@@ -760,7 +760,7 @@ namespace Learun.Application.Form |
|
|
|
List<JObject> girdDataJson = formDataJson[girdTableMap[table.name].id].ToString().ToObject<List<JObject>>(); |
|
|
|
foreach (var girdData in girdDataJson) |
|
|
|
{ |
|
|
|
girdData.Add(_filed,_value); |
|
|
|
girdData.Add(_filed, _value); |
|
|
|
InsertSql(db, table.name, tableMap, girdData); |
|
|
|
} |
|
|
|
} |
|
|
@@ -797,7 +797,7 @@ namespace Learun.Application.Form |
|
|
|
tableMap[table.name].Add(newcompont); |
|
|
|
|
|
|
|
string strSql = " DELETE FROM " + table.name + " WHERE " + table.field + " = '" + formDataJson[compont.id].ToString() + "' "; |
|
|
|
databaseLinkIBLL.ExecuteBySqlTrans(strSql,new {}, db); |
|
|
|
databaseLinkIBLL.ExecuteBySqlTrans(strSql, new { }, db); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
@@ -896,21 +896,21 @@ namespace Learun.Application.Form |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
var db = databaseLinkIBLL.BeginTrans(formSchemeModel.dbId); |
|
|
|
try |
|
|
|
{ |
|
|
|
DeleteInstanceTable(TableTree, tableComponts, formSchemeModel.dbId, keyValue, null, db); |
|
|
|
db.Commit(); |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
db.Rollback(); |
|
|
|
throw; |
|
|
|
} |
|
|
|
var db = databaseLinkIBLL.BeginTrans(formSchemeModel.dbId); |
|
|
|
try |
|
|
|
{ |
|
|
|
DeleteInstanceTable(TableTree, tableComponts, formSchemeModel.dbId, keyValue, null, db); |
|
|
|
db.Commit(); |
|
|
|
} |
|
|
|
catch (Exception) |
|
|
|
{ |
|
|
|
db.Rollback(); |
|
|
|
throw; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
@@ -995,12 +995,12 @@ namespace Learun.Application.Form |
|
|
|
} |
|
|
|
else if (queryParam != null) // 复合条件查询 |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
foreach (var item in queryParam) |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(item.Value.ToString())) |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (compontMap[item.Key].type == "radio" || compontMap[item.Key].type == "select" || compontMap[item.Key].type == "datetimerange" || compontMap[item.Key].type == "organize") |
|
|
|
{ |
|
|
|
queryParamTemp.Add(GetFieldAlias(compontMap, tableMap, item.Key), item.Value); |
|
|
@@ -1046,7 +1046,8 @@ namespace Learun.Application.Form |
|
|
|
/// <param name="tableMap">表的名别映射表</param> |
|
|
|
/// <param name="id">主键id</param> |
|
|
|
/// <returns></returns> |
|
|
|
private string GetFieldAlias(Dictionary<string, FormCompontModel> compontMap, Dictionary<string, string> tableMap, string id) { |
|
|
|
private string GetFieldAlias(Dictionary<string, FormCompontModel> compontMap, Dictionary<string, string> tableMap, string id) |
|
|
|
{ |
|
|
|
FormCompontModel compont = compontMap[id]; |
|
|
|
string res = compont.field + tableMap[compont.table]; |
|
|
|
return res; |
|
|
@@ -1061,7 +1062,7 @@ namespace Learun.Application.Form |
|
|
|
/// <param name="keyValue">主键值</param> |
|
|
|
/// <param name="pData">父表的数据值</param> |
|
|
|
/// <param name="res">结果数据</param> |
|
|
|
private void GetInstanceTableData(List<TreeModelEx<FormTableModel>> tableTree, Dictionary<string, List<FormCompontModel>> tableComponts, string dbId, string keyValue,Dictionary<string,string> pData, Dictionary<string, DataTable> res) |
|
|
|
private void GetInstanceTableData(List<TreeModelEx<FormTableModel>> tableTree, Dictionary<string, List<FormCompontModel>> tableComponts, string dbId, string keyValue, Dictionary<string, string> pData, Dictionary<string, DataTable> res) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
@@ -1129,7 +1130,7 @@ namespace Learun.Application.Form |
|
|
|
/// <param name="keyValue">主键值</param> |
|
|
|
/// <param name="pData">父表的数据值</param> |
|
|
|
/// <param name="res">结果数据</param> |
|
|
|
private void GetInstanceTableData(List<TreeModelEx<FormTableModel>> tableTree, Dictionary<string, List<FormCompontModel>> tableComponts, string dbId, string keyValue,string keyName, Dictionary<string, string> pData, Dictionary<string, DataTable> res) |
|
|
|
private void GetInstanceTableData(List<TreeModelEx<FormTableModel>> tableTree, Dictionary<string, List<FormCompontModel>> tableComponts, string dbId, string keyValue, string keyName, Dictionary<string, string> pData, Dictionary<string, DataTable> res) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
@@ -1188,7 +1189,7 @@ namespace Learun.Application.Form |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 删除自定义表单实例表的实体数据 |
|
|
|
/// </summary> |
|
|
@@ -1198,7 +1199,7 @@ namespace Learun.Application.Form |
|
|
|
/// <param name="keyValue">主键值</param> |
|
|
|
/// <param name="pData">父表的数据值</param> |
|
|
|
/// <param name="db">数据库连接</param> |
|
|
|
private void DeleteInstanceTable(List<TreeModelEx<FormTableModel>> tableTree, Dictionary<string, List<FormCompontModel>> tableComponts, string dbId, string keyValue, DataTable pData,IRepository db) |
|
|
|
private void DeleteInstanceTable(List<TreeModelEx<FormTableModel>> tableTree, Dictionary<string, List<FormCompontModel>> tableComponts, string dbId, string keyValue, DataTable pData, IRepository db) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
@@ -1217,12 +1218,12 @@ namespace Learun.Application.Form |
|
|
|
{ |
|
|
|
querySql = " SELECT * FROM " + tableItem.data.name + " WHERE " + tableItem.data.field + " = @keyValue"; |
|
|
|
DataTable dt = databaseLinkIBLL.FindTable(dbId, querySql, new { keyValue = keyValue }); |
|
|
|
DeleteInstanceTable(tableItem.ChildNodes, tableComponts, dbId, "", dt,db); |
|
|
|
DeleteInstanceTable(tableItem.ChildNodes, tableComponts, dbId, "", dt, db); |
|
|
|
} |
|
|
|
|
|
|
|
// 删除数据 |
|
|
|
querySql = " DELETE FROM " + tableItem.data.name + " WHERE " + tableItem.data.field + " = @keyValue"; |
|
|
|
databaseLinkIBLL.ExecuteBySqlTrans(querySql, new { keyValue = keyValue },db); |
|
|
|
databaseLinkIBLL.ExecuteBySqlTrans(querySql, new { keyValue = keyValue }, db); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -1268,12 +1269,13 @@ namespace Learun.Application.Form |
|
|
|
string sqlValue = " ( "; |
|
|
|
foreach (var item in tableMap[tableName]) |
|
|
|
{ |
|
|
|
|
|
|
|
FieldValueParam fieldValueParam = new FieldValueParam(); |
|
|
|
if (!string.IsNullOrEmpty(item.field) && !formDataJson[item.id].IsEmpty()) |
|
|
|
{ |
|
|
|
strSql += item.field + ","; |
|
|
|
sqlValue += " @" + item.field + ","; |
|
|
|
|
|
|
|
|
|
|
|
fieldValueParam.name = item.field; |
|
|
|
if (dic.ContainsKey(item.field.ToUpper())) |
|
|
|
{ |
|
|
@@ -1306,7 +1308,7 @@ namespace Learun.Application.Form |
|
|
|
} |
|
|
|
fieldValueParamlist.Add(fieldValueParam); |
|
|
|
} |
|
|
|
else if(item.type == "girdguid") |
|
|
|
else if (item.type == "girdguid" || (item.title == "GUID" && item.value.IsEmpty())) |
|
|
|
{ |
|
|
|
strSql += item.field + ","; |
|
|
|
sqlValue += " @" + item.field + ","; |
|
|
@@ -1351,7 +1353,7 @@ namespace Learun.Application.Form |
|
|
|
{ |
|
|
|
// 获取当前表的字段 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (tableMap.ContainsKey(tableName) && tableMap[tableName].Count > 0) |
|
|
|
{ |
|
|
|
var list = db.GetDBTableFields<DatabaseTableFieldModel>(tableName); |
|
|
@@ -1376,10 +1378,11 @@ namespace Learun.Application.Form |
|
|
|
strSql += item.field + "=@" + item.field + ","; |
|
|
|
FieldValueParam fieldValueParam = new FieldValueParam(); |
|
|
|
fieldValueParam.name = item.field; |
|
|
|
|
|
|
|
|
|
|
|
if (dic.ContainsKey(item.field.ToUpper())) |
|
|
|
{ |
|
|
|
switch (dic[item.field.ToUpper()].ToUpper()) { |
|
|
|
switch (dic[item.field.ToUpper()].ToUpper()) |
|
|
|
{ |
|
|
|
case "DATE": |
|
|
|
fieldValueParam.type = (int)DbType.Date; |
|
|
|
fieldValueParam.value = formDataJson[item.id].ToDate(); |
|
|
|