SVN r249
SVN-Revision: r249
This commit is contained in:
@@ -5989,7 +5989,7 @@ namespace Lskj.Control
|
||||
modelLookUp.EditValue = string.Empty;
|
||||
}
|
||||
//多选关联单据头
|
||||
string SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "")+ model.SplicingConditions;
|
||||
string SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "") + model.SplicingConditions;
|
||||
//单据头关联取值
|
||||
if (this.ParentControl != null)
|
||||
{
|
||||
@@ -5997,6 +5997,7 @@ namespace Lskj.Control
|
||||
}
|
||||
|
||||
modelLookUp.NewSourceSQL = ReplaceHelper.ReplaceRowParam(this.gridView.GetFocusedDataRow(), SourceSQL);
|
||||
modelLookUp.AddModuleResult = model.addModuleResult;
|
||||
//modelLookUp.DataSource = BaseImpl.GetDataTableResult(modelLookUp.SourceSQL);
|
||||
modelLookUp.InitControls(modelLookUp.UnionModuleCodel);
|
||||
DialogResult result = modelLookUp.ShowDialog();
|
||||
@@ -6007,11 +6008,12 @@ namespace Lskj.Control
|
||||
DataRow focusedRow = this.gridView.GetFocusedDataRow();
|
||||
if (focusedRow != null)
|
||||
{
|
||||
foreach (string resultField in resultFields)
|
||||
foreach (string resultKey in modelLookUp.ModuleResultDic.Keys)
|
||||
{
|
||||
if (focusedRow.Table.Columns.Contains(resultField))
|
||||
string resultValue = modelLookUp.ModuleResultDic[resultKey];
|
||||
if (focusedRow.Table.Columns.Contains(resultKey))
|
||||
{
|
||||
focusedRow[resultField] = modelLookUp.EditText;
|
||||
focusedRow[resultKey] = resultValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,11 +282,11 @@ namespace Lskj.Control
|
||||
public void SetDataSource(DataTable dataSource)
|
||||
{
|
||||
_lookUpForm = new FrmModelLookUp(UnionModuleCodel, IsRadio);
|
||||
_lookUpForm.ConfigureColumnMode =ConfigureColumnMode;
|
||||
_lookUpForm.ConfigureColumnMode = ConfigureColumnMode;
|
||||
_lookUpForm.ValueField = ValueField;
|
||||
_lookUpForm.ValueMember = ValueMember;
|
||||
_lookUpForm.TextField = TextField;
|
||||
|
||||
|
||||
//_lookUpForm.SourceSQL = SourceSQL;
|
||||
//_lookUpForm.DataSource = dataSource;
|
||||
}
|
||||
@@ -327,13 +327,14 @@ namespace Lskj.Control
|
||||
_lookUpForm.EditText = this.TextEdit.Text;
|
||||
}
|
||||
|
||||
string sqlValue = _lookUpForm.SysModel.MenuSql+ Model.SplicingConditions;
|
||||
string sqlValue = _lookUpForm.SysModel.MenuSql + Model.SplicingConditions;
|
||||
if (this.ControlObj != null)
|
||||
{
|
||||
sqlValue = this.ControlObj.ReplaceControlValue(sqlValue);
|
||||
sqlValue = sqlValue.Replace("#", "");
|
||||
|
||||
|
||||
//_lookUpForm.DataSource = MainImpl.GetDataTableResult(sqlValue);
|
||||
}
|
||||
_lookUpForm.NewSourceSQL = sqlValue;
|
||||
_l
|
||||
_lookUpForm.AddModuleResult = Model.AddModuleResult;
|
||||
_lookUpForm
|
||||
@@ -1489,6 +1489,7 @@ namespace Lskj.Control
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine(ex.Message);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
@@ -8,9 +8,11 @@ using Lskj.Data;
|
||||
using Lskj.Model;
|
||||
using Lskj.Util;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Lskj.Control.MultiModelLookUp
|
||||
@@ -141,8 +143,14 @@ namespace Lskj.Control.MultiModelLookUp
|
||||
/// </summary>
|
||||
/// <value>The source SQL.</value>
|
||||
public string NewSourceSQL;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 关联返回参数的字段组合
|
||||
/// </summary>
|
||||
public string AddModuleResult;
|
||||
/// <summary>
|
||||
/// 返回关联的字典
|
||||
/// </summary>
|
||||
public Dictionary<string, string> ModuleResultDic = new Dictionary<string, string>();
|
||||
#endregion
|
||||
public FrmModelLookUp(string ModuleCodel)
|
||||
{
|
||||
@@ -181,7 +189,7 @@ namespace Lskj.Control.MultiModelLookUp
|
||||
//设置关联模块
|
||||
bool result = SetAssociatedModules();
|
||||
|
||||
|
||||
|
||||
|
||||
//单选模式,不显示明细表,主表双击选中后退出选择界面
|
||||
if (SingleChoiceMode)
|
||||
@@ -386,8 +394,8 @@ namespace Lskj.Control.MultiModelLookUp
|
||||
|
||||
|
||||
|
||||
this.gcMain.GridView.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
|
||||
this.gcDetail.GridView.Columns.AddRange(new GridColumn[] {valueColumn, textColumn });
|
||||
this.gcMain.GridView.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
|
||||
this.gcDetail.GridView.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
|
||||
|
||||
if (DataSource.Columns.IndexOf("remark") != -1)
|
||||
{
|
||||
@@ -614,7 +622,7 @@ namespace Lskj.Control.MultiModelLookUp
|
||||
/// <param name="menuCode">The menu code.</param>
|
||||
public void InitControls(string UnionModuleCodel)
|
||||
{
|
||||
|
||||
|
||||
this.SysModel.MenuSql = this.NewSourceSQL;
|
||||
//设置上方条件
|
||||
this.pl_top.Controls.Clear();
|
||||
@@ -876,17 +884,49 @@ namespace Lskj.Control.MultiModelLookUp
|
||||
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
||||
private void btnOk_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.EditValue = string.Empty;
|
||||
this.EditText = string.Empty;
|
||||
|
||||
|
||||
foreach (DataRow item in (this.gcDetail.GridControl.DataSource as DataTable).Rows)
|
||||
EditValue = string.Empty;
|
||||
EditText = string.Empty;
|
||||
ModuleResultDic.Clear();
|
||||
DataTable sourceTable = this.gcDetail.GridControl.DataSource as DataTable;
|
||||
foreach (DataRow item in sourceTable.Rows)
|
||||
{
|
||||
this.EditValue += item[ValueMember] + ",";
|
||||
this.EditText += item[TextField] + ",";
|
||||
}
|
||||
|
||||
|
||||
if (!string.IsNullOrEmpty(AddModuleResult))
|
||||
{
|
||||
string[] resultFields = AddModuleResult.Split(',');
|
||||
foreach (string resultField in resultFields)
|
||||
{
|
||||
Match match = Regex.Match(resultField, @"^\s*([^\s]+)\s+AS\s+([^\s]+)\s*$", RegexOptions.IgnoreCase);
|
||||
if (match.Success)
|
||||
{
|
||||
string beforeAs = match.Groups[1].Value.Trim();
|
||||
string afterAs = match.Groups[2].Value.Trim();
|
||||
string value = "";
|
||||
foreach (DataRow item in sourceTable.Rows)
|
||||
{
|
||||
if (item.Table.Columns.Contains(beforeAs))
|
||||
{
|
||||
value += item[beforeAs] + ",";
|
||||
}
|
||||
}
|
||||
ModuleResultDic.Add(afterAs, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
string value = "";
|
||||
foreach (DataRow item in sourceTable.Rows)
|
||||
{
|
||||
if (item.Table.Columns.Contains(resultField))
|
||||
{
|
||||
value += item[resultField] + ",";
|
||||
}
|
||||
}
|
||||
ModuleResultDic.Add(resultField, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.DialogResult = DialogResult.OK;
|
||||
this.Close();
|
||||
}
|
||||
@@ -998,4 +1038,4 @@ namespace Lskj.Control.MultiModelLookUp
|
||||
case 2: // 左侧为表格
|
||||
this.gridLeft.Visible = true;
|
||||
this.treeLeft.Visible = false;
|
||||
this.InitlizeSpiltLocation();
|
||||
this.InitlizeSpiltL
|
||||
Reference in New Issue
Block a user