SVN-Revision: r500
This commit is contained in:
cyf
2025-04-18 10:25:17 +00:00
parent 006deaa14c
commit 1cbed9fd73
10 changed files with 233 additions and 111 deletions
@@ -775,24 +775,42 @@ namespace Lskj.Control.Model
}
else
{
// 将sql语句组装成Parameter方式,兼容配置语句.
List<SqlParameter> paramList = ReplaceHelper.ReplaceRowParamToSqlParameter(rowData, ref sqlValue);
if (this.ControlObj != null && sqlValue.Contains(ReplaceHelper.ReplaceParentLeftKey))
if (model.SqlDirectExecution)
{
List<string> paramFields = ReplaceHelper.GetParamFields(sqlValue);
foreach (string item in paramFields)
sqlValue = ReplaceHelper.ReplaceRowParam(rowData, sqlValue);
if(this.ControlObj != null && sqlValue.Contains(ReplaceHelper.ReplaceParentLeftKey))
{
string fieldValue = this.ControlObj.GetControlValue(item.Replace(ReplaceHelper.ReplaceParentLeftKey, "").Replace(ReplaceHelper.ReplaceParamEndKey, ""));
paramList.Add(new SqlParameter(ReplaceHelper.ProcFirstKey + item, fieldValue));
List<string> paramFields = ReplaceHelper.GetParamFields(sqlValue);
foreach (string item in paramFields)
{
string fieldValue = this.ControlObj.GetControlValue(item.Replace(ReplaceHelper.ReplaceParentLeftKey, "").Replace(ReplaceHelper.ReplaceParamEndKey, ""));
sqlValue = sqlValue.Replace(item, fieldValue);
}
}
int NumberOfImpacts = MainImpl.ExecSqlValue(sqlValue);
return NumberOfImpacts>0;
}
else
{
// 将sql语句组装成Parameter方式,兼容配置语句.
List<SqlParameter> paramList = ReplaceHelper.ReplaceRowParamToSqlParameter(rowData, ref sqlValue);
if (this.ControlObj != null && sqlValue.Contains(ReplaceHelper.ReplaceParentLeftKey))
{
List<string> paramFields = ReplaceHelper.GetParamFields(sqlValue);
foreach (string item in paramFields)
{
string fieldValue = this.ControlObj.GetControlValue(item.Replace(ReplaceHelper.ReplaceParentLeftKey, "").Replace(ReplaceHelper.ReplaceParamEndKey, ""));
paramList.Add(new SqlParameter(ReplaceHelper.ProcFirstKey + item, fieldValue));
}
}
object text = MainImpl.GetResult(sqlValue, paramList.ToArray());
if (model.isCopy)
{
Clipboard.SetDataObject(text + "");
}
}
object text = MainImpl.GetResult(sqlValue, paramList.ToArray());
if (model.isCopy)
{
Clipboard.SetDataObject(text + "");
}
}
return true;
@@ -1402,7 +1420,10 @@ namespace Lskj.Control.Model
}
if (model.Mergeexec)//合并执行
{
if (model.ActionType == 0) actionSql = ReplaceHelper.ReplaceRowParam(rows, model.Action, "'", "'");
if (model.ActionType == 0)
{
actionSql = ReplaceHelper.ReplaceRowParam(rows, model.Action, "'", "'");
}
if (model.DllName.ToLower().Contains("lskj.pubbrower.dll".ToLower()))
{
@@ -1542,6 +1563,7 @@ namespace Lskj.Control.Model
}
}
}
string firstChar = fieldValue.Length > 0 ? fieldValue.Substring(0, 1) : "";
switch (firstChar)
{
@@ -1565,6 +1587,35 @@ namespace Lskj.Control.Model
string jsonStr = JsonConvert.SerializeObject(dataTable);
handleParamList.Add(jsonStr);
}
else if (fieldValue.StartsWith("[Details|"))
{
string TagName = fieldValue.Replace("[Details|", "").Replace("]", "");
fieldValue = "";
if (this.ControlObj != null && this.ControlObj.DetailSelection.ContainsKey(TagName))
{
Dictionary<DataRow, string> dictionary = this.ControlObj.DetailSelection[TagName];
if (rowDatas != null)
{
foreach (DataRow row in rowDatas)
{
if (dictionary.ContainsKey(row)&&!string.IsNullOrWhiteSpace(dictionary[row]))
{
fieldValue +=dictionary[row]+",";
}
}
fieldValue = fieldValue.Trim(',');
}
else
{
if (dictionary.ContainsKey(rowData))
{
fieldValue = dictionary[rowData];
}
}
}
handleParamList.Add(fieldValue);
}
else
{
fieldValue = fieldValue.Replace("[", "{").Replace("]", "}");
@@ -1628,28 +1679,4 @@ namespace Lskj.Control.Model
DataRow[] dataRows = columnsTab.Select().Where(n => (n["name"] + "").Equals(colunmField.Key)).ToArray();
if (dataRows.Length == 0)
{
string addColSql = string.Format("alter table P_PrivateDllTab add {0} {1}", colunmField.Key, colunmField.Value);
SqlHelper.ExecuteNonQuery(addColSql);//添加列
}
}
}
else
{
string createTabSql = "create table P_PrivateDllTab(id int IDENTITY(1,1) NOT NULL,{0})";
string createCol = string.Empty;
foreach (KeyValuePair<string, string> colunmField in colDic)
{
createCol += string.Format("{0} {1},", colunmField.Key, colunmField.Value);
}
createTabSql = string.Format(createTabSql, createCol.TrimEnd(','));
SqlHelper.ExecuteNonQuery(createTabSql);//创建表
}
return true;
}
catch (Exception)
{
return false;
}
}
}
}
string a
@@ -303,6 +303,10 @@ namespace Lskj.Control.Model
/// 右键后最小化程序
/// </summary>
public bool DuringExecutionMinimize;
/// <summary>
/// sql直接执行模式
/// </summary>
public bool SqlDirectExecution;
/// <summary>
@@ -421,20 +425,4 @@ namespace Lskj.Control.Model
if (item.Table.Columns.Contains("AllowNullExec"))
this._allowNullExec = string.IsNullOrWhiteSpace(item["AllowNullExec"] + "") ? false : "1".Equals(item["AllowNullExec"] + "");
if (item.Table.Columns.Contains("ResultSQL"))
this._resultSQL = item["ResultSQL"] + "";
if (item.Table.Columns.Contains("ExecuteFirstCode"))
this.ExecuteFirstCode = item["ExecuteFirstCode"] + "";
if (item.Table.Columns.Contains("DuringExecutionMinimize"))
this.DuringExecutionMinimize = string.IsNullOrWhiteSpace(item["DuringExecutionMinimize"] + "") ? false : "1".Equals(item["DuringExecutionMinimize"] + "");
}
/// <summary>
///是否必须选中行
/// </summary>
/// <value><c>true</c> if this instance has must select row; otherwise, <c>false</c>.</value>
public bool IsMustSelectRow()
{
return ParamList.Contains("{") || _beforeMsg.Contains("{") || _successMsg.Contains("{") || Action.Contains("{");
}
}
}
this._resultSQL = ite