SVN r247
SVN-Revision: r247
This commit is contained in:
@@ -5989,14 +5989,14 @@ namespace Lskj.Control
|
|||||||
modelLookUp.EditValue = string.Empty;
|
modelLookUp.EditValue = string.Empty;
|
||||||
}
|
}
|
||||||
//多选关联单据头
|
//多选关联单据头
|
||||||
modelLookUp.SourceSQL = model.SqlSource.Replace("#", "");
|
string SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "")+ model.SplicingConditions;
|
||||||
//单据头关联取值
|
//单据头关联取值
|
||||||
if (this.ParentControl != null)
|
if (this.ParentControl != null)
|
||||||
{
|
{
|
||||||
modelLookUp.SourceSQL = this.ParentControl.ReplaceControlValue(modelLookUp.SourceSQL);
|
SourceSQL = this.ParentControl.ReplaceControlValue(SourceSQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
modelLookUp.SourceSQL = ReplaceHelper.ReplaceRowParam(this.gridView.GetFocusedDataRow(), modelLookUp.SourceSQL);
|
modelLookUp.NewSourceSQL = ReplaceHelper.ReplaceRowParam(this.gridView.GetFocusedDataRow(), SourceSQL);
|
||||||
//modelLookUp.DataSource = BaseImpl.GetDataTableResult(modelLookUp.SourceSQL);
|
//modelLookUp.DataSource = BaseImpl.GetDataTableResult(modelLookUp.SourceSQL);
|
||||||
modelLookUp.InitControls(modelLookUp.UnionModuleCodel);
|
modelLookUp.InitControls(modelLookUp.UnionModuleCodel);
|
||||||
DialogResult result = modelLookUp.ShowDialog();
|
DialogResult result = modelLookUp.ShowDialog();
|
||||||
|
|||||||
@@ -70,6 +70,18 @@ namespace Lskj.Control
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The Union ModuleCodel.</value>
|
/// <value>The Union ModuleCodel.</value>
|
||||||
public string UnionModuleCodel;
|
public string UnionModuleCodel;
|
||||||
|
/// <summary>
|
||||||
|
/// 条件
|
||||||
|
/// </summary>
|
||||||
|
public string SplicingConditions;
|
||||||
|
/// <summary>
|
||||||
|
///模块选择返回框,是否单选模式
|
||||||
|
/// </summary>
|
||||||
|
public bool IsRadio { get; set; }
|
||||||
|
/// <summary>
|
||||||
|
///模块选择返回框,配置列加载模式(默认根据sql动态加载列)
|
||||||
|
/// </summary>
|
||||||
|
public bool ConfigureColumnMode { get; set; }
|
||||||
|
|
||||||
public LabelMultiAutoTextEdit2()
|
public LabelMultiAutoTextEdit2()
|
||||||
{
|
{
|
||||||
@@ -269,12 +281,14 @@ namespace Lskj.Control
|
|||||||
/// <param name="dataSource">数据源</param>
|
/// <param name="dataSource">数据源</param>
|
||||||
public void SetDataSource(DataTable dataSource)
|
public void SetDataSource(DataTable dataSource)
|
||||||
{
|
{
|
||||||
_lookUpForm = new FrmModelLookUp(UnionModuleCodel);
|
_lookUpForm = new FrmModelLookUp(UnionModuleCodel, IsRadio);
|
||||||
|
_lookUpForm.ConfigureColumnMode =ConfigureColumnMode;
|
||||||
_lookUpForm.ValueField = ValueField;
|
_lookUpForm.ValueField = ValueField;
|
||||||
_lookUpForm.ValueMember = ValueMember;
|
_lookUpForm.ValueMember = ValueMember;
|
||||||
_lookUpForm.TextField = TextField;
|
_lookUpForm.TextField = TextField;
|
||||||
_lookUpForm.SourceSQL = SourceSQL;
|
|
||||||
_lookUpForm.DataSource = dataSource;
|
//_lookUpForm.SourceSQL = SourceSQL;
|
||||||
|
//_lookUpForm.DataSource = dataSource;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// <para>说明:清空选中的值</para>
|
/// <para>说明:清空选中的值</para>
|
||||||
@@ -304,16 +318,6 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//_lookUpForm = new FrmModelLookUp();
|
|
||||||
//_lookUpForm.ValueField = ValueField;
|
|
||||||
//_lookUpForm.ValueMember = ValueMember;
|
|
||||||
//_lookUpForm.TextField = TextField;
|
|
||||||
//_lookUpForm.SourceSQL = Model.SourceSql;
|
|
||||||
//_lookUpForm.UnionModuleCodel = UnionModuleCodel;
|
|
||||||
//_lookUpForm.EditValue = this.EditValue;
|
|
||||||
//_lookUpForm.IsType = Model.FieldType;
|
|
||||||
//_lookUpForm.EditText = this.TextEdit.Text;
|
|
||||||
//_lookUpForm.DataSource = BaseImpl.GetDataTableResult(_lookUpForm.SourceSQL);
|
|
||||||
if (_lookUpForm != null)
|
if (_lookUpForm != null)
|
||||||
{
|
{
|
||||||
if (_lookUpForm != null)
|
if (_lookUpForm != null)
|
||||||
@@ -323,12 +327,13 @@ namespace Lskj.Control
|
|||||||
_lookUpForm.EditText = this.TextEdit.Text;
|
_lookUpForm.EditText = this.TextEdit.Text;
|
||||||
}
|
}
|
||||||
|
|
||||||
string sqlValue = string.Empty;
|
string sqlValue = _lookUpForm.SysModel.MenuSql+ Model.SplicingConditions;
|
||||||
if (this.ControlObj != null)
|
if (this.ControlObj != null)
|
||||||
{
|
{
|
||||||
sqlValue = this.ControlObj.ReplaceControlValue(Model.SourceSql);
|
sqlValue = this.ControlObj.ReplaceControlValue(sqlValue);
|
||||||
sqlValue = sqlValue.Replace("#", "");
|
sqlValue = sqlValue.Replace("#", "");
|
||||||
_lookUpForm.SourceSQL = sqlValue;
|
|
||||||
//_lookUpForm.DataSource = MainImpl.GetDataTableResult(sqlValue);
|
//_lookUpForm.DataSource = MainImpl.GetDataTableResult(sqlValue);
|
||||||
}
|
}
|
||||||
|
_lookUpForm.NewSourceSQL = sqlValue;
|
||||||
_l
|
_l
|
||||||
@@ -276,20 +276,4 @@ namespace Lskj.Control.Model
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The name.</value>
|
/// <value>The name.</value>
|
||||||
public string DisplayPermissions { get; set; }
|
public string DisplayPermissions { get; set; }
|
||||||
/// <summary>
|
/// <s
|
||||||
///下拉总宽度
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The LookUpWidth.</value>
|
|
||||||
public int LookUpWidth { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///下拉列宽度,逗号分隔一一对应
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The LookUpFieldsWidth.</value>
|
|
||||||
public string LookUpFieldsWidth { get; set; }
|
|
||||||
/// <summary>
|
|
||||||
///文本框禁编(不是禁编状态,可以点击按钮,但是不能手动输入)
|
|
||||||
/// </summary>
|
|
||||||
public bool TextBoxProhibition { get; set; }
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -322,6 +322,10 @@ namespace Lskj.Control.Model
|
|||||||
/// 动态列
|
/// 动态列
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool isDynamic;
|
public bool isDynamic;
|
||||||
|
/// <summary>
|
||||||
|
/// 条件
|
||||||
|
/// </summary>
|
||||||
|
public string SplicingConditions;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -396,4 +400,5 @@ namespace Lskj.Control.Model
|
|||||||
this._treeCheckModel = item.Table.Columns.Contains("treeCheckModel") ? item["treeCheckModel"] + "" : "";
|
this._treeCheckModel = item.Table.Columns.Contains("treeCheckModel") ? item["treeCheckModel"] + "" : "";
|
||||||
this.IsRadio = item.Table.Columns.Contains("IsRadio") && !string.IsNullOrWhiteSpace(item["IsRadio"] + "") ? "1".Equals(item["IsRadio"] + "") : false;
|
this.IsRadio = item.Table.Columns.Contains("IsRadio") && !string.IsNullOrWhiteSpace(item["IsRadio"] + "") ? "1".Equals(item["IsRadio"] + "") : false;
|
||||||
this.SearchBoxAddition = item.Table.Columns.Contains("SearchBoxAddition") && !string.IsNullOrWhiteSpace(item["SearchBoxAddition"] + "") ? "1".Equals(item["SearchBoxAddition"] + "") : false;
|
this.SearchBoxAddition = item.Table.Columns.Contains("SearchBoxAddition") && !string.IsNullOrWhiteSpace(item["SearchBoxAddition"] + "") ? "1".Equals(item["SearchBoxAddition"] + "") : false;
|
||||||
this.RepeatedVerification = item.Table.Columns.Contains("RepeatedVerification") && !string.IsNullOrWhiteSpace(item["RepeatedVerification"] + "") ? "1".Equals(item["Repeat
|
this.RepeatedVerification = item.Table.Columns.Contains("RepeatedVerification") && !string.IsNullOrWhiteSpace(item["RepeatedVerification"] + "") ? "1".Equals(item["RepeatedVerification"] + "") : false;
|
||||||
|
this.SelectionConditions = item.Table.Columns.Contains("SelectionConditions") ? item
|
||||||
@@ -3697,6 +3697,9 @@ namespace Lskj.Control.Model
|
|||||||
model.LookUpWidth = item.Table.Columns.Contains("LookUpWidth") ? int.TryParse(item["LookUpWidth"] + "", out int lookUpWidth) ? lookUpWidth : 0 : 0;
|
model.LookUpWidth = item.Table.Columns.Contains("LookUpWidth") ? int.TryParse(item["LookUpWidth"] + "", out int lookUpWidth) ? lookUpWidth : 0 : 0;
|
||||||
model.LookUpFieldsWidth = item.Table.Columns.Contains("LookUpFieldsWidth") ? item["LookUpFieldsWidth"] + "" : "";
|
model.LookUpFieldsWidth = item.Table.Columns.Contains("LookUpFieldsWidth") ? item["LookUpFieldsWidth"] + "" : "";
|
||||||
model.TextBoxProhibition = item.Table.Columns.Contains("TextBoxProhibition") ? "1".Equals(item["TextBoxProhibition"] + "") : false;
|
model.TextBoxProhibition = item.Table.Columns.Contains("TextBoxProhibition") ? "1".Equals(item["TextBoxProhibition"] + "") : false;
|
||||||
|
model.ConfigureColumnMode = item.Table.Columns.Contains("ConfigureColumnMode") && !string.IsNullOrWhiteSpace(item["ConfigureColumnMode"] + "") ? "1".Equals(item["ConfigureColumnMode"] + "") : false;
|
||||||
|
model.SplicingConditions = item.Table.Columns.Contains("SplicingConditions") ? item["SplicingConditions"] + "" : "";
|
||||||
|
model.IsRadio = item.Table.Columns.Contains("IsRadio") && !string.IsNullOrWhiteSpace(item["IsRadio"] + "") ? "1".Equals(item["IsRadio"] + "") : false;
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -4162,6 +4165,11 @@ namespace Lskj.Control.Model
|
|||||||
moduleReturnsId.ControlObj = this;
|
moduleReturnsId.ControlObj = this;
|
||||||
moduleReturnsId.UnionModuleCodel = model.AddModuleId;
|
moduleReturnsId.UnionModuleCodel = model.AddModuleId;
|
||||||
moduleReturnsId.SourceSQL = model.SourceSql;
|
moduleReturnsId.SourceSQL = model.SourceSql;
|
||||||
|
moduleReturnsId.SplicingConditions= model.SplicingConditions;
|
||||||
|
moduleReturnsId.IsRadio = model.IsRadio;
|
||||||
|
moduleReturnsId.ConfigureColumnMode = model.ConfigureColumnMode;
|
||||||
|
|
||||||
|
|
||||||
// DataTable dataSource = new DataTable();
|
// DataTable dataSource = new DataTable();
|
||||||
//moduleReturnsId.SetDataSource(dataSource);
|
//moduleReturnsId.SetDataSource(dataSource);
|
||||||
moduleReturnsId.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
|
moduleReturnsId.TextEdit.KeyDown += new KeyEventHandler(OnTextEditKeyDown);
|
||||||
@@ -5481,30 +5489,4 @@ namespace Lskj.Control.Model
|
|||||||
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
|
LabelDateEdit dateEdit = controlObj as LabelDateEdit;
|
||||||
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
|
value = dateEdit.TextEdit.EditValue == null ? dateEdit.EditText : dateEdit.TextEdit.DateTime.ToString("yyyy-MM-dd");
|
||||||
}
|
}
|
||||||
else if (controlObj is LabelCheckEdit)
|
else if
|
||||||
{
|
|
||||||
LabelCheckEdit checkEdit = controlObj as LabelCheckEdit;
|
|
||||||
value = checkEdit.EditText;
|
|
||||||
}
|
|
||||||
else if (controlObj is LabelComboxEdit)
|
|
||||||
{
|
|
||||||
LabelComboxEdit autoEdit = controlObj as LabelComboxEdit;
|
|
||||||
value = autoEdit.EditValue;
|
|
||||||
}
|
|
||||||
else if (controlObj is LabelTextEdit)
|
|
||||||
{
|
|
||||||
LabelTextEdit textIntEdit = controlObj as LabelTextEdit;
|
|
||||||
if (textIntEdit != null) value = string.IsNullOrEmpty(textIntEdit.EditText) ? "0" : textIntEdit.EditText;
|
|
||||||
}
|
|
||||||
|
|
||||||
defaultValue = defaultValue.Replace(item, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return defaultValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -18,14 +18,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
public partial class FrmModelLookUp : BaseForm
|
public partial class FrmModelLookUp : BaseForm
|
||||||
{
|
{
|
||||||
#region 私有字段
|
#region 私有字段
|
||||||
/// <summary>
|
|
||||||
/// 复选框字段名称
|
|
||||||
/// </summary>
|
|
||||||
private string _checkFieldName = "_check";
|
|
||||||
/// <summary>
|
|
||||||
/// The _id
|
|
||||||
/// </summary>
|
|
||||||
private string _id = "_id";
|
|
||||||
#endregion
|
#endregion
|
||||||
#region 公有字段
|
#region 公有字段
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -65,7 +58,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string RemarkField = "remark";
|
public string RemarkField = "remark";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据源
|
/// 数据源(初始)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <value>The source SQL.</value>
|
/// <value>The source SQL.</value>
|
||||||
public string SourceSQL { get; set; }
|
public string SourceSQL { get; set; }
|
||||||
@@ -143,6 +136,12 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
/// 左侧树结构、表格主键
|
/// 左侧树结构、表格主键
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ParentKeyField;
|
public string ParentKeyField;
|
||||||
|
/// <summary>
|
||||||
|
/// 数据源(替换参数后)
|
||||||
|
/// </summary>
|
||||||
|
/// <value>The source SQL.</value>
|
||||||
|
public string NewSourceSQL;
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
public FrmModelLookUp(string ModuleCodel)
|
public FrmModelLookUp(string ModuleCodel)
|
||||||
@@ -182,29 +181,23 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
//设置关联模块
|
//设置关联模块
|
||||||
bool result = SetAssociatedModules();
|
bool result = SetAssociatedModules();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//单选模式,不显示明细表,主表双击选中后退出选择界面
|
//单选模式,不显示明细表,主表双击选中后退出选择界面
|
||||||
if (SingleChoiceMode)
|
if (SingleChoiceMode)
|
||||||
{
|
{
|
||||||
this.splitMain_Right.PanelVisibility = SplitPanelVisibility.Panel1;
|
this.splitMain_Right.PanelVisibility = SplitPanelVisibility.Panel1;
|
||||||
this.gcMain.GridView.DoubleClick += new EventHandler(OnRowCellClickRadio);
|
this.gcMain.GridView.DoubleClick += new EventHandler(OnRowCellClickRadio);
|
||||||
//设置上方条件
|
|
||||||
DataTable queryTable = BaseModuleImpl.GetCustomQueryFields(this.SysModel.CondKey);//加载自定义配置字段
|
|
||||||
this.SearchObj = new MyControl(this.SysModel.MenuSql, this.gcMain, LeftTreeViewEx, LeftGridEx);
|
|
||||||
this.SearchObj.ParentUnionField = this.ParentUnionField;
|
|
||||||
this.pl_top.Height = this.SearchObj.InitSearchControl(queryTable, this.pl_top);
|
|
||||||
this.SearchObj.OnSearchAfterCallBack += SearchObj_OnSearchAfterCallBack;
|
|
||||||
this.SourceSQL = this.SysModel.MenuSql;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.gcMain.GridView.DoubleClick += new EventHandler(OnRowCellClick);
|
this.gcMain.GridView.DoubleClick += new EventHandler(OnRowCellClick);
|
||||||
this.gcDetail.GridView.DoubleClick += new EventHandler(OnDoubleClick);
|
this.gcDetail.GridView.DoubleClick += new EventHandler(OnDoubleClick);
|
||||||
this.pl_top.Height = 0;
|
|
||||||
this.Resize += new System.EventHandler(maximization);
|
this.Resize += new System.EventHandler(maximization);
|
||||||
this.splitMain_Right.SplitterMoved += new EventHandler(PositionChange);
|
this.splitMain_Right.SplitterMoved += new EventHandler(PositionChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.SourceSQL = this.SysModel.MenuSql;
|
||||||
this.gcDetail.GridView.OptionsSelection.EnableAppearanceFocusedCell = false;
|
this.gcDetail.GridView.OptionsSelection.EnableAppearanceFocusedCell = false;
|
||||||
|
|
||||||
this.gcDetail.GridView.OptionsView.ColumnAutoWidth = true;
|
this.gcDetail.GridView.OptionsView.ColumnAutoWidth = true;
|
||||||
@@ -278,7 +271,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
{
|
{
|
||||||
success = this.gcMain.GridView.UpdateCustomColumnToDatabase(this.CurrentOperColumnKey);
|
success = this.gcMain.GridView.UpdateCustomColumnToDatabase(this.CurrentOperColumnKey);
|
||||||
}
|
}
|
||||||
this.SetDetailDataSource();
|
//this.SetDetailDataSource();
|
||||||
MessageUtil.Show(success ? ResourceKeys.SaveSuccess : ResourceKeys.SaveFault);
|
MessageUtil.Show(success ? ResourceKeys.SaveSuccess : ResourceKeys.SaveFault);
|
||||||
}
|
}
|
||||||
catch (SqlException sex)
|
catch (SqlException sex)
|
||||||
@@ -311,16 +304,17 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetDetailDataSource()
|
private void SetDetailDataSource()
|
||||||
{
|
{
|
||||||
DataTable table = this.DataSource.Copy();
|
//return;
|
||||||
DataRow[] rows = table.Select(_checkFieldName + "=True");
|
//DataTable table = this.DataSource.Copy();
|
||||||
|
//DataRow[] rows = table.Select(_checkFieldName + "=True");
|
||||||
|
|
||||||
if (rows != null && rows.Length > 0)
|
//if (rows != null && rows.Length > 0)
|
||||||
this.gcDetail.GridControl.DataSource = rows.CopyToDataTable();
|
// this.gcDetail.GridControl.DataSource = rows.CopyToDataTable();
|
||||||
else
|
//else
|
||||||
{
|
//{
|
||||||
this.gcDetail.GridControl.DataSource = table;
|
// this.gcDetail.GridControl.DataSource = table;
|
||||||
this.gcDetail.GridControl.DataSourceTable().Clear();
|
// this.gcDetail.GridControl.DataSourceTable().Clear();
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -362,22 +356,17 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void SetReadOnlyColumns()
|
private void SetReadOnlyColumns()
|
||||||
{
|
{
|
||||||
if (this.ConfigureColumnMode && SingleChoiceMode)
|
if (this.ConfigureColumnMode)//&& SingleChoiceMode
|
||||||
{
|
{
|
||||||
DataTable _gridColumns = BaseModuleImpl.GetBaseGridColumns(this.UnionModuleCodel);
|
DataTable _gridColumns = BaseModuleImpl.GetBaseGridColumns(this.UnionModuleCodel);
|
||||||
this.gcMain.SetReadOnlyColumns(_gridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey);
|
this.gcMain.SetReadOnlyColumns(_gridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey);
|
||||||
|
this.gcDetail.SetReadOnlyColumns(_gridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.gcMain.GridView.Columns.Clear();
|
this.gcMain.GridView.Columns.Clear();
|
||||||
this.gcDetail.GridView.Columns.Clear();
|
this.gcDetail.GridView.Columns.Clear();
|
||||||
|
|
||||||
GridColumn checkColumn = new GridColumn();
|
|
||||||
checkColumn.Name = checkColumn.FieldName = this._checkFieldName;
|
|
||||||
checkColumn.Caption = "选";
|
|
||||||
checkColumn.Width = 30;
|
|
||||||
checkColumn.Visible = true;
|
|
||||||
checkColumn.OptionsColumn.AllowEdit = false;
|
|
||||||
|
|
||||||
GridColumn valueColumn = new GridColumn();
|
GridColumn valueColumn = new GridColumn();
|
||||||
valueColumn.FieldName = valueColumn.Name = ValueField;
|
valueColumn.FieldName = valueColumn.Name = ValueField;
|
||||||
@@ -397,8 +386,8 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.gcMain.GridView.Columns.AddRange(new GridColumn[] { checkColumn, valueColumn, textColumn });
|
this.gcMain.GridView.Columns.AddRange(new GridColumn[] { valueColumn, textColumn });
|
||||||
this.gcDetail.GridView.Columns.AddRange(new GridColumn[] { checkColumn, valueColumn, textColumn });
|
this.gcDetail.GridView.Columns.AddRange(new GridColumn[] {valueColumn, textColumn });
|
||||||
|
|
||||||
if (DataSource.Columns.IndexOf("remark") != -1)
|
if (DataSource.Columns.IndexOf("remark") != -1)
|
||||||
{
|
{
|
||||||
@@ -625,11 +614,17 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
/// <param name="menuCode">The menu code.</param>
|
/// <param name="menuCode">The menu code.</param>
|
||||||
public void InitControls(string UnionModuleCodel)
|
public void InitControls(string UnionModuleCodel)
|
||||||
{
|
{
|
||||||
//单选模式以模块sql为为准
|
|
||||||
if (SingleChoiceMode)
|
this.SysModel.MenuSql = this.NewSourceSQL;
|
||||||
{
|
//设置上方条件
|
||||||
this.SourceSQL = this.SysModel.MenuSql;
|
this.pl_top.Controls.Clear();
|
||||||
}
|
DataTable queryTable = BaseModuleImpl.GetCustomQueryFields(this.SysModel.CondKey);//加载自定义配置字段
|
||||||
|
this.SearchObj = new MyControl(this.SysModel.MenuSql, this.gcMain, LeftTreeViewEx, LeftGridEx);
|
||||||
|
this.SearchObj.ParentUnionField = this.ParentUnionField;
|
||||||
|
this.pl_top.Height = 0;
|
||||||
|
this.pl_top.Height = this.SearchObj.InitSearchControl(queryTable, this.pl_top);
|
||||||
|
this.SearchObj.OnSearchAfterCallBack += SearchObj_OnSearchAfterCallBack;
|
||||||
|
|
||||||
if (LeftTreeViewEx != null && LeftTreeViewEx.TreeView.Nodes.Count > 0)
|
if (LeftTreeViewEx != null && LeftTreeViewEx.TreeView.Nodes.Count > 0)
|
||||||
{
|
{
|
||||||
LeftTreeViewEx.TreeView.SelectedNode = LeftTreeViewEx.TreeView.Nodes[0];//重新打开时默认选中第一条
|
LeftTreeViewEx.TreeView.SelectedNode = LeftTreeViewEx.TreeView.Nodes[0];//重新打开时默认选中第一条
|
||||||
@@ -640,7 +635,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
LeftGridEx.GridView.SelectRow(0);
|
LeftGridEx.GridView.SelectRow(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.DataSource = BaseImpl.GetDataTableResult(this.SourceSQL);
|
this.DataSource = BaseImpl.GetDataTableResult(this.NewSourceSQL);
|
||||||
this.SetSelectionBox();
|
this.SetSelectionBox();
|
||||||
//创建表格列
|
//创建表格列
|
||||||
if (isFirst)
|
if (isFirst)
|
||||||
@@ -658,7 +653,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
|
|
||||||
private void SearchObj_OnSearchAfterCallBack(object sender, EventArgs e)
|
private void SearchObj_OnSearchAfterCallBack(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
this.SetSelectionBox();
|
//this.SetSelectionBox();
|
||||||
//this.SetReadOnlyColumns();
|
//this.SetReadOnlyColumns();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -712,8 +707,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
DataRow rowItem = rowItem = this.DataSource.Rows.Cast<DataRow>().FirstOrDefault(x => x[isValue ? ValueMember : TextField] + "" == spilts[i].Trim());
|
DataRow rowItem = rowItem = this.DataSource.Rows.Cast<DataRow>().FirstOrDefault(x => x[isValue ? ValueMember : TextField] + "" == spilts[i].Trim());
|
||||||
if (rowItem != null)
|
if (rowItem != null)
|
||||||
{
|
{
|
||||||
rowItem[_checkFieldName] = check;
|
(this.gcDetail.GridControl.DataSource as DataTable).Rows.Add(rowItem.ItemArray);
|
||||||
rowItem.AcceptChanges();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.SetDetailDataSource();
|
this.SetDetailDataSource();
|
||||||
@@ -796,11 +790,10 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
DataRow rowItem = this.gcMain.GridView.GetFocusedDataRow();
|
DataRow rowItem = this.gcMain.GridView.GetFocusedDataRow();
|
||||||
if (rowItem != null)
|
if (rowItem != null)
|
||||||
{
|
{
|
||||||
rowItem[_checkFieldName] = "True".Equals(rowItem[_checkFieldName] + "") ? 0 : 1;
|
(this.gcDetail.GridControl.DataSource as DataTable).Rows.Add(rowItem.ItemArray);
|
||||||
//rowItem[_checkFieldName] = rowItem.Table.Columns.Contains(_checkFieldName) : "True".Equals(rowItem[_checkFieldName] + "") ? 0 : 1 ? 0;
|
|
||||||
rowItem.AcceptChanges();
|
rowItem.AcceptChanges();
|
||||||
}
|
}
|
||||||
this.SetDetailDataSource();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -818,8 +811,6 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
{
|
{
|
||||||
|
|
||||||
DataRow dr = this.gcMain.GridView.GetFocusedDataRow();
|
DataRow dr = this.gcMain.GridView.GetFocusedDataRow();
|
||||||
//DataRow[] rowItems = this.DataSource.Select(_checkFieldName + "=True");
|
|
||||||
|
|
||||||
if (dr != null)
|
if (dr != null)
|
||||||
{
|
{
|
||||||
this.EditValue = dr[ValueMember] + "";
|
this.EditValue = dr[ValueMember] + "";
|
||||||
@@ -849,13 +840,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
{
|
{
|
||||||
if (this.gcDetail.GridView.RowCount == 0) return;
|
if (this.gcDetail.GridView.RowCount == 0) return;
|
||||||
DataRow rowItem = this.gcDetail.GridView.GetFocusedDataRow();
|
DataRow rowItem = this.gcDetail.GridView.GetFocusedDataRow();
|
||||||
DataRow[] sourceRowItems = this.DataSource.Select(_id + "=" + rowItem[_id] + "");
|
(this.gcDetail.GridControl.DataSource as DataTable).Rows.Remove(rowItem);
|
||||||
if (rowItem != null && sourceRowItems != null && sourceRowItems.Length > 0)
|
|
||||||
{
|
|
||||||
sourceRowItems[0][_checkFieldName] = 0;
|
|
||||||
sourceRowItems[0].AcceptChanges();
|
|
||||||
}
|
|
||||||
this.SetDetailDataSource();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
#region 关闭时清空唯一键
|
#region 关闭时清空唯一键
|
||||||
@@ -894,16 +879,13 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
this.EditValue = string.Empty;
|
this.EditValue = string.Empty;
|
||||||
this.EditText = string.Empty;
|
this.EditText = string.Empty;
|
||||||
|
|
||||||
DataRow[] rowItems = this.DataSource.Select(_checkFieldName + "=True");
|
|
||||||
|
|
||||||
foreach (DataRow item in rowItems)
|
foreach (DataRow item in (this.gcDetail.GridControl.DataSource as DataTable).Rows)
|
||||||
{
|
{
|
||||||
this.EditValue += item[ValueMember] + ",";
|
this.EditValue += item[ValueMember] + ",";
|
||||||
this.EditText += item[TextField] + ",";
|
this.EditText += item[TextField] + ",";
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.EditValue = this.EditValue.Trim(',');
|
|
||||||
//this.EditText = this.EditText.Trim(',');
|
|
||||||
|
|
||||||
this.DialogResult = DialogResult.OK;
|
this.DialogResult = DialogResult.OK;
|
||||||
this.Close();
|
this.Close();
|
||||||
@@ -939,9 +921,8 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
DataTable DataSource = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
|
DataTable DataSource = this.gcMain.GridView.GetGridViewFilteredAndSortedDataToDataTable();
|
||||||
foreach (DataRow item in DataSource.Rows)
|
foreach (DataRow item in DataSource.Rows)
|
||||||
{
|
{
|
||||||
DataRow rowItem = this.DataSource.Select("1=1").FirstOrDefault(x => (item[_id] + "").Equals(x[_id] + ""));
|
//DataRow rowItem = this.DataSource.Select("1=1").FirstOrDefault(x => (item[_id] + "").Equals(x[_id] + ""));
|
||||||
rowItem[_checkFieldName] = 1;
|
(this.gcDetail.GridControl.DataSource as DataTable).Rows.Add(item.ItemArray);
|
||||||
rowItem.AcceptChanges();
|
|
||||||
}
|
}
|
||||||
this.SetDetailDataSource();
|
this.SetDetailDataSource();
|
||||||
}
|
}
|
||||||
@@ -956,16 +937,7 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
private void btn_cancelAll_Click(object sender, EventArgs e)
|
private void btn_cancelAll_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
|
||||||
DataTable dt = this.DataSource.Clone();
|
(this.gcDetail.GridControl.DataSource as DataTable).Clear();
|
||||||
foreach (DataRow item in this.DataSource.Rows)
|
|
||||||
{
|
|
||||||
if ("True".Equals(item[_checkFieldName] + ""))
|
|
||||||
{
|
|
||||||
|
|
||||||
item[_checkFieldName] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.SetDetailDataSource();
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -1026,17 +998,4 @@ namespace Lskj.Control.MultiModelLookUp
|
|||||||
case 2: // 左侧为表格
|
case 2: // 左侧为表格
|
||||||
this.gridLeft.Visible = true;
|
this.gridLeft.Visible = true;
|
||||||
this.treeLeft.Visible = false;
|
this.treeLeft.Visible = false;
|
||||||
this.InitlizeSpiltLocation();
|
this.InitlizeSpiltLocation();
|
||||||
this.SetLeftGridView();
|
|
||||||
//this.ModuleGridObj.SaveEvent += new Lskj.Control.ModuleGridEx.SaveEventHander(SetDetailGridView);
|
|
||||||
this.LeftGridEx = this.gridLeft;
|
|
||||||
break;
|
|
||||||
case 3: // 左侧为空
|
|
||||||
default:
|
|
||||||
this.splitMain.PanelVisibility = SplitPanelVisibility.Panel2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
|
|
||||||
@@ -2557,14 +2557,14 @@ namespace Lskj.Control
|
|||||||
modelLookUp.EditValue = string.Empty;
|
modelLookUp.EditValue = string.Empty;
|
||||||
}
|
}
|
||||||
//多选关联单据头
|
//多选关联单据头
|
||||||
modelLookUp.SourceSQL = model.SqlSource.Replace("#", "");
|
string SourceSQL = modelLookUp.SysModel.MenuSql.Replace("#", "") + model.SplicingConditions;
|
||||||
//单据头关联取值
|
//单据头关联取值
|
||||||
if (this.ParentControl != null)
|
if (this.ParentControl != null)
|
||||||
{
|
{
|
||||||
modelLookUp.SourceSQL = this.ParentControl.ReplaceControlValue(modelLookUp.SourceSQL);
|
SourceSQL = this.ParentControl.ReplaceControlValue(SourceSQL);
|
||||||
}
|
}
|
||||||
|
|
||||||
modelLookUp.SourceSQL = ReplaceHelper.ReplaceRowParam(this.GetViewFocusedDataRow(), modelLookUp.SourceSQL);
|
modelLookUp.NewSourceSQL = ReplaceHelper.ReplaceRowParam(this.GetViewFocusedDataRow(), SourceSQL);
|
||||||
//modelLookUp.DataSource = BaseImpl.GetDataTableResult(modelLookUp.SourceSQL);
|
//modelLookUp.DataSource = BaseImpl.GetDataTableResult(modelLookUp.SourceSQL);
|
||||||
modelLookUp.InitControls(modelLookUp.UnionModuleCodel);
|
modelLookUp.InitControls(modelLookUp.UnionModuleCodel);
|
||||||
DialogResult result = modelLookUp.ShowDialog();
|
DialogResult result = modelLookUp.ShowDialog();
|
||||||
@@ -3942,32 +3942,3 @@ namespace Lskj.Control
|
|||||||
{
|
{
|
||||||
item.OptionsColumn.AllowEdit = ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
|
item.OptionsColumn.AllowEdit = ModifyFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1;
|
||||||
item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit;
|
item.OptionsColumn.ReadOnly = !item.OptionsColumn.AllowEdit;
|
||||||
|
|
||||||
if (!item.OptionsColumn.AllowEdit)
|
|
||||||
{
|
|
||||||
item.AppearanceHeader.Options.UseForeColor = true;
|
|
||||||
item.AppearanceHeader.ForeColor = ColorTranslator.FromHtml(HeaderColor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
item.AppearanceHeader.Options.UseForeColor = true;
|
|
||||||
item.AppearanceHeader.ForeColor = ColorTranslator.FromHtml("#00000");
|
|
||||||
}
|
|
||||||
if (model.FieldType == ControlType.LabMemoEdit) item.OptionsColumn.AllowEdit = true;
|
|
||||||
|
|
||||||
}
|
|
||||||
//必填
|
|
||||||
if (Required && RequiredFields.IndexOf(item.FieldName + ",", StringComparison.OrdinalIgnoreCase) != -1)
|
|
||||||
{
|
|
||||||
item.AppearanceHeader.Options.UseForeColor = true;
|
|
||||||
item.AppearanceHeader.ForeColor = RequiredForceColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user