SVN-Revision: r968
This commit is contained in:
cyf
2025-09-05 08:19:50 +00:00
parent a0db6e538e
commit 88dbba4c25
4 changed files with 913 additions and 0 deletions
+223
View File
@@ -0,0 +1,223 @@
namespace Lskj.PubBill
{
partial class FrmDocumentSource
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.splitMain = new DevExpress.XtraEditors.SplitContainerControl();
this.pl_left = new DevExpress.XtraEditors.PanelControl();
this.pl_left_main = new System.Windows.Forms.Panel();
this.pl_gridandtree_container = new DevExpress.XtraEditors.PanelControl();
this.treeLeft = new Lskj.Control.TreeViewEx();
this.gridLeft = new Lskj.Control.GridControlEx();
this.pl_left_top = new DevExpress.XtraEditors.PanelControl();
this.pl_top = new DevExpress.XtraEditors.PanelControl();
this.panelControl1 = new DevExpress.XtraEditors.PanelControl();
this.btnCancel = new DevExpress.XtraEditors.SimpleButton();
this.btnOk = new DevExpress.XtraEditors.SimpleButton();
this.gcMain = new Lskj.Control.GridControlEx();
((System.ComponentModel.ISupportInitialize)(this.splitMain)).BeginInit();
this.splitMain.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_left)).BeginInit();
this.pl_left.SuspendLayout();
this.pl_left_main.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_gridandtree_container)).BeginInit();
this.pl_gridandtree_container.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pl_left_top)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pl_top)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.panelControl1)).BeginInit();
this.panelControl1.SuspendLayout();
this.SuspendLayout();
//
// splitMain
//
this.splitMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitMain.Location = new System.Drawing.Point(0, 0);
this.splitMain.Margin = new System.Windows.Forms.Padding(4);
this.splitMain.Name = "splitMain";
this.splitMain.Panel1.Controls.Add(this.pl_left);
this.splitMain.Panel1.Text = "Panel1";
this.splitMain.Panel2.Controls.Add(this.gcMain);
this.splitMain.Panel2.Controls.Add(this.panelControl1);
this.splitMain.Panel2.Controls.Add(this.pl_top);
this.splitMain.Panel2.Text = "Panel2";
this.splitMain.Size = new System.Drawing.Size(800, 450);
this.splitMain.SplitterPosition = 260;
this.splitMain.TabIndex = 1;
this.splitMain.Text = "splitContainerControl1";
//
// pl_left
//
this.pl_left.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_left.Appearance.Options.UseBackColor = true;
this.pl_left.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_left.Controls.Add(this.pl_left_main);
this.pl_left.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_left.Location = new System.Drawing.Point(0, 0);
this.pl_left.Margin = new System.Windows.Forms.Padding(4);
this.pl_left.Name = "pl_left";
this.pl_left.Size = new System.Drawing.Size(260, 450);
this.pl_left.TabIndex = 1;
//
// pl_left_main
//
this.pl_left_main.BackColor = System.Drawing.Color.Transparent;
this.pl_left_main.Controls.Add(this.pl_gridandtree_container);
this.pl_left_main.Controls.Add(this.pl_left_top);
this.pl_left_main.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_left_main.Location = new System.Drawing.Point(0, 0);
this.pl_left_main.Margin = new System.Windows.Forms.Padding(4);
this.pl_left_main.Name = "pl_left_main";
this.pl_left_main.Size = new System.Drawing.Size(260, 450);
this.pl_left_main.TabIndex = 6;
//
// pl_gridandtree_container
//
this.pl_gridandtree_container.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_gridandtree_container.Controls.Add(this.treeLeft);
this.pl_gridandtree_container.Controls.Add(this.gridLeft);
this.pl_gridandtree_container.Dock = System.Windows.Forms.DockStyle.Fill;
this.pl_gridandtree_container.Location = new System.Drawing.Point(0, 45);
this.pl_gridandtree_container.Margin = new System.Windows.Forms.Padding(4);
this.pl_gridandtree_container.Name = "pl_gridandtree_container";
this.pl_gridandtree_container.Size = new System.Drawing.Size(260, 405);
this.pl_gridandtree_container.TabIndex = 9;
//
// treeLeft
//
this.treeLeft.Dock = System.Windows.Forms.DockStyle.Fill;
this.treeLeft.Location = new System.Drawing.Point(0, 0);
this.treeLeft.Margin = new System.Windows.Forms.Padding(4);
this.treeLeft.Name = "treeLeft";
this.treeLeft.Size = new System.Drawing.Size(260, 405);
this.treeLeft.TabIndex = 7;
this.treeLeft.Visible = false;
//
// gridLeft
//
this.gridLeft.AdapterObj = null;
this.gridLeft.BackColor = System.Drawing.SystemColors.Control;
this.gridLeft.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridLeft.Location = new System.Drawing.Point(0, 0);
this.gridLeft.Margin = new System.Windows.Forms.Padding(5);
this.gridLeft.Name = "gridLeft";
this.gridLeft.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gridLeft.Size = new System.Drawing.Size(260, 405);
this.gridLeft.SysModel = null;
this.gridLeft.TabIndex = 6;
//
// pl_left_top
//
this.pl_left_top.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.pl_left_top.Appearance.Options.UseBackColor = true;
this.pl_left_top.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_left_top.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_left_top.Location = new System.Drawing.Point(0, 0);
this.pl_left_top.Margin = new System.Windows.Forms.Padding(4);
this.pl_left_top.Name = "pl_left_top";
this.pl_left_top.Size = new System.Drawing.Size(260, 45);
this.pl_left_top.TabIndex = 8;
//
// pl_top
//
this.pl_top.Appearance.BackColor = System.Drawing.Color.Transparent;
this.pl_top.Appearance.Options.UseBackColor = true;
this.pl_top.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
this.pl_top.Dock = System.Windows.Forms.DockStyle.Top;
this.pl_top.Location = new System.Drawing.Point(0, 0);
this.pl_top.Name = "pl_top";
this.pl_top.Size = new System.Drawing.Size(535, 34);
this.pl_top.TabIndex = 13;
//
// panelControl1
//
this.panelControl1.Controls.Add(this.btnCancel);
this.panelControl1.Controls.Add(this.btnOk);
this.panelControl1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panelControl1.Location = new System.Drawing.Point(0, 403);
this.panelControl1.Margin = new System.Windows.Forms.Padding(4);
this.panelControl1.Name = "panelControl1";
this.panelControl1.Size = new System.Drawing.Size(535, 47);
this.panelControl1.TabIndex = 15;
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.Location = new System.Drawing.Point(441, 5);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(79, 35);
this.btnCancel.TabIndex = 24;
this.btnCancel.Text = "取消(&C)";
//
// btnOk
//
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.Appearance.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnOk.Appearance.Options.UseFont = true;
this.btnOk.Location = new System.Drawing.Point(357, 5);
this.btnOk.Margin = new System.Windows.Forms.Padding(4);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(76, 35);
this.btnOk.TabIndex = 23;
this.btnOk.TabStop = false;
this.btnOk.Text = "确定(&O)";
//
// gcMain
//
this.gcMain.AdapterObj = null;
this.gcMain.BackColor = System.Drawing.Color.Transparent;
this.gcMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.gcMain.Location = new System.Drawing.Point(0, 34);
this.gcMain.Margin = new System.Windows.Forms.Padding(5);
this.gcMain.Name = "gcMain";
this.gcMain.SiftEnumObj = Lskj.Control.GridControlEx.HeaderSiftEnum.Sum;
this.gcMain.Size = new System.Drawing.Size(535, 369);
this.gcMain.SysModel = null;
this.gcMain.TabIndex = 16;
//
// FrmDocumentSource
//
this.Appearance.BackColor = System.Drawing.SystemColors.Control;
this.Appearance.Options.UseBackColor = true;
this.Appearance.Options.UseFont = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.splitMain);
this.Name = "FrmDocumentSource";
this.Text = "FrmDocumentSource";
((System.ComponentModel.ISupportInitialize)(this.splitMain)).EndInit();
this.splitMain.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_left)).EndInit();
this.pl_left.ResumeLayout(false);
this.pl_left_main.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_gridandtree_container)).EndInit();
this.pl_gridandtree_container.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pl_left_top)).EndInit();
((Sys
+570
View File
@@ -0,0 +1,570 @@
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Columns;
using DevExpress.XtraGrid.Views.Grid;
using Lskj.Business;
using Lskj.Business.Impl;
using Lskj.Control;
using Lskj.Control.Model;
using Lskj.Data;
using Lskj.Model;
using Lskj.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Lskj.PubBill
{
public partial class FrmDocumentSource : BaseForm
{
/// <summary>
/// 配置的关联ModuleCodel值
/// </summary>
/// <value>The Union ModuleCodel.</value>
public string UnionModuleCodel;
/// <summary>
/// 左侧树数据
/// </summary>
public DataRow LeftRowObj;
/// <summary>
/// 系统模块实体对象
/// </summary>
/// <value>The system model.</value>
public ModuleModel SysModel { get; private set; }
/// <summary>
/// 自定义查询条件
/// </summary>
public MyControl SearchObj { get; private set; }
/// <summary>
/// 第一次进入
/// </summary>
private bool isFirst = true;
/// <summary>
/// 第一次进入
/// </summary>
private bool isFirstSearch = true;
/// <summary>
/// 左侧树结构
/// </summary>
public TreeViewEx LeftTreeViewEx;
/// <summary>
/// 左侧表格
/// </summary>
public GridControlEx LeftGridEx;
/// <summary>
/// 左侧结构关联字段
/// </summary>
public string ParentUnionField;
/// <summary>
/// 左侧树结构、表格主键
/// </summary>
public string ParentKeyField;
/// <summary>
/// CurrentOperColumnKey值(保存表格属性会用)
/// </summary>
/// <value>The data source.</value>
public string CurrentOperColumnKey = string.Empty;
/// <summary>
/// 左侧表格查询条件
/// </summary>
private MyControl _leftGridSearchObj;
/// <summary>
/// 返回行
/// </summary>
public DataRow[] DataRows = null;
public FrmDocumentSource(string ModuleCodel)
{
InitializeComponent();
this.UnionModuleCodel = ModuleCodel;
this.Disposed += new EventHandler(OnFrmModelLookUp_Disposed);
this.gcMain.GridView.OptionsBehavior.EditorShowMode = DevExpress.Utils.EditorShowMode.MouseDown;
DataRow modelRow = MainImpl.GetSystemdllTab(this.UnionModuleCodel);//获取单个模块信息
if (modelRow == null)
{
MessageUtil.Show("模块编号[" + UnionModuleCodel + "],配置错误!\r\n该模块信息未找到!");
return;
}
this.SysModel = new ModuleModel(modelRow);// 系统模块实体对象
//设置关联模块(左侧)
this.InitLeftControls();
//设置主表
this.InitMainControls();
this.btnCancel.Click += btnCancel_Click;
this.btnOk.Click += btnOk_Click;
}
/// <summary>
/// 初始化左侧表
/// </summary>
public void InitLeftControls()
{
if (this.SysModel != null)
{
switch (this.SysModel.MenuType)
{
case 1: // 左侧为树节点
this.pl_left_top.Visible = false;
this.gridLeft.Visible = false;
this.treeLeft.Visible = true;
this.InitlizeSpiltLocation();//设置分割条位置
this.SetLeftTreeView();//设置左侧树数据
this.LeftTreeViewEx = this.treeLeft;
break;
case 2: // 左侧为表格
this.gridLeft.Visible = true;
this.treeLeft.Visible = false;
this.InitlizeSpiltLocation();
this.SetLeftGridView();
this.LeftGridEx = this.gridLeft;
break;
case 3: // 左侧为空
default:
this.splitMain.PanelVisibility = SplitPanelVisibility.Panel2;
break;
}
}
else
{
this.splitMain.PanelVisibility = SplitPanelVisibility.Panel2;
}
}
/// <summary>
/// 初始化主表
/// </summary>
public void InitMainControls()
{
//设置上方条件
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.ParentKeyField = this.ParentKeyField;
this.SearchObj.ParentUnionField = this.ParentUnionField;
this.SearchObj.OnDataSourceBindCallBack += new EventHandler(OnFirstPageDataSourceBindCallBack);
this.SearchObj.OnSearchAfterCallBack += new EventHandler(OnSearchAfterd);
this.pl_top.Height = 0;
this.pl_top.Height = this.SearchObj.InitSearchControl(queryTable, this.pl_top);
//创建表格列
DataTable _gridColumns = BaseModuleImpl.GetBaseGridColumns(this.UnionModuleCodel);
this.gcMain.SetReadOnlyColumns(_gridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey);
//this.SetCustomColumns();
//设置复选框
GridDragGrid.GridAddCheckBox(gcMain.GridView);
//右键
DataTable dt = BaseModuleImpl.GetBaseGridRightMenus(this.UnionModuleCodel);
string[] obj = new string[]{
"",
ERPInfo.Instance.UserId,
ERPInfo.Instance.UserName,
"3",
this.UnionModuleCodel,
}; ;
DynamicModel dynamicModel = new DynamicModel(obj);
this.gcMain.SetGridRightMenus(dt, dynamicModel, this.OnGridViewRightCallBack, this.SearchObj, null);
this.gcMain.GridView.OptionsView.ColumnAutoWidth = true;
}
/// <summary>
/// 查询后清空复选框勾选
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnSearchAfterd(object sender, EventArgs e)
{
this.gcMain.GridView.ClearSelection();
}
/// <summary>
/// 初始化后默认查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void OnFirstPageDataSourceBindCallBack(object sender, EventArgs e)
{
//打开时默认选中第一条
if (LeftTreeViewEx != null && LeftTreeViewEx.TreeView.Nodes.Count > 0)
{
LeftTreeViewEx.TreeView.SelectedNode = LeftTreeViewEx.TreeView.Nodes[0];
LeftTreeViewEx.TreeView.Nodes[0].Expand();
}
else if (LeftGridEx != null)
{
LeftGridEx.GridView.SelectRow(0);
}
this.SearchObj.SearchGrid();
}
#region
/// <summary>
/// <para>说明:设置分割条位置</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2021-07-21 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
protected void InitlizeSpiltLocation()
{
try
{
string width = IniHelper.Read(string.Format("bill_Special_Width_{0}", this.UnionModuleCodel));//通过Key获取Value值
if (!string.IsNullOrEmpty(width))
{
this.splitMain.SplitterPosition = Convert.ToInt32(width);
}
}
catch (Exception ex)
{
LogHelper.Instance.WriteError(ex);
MessageUtil.Show(ex);
}
}
#endregion
#region
/// <summary>
/// <para>说明:保存表格属性</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2021-07-20 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected virtual void SaveItemClick(object sender, EventArgs e)
{
DataRow rowItem = null;
bool success = BaseImpl.HasExistsDataRow(ResourceKeys.SettingTableName, "formKey", CurrentOperColumnKey, string.Format(" and OperatorId='{0}' ", ERPInfo.Instance.UserId), out rowItem);
if (!success)
{
MessageUtil.Show(ResourceKeys.NotFoundSettingColumnTable);
return;
}
if (MessageUtil.Show(ResourceKeys.IsSaveColumn, MessageBoxButtons.YesNo) == DialogResult.Yes)
{
try
{
if (rowItem == null)
{
success = this.gcMain.GridView.SaveCustomColumnToDatabase(this.CurrentOperColumnKey);
}
else
{
success = this.gcMain.GridView.UpdateCustomColumnToDatabase(this.CurrentOperColumnKey);
}
MessageUtil.Show(success ? ResourceKeys.SaveSuccess : ResourceKeys.SaveFault);
}
catch (SqlException sex)
{
if (sex.Message.Contains(ResourceKeys.FieldLenIsShort) &&
MessageUtil.Show(ResourceKeys.SaveFault + "\r\n" + ResourceKeys.CanUpgradeTable, MessageBoxButtons.YesNo) == DialogResult.Yes &&
BaseImpl.UpdateTableField(ResourceKeys.SettingTableName, "formKey", "varchar(200)"))
{
MessageUtil.Show(ResourceKeys.UpdateSuccess);
}
}
catch (Exception ex)
{
LogHelper.Instance.WriteError(ex);
LogUtil.WriteError("保存表格属性出错", ex);
MessageUtil.Show(ex);
}
}
}
#endregion
#region
/// <summary>
/// <para>说明:加载自定义列</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2019-9-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void SetCustomColumns()
{
if (string.IsNullOrEmpty(this.CurrentOperColumnKey) || !BaseImpl.HasExistsTable(ResourceKeys.SettingTableName)) return;
DataTable customTable = this.gcMain.GridView.GetCustomColumnByDatabase(this.CurrentOperColumnKey);
if (customTable != null && customTable.Rows.Count > 0)
{
foreach (DataRow rowItem in customTable.Rows)
{
string fieldName = rowItem["fieldName"] + "";
int fieldWidth = Convert.ToInt32(rowItem["fieldWidth"]);
int index = Convert.ToInt32(rowItem["orderid"]);
bool visible = "1".Equals(rowItem["isVisible"] + "") && fieldWidth > 0;
bool isFix = "True".Equals(rowItem["IfFixColumn"] + "", StringComparison.OrdinalIgnoreCase);
GridColumn gridColumn = this.gcMain.GridView.Columns.ColumnByName(fieldName);
if (gridColumn != null && gridColumn.Visible && gridColumn.Width > 0)
{
GridColumn colObj = this.gcMain.GridView.Columns[fieldName];
colObj.VisibleIndex = index;
colObj.Width = fieldWidth;
colObj.Visible = visible;
colObj.Fixed = isFix ? FixedStyle.Left : FixedStyle.None;
}
}
}
}
#endregion
#region
/// <summary>
/// <para>说明:设置左侧树数据</para>
/// <para>创建人:王一帆</para>
/// <para>创建日期:2021-07-21 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
protected void SetLeftTreeView()
{
this.LeftRowObj = BaseModuleImpl.GetBaseLeftTreeField(this.UnionModuleCodel);//获取表格左侧树字段
if (this.LeftRowObj != null)
{
//this.ModuleGridObj.ParentUnionField = this.LeftRowObj["fieldname"] + "";
this.ParentUnionField = this.LeftRowObj["fieldname"] + "";
this.ParentKeyField = this.LeftRowObj["fieldsqlid"] + "";
this.treeLeft.TreeNodeKeyField = this.LeftRowObj["fieldsqlid"] + "";
this.treeLeft.TreeNodeTextField = this.LeftRowObj["fieldsqlname"] + "";
this.treeLeft.TreeNodeSelectAfter += new TreeViewEventHandler(OnTreeLeftTreeNodeSelected);
this.treeLeft.BindTreeView(BaseImpl.GetDataTableResult(this.LeftRowObj["fieldsql"] + ""));
}
else
{
// 根据模块上配置的sql加载树
if (this.SysModel != null && !string.IsNullOrEmpty(this.SysModel.TreeSQL))
{
this.ParentUnionField = "SpeciesNo";
this.ParentKeyField = "SpeciesNo";
this.treeLeft.TreeNodeKeyField = "SpeciesNo";
this.treeLeft.TreeNodeTextField = "SpeciesName";
this.treeLeft.TreeNodeSelectAfter += new TreeViewEventHandler(OnTreeLeftTreeNodeSelected);
this.treeLeft.BindTreeView(BaseImpl.GetDataTableResult(this.SysModel.TreeSQL));
}
}
}
/// <summary>
/// <para>说明:树节点点击后刷新数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-10-26 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="TreeViewEventArgs"/> instance containing the event data.</param>
protected void OnTreeLeftTreeNodeSelected(object sender, TreeViewEventArgs e)
{
string where = string.Format(" and {0} like '{1}%' ", this.treeLeft.TreeNodeKeyField, e.Node.Name);
string sqlValue = ReplaceHelper.IsProcedure(this.SysModel.MenuSql) ?
ReplaceHelper.ReplaceTreeViewParentKeyCond(this.SysModel.MenuSql, treeLeft.GetSelectNodeValue()) :
ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql) + where;
//this.gcMain.gridControl.DataSource = MainImpl.GetDataTableResult(sqlValue);
this.SearchObj.SearchGrid(sqlValue);
this.gcMain.GridView.ClearSelection();
}
#region
/// <summary>
/// <para>说明:设置左侧表格数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2017-10-25 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
protected void SetLeftGridView()
{
this.LeftRowObj = BaseModuleImpl.GetBaseLeftTreeField(UnionModuleCodel);//获取表格左侧树字段
if (this.LeftRowObj != null)
{
DataTable dtTable = BaseModuleImpl.GetBaseLeftGridField(UnionModuleCodel);
DataTable dtColorTable = BaseModuleImpl.GetBaseGridRowColors(this.LeftRowObj["fieldKey"] + "");
this.gridLeft.GridView.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(OnGridViewRowClick);
this.gridLeft.SetGridRowColors(dtColorTable);
this.gridLeft.SetReadOnlyColumns(dtTable, GridCustomColumnStruct.BaseLeftGridView + UnionModuleCodel);
this.ParentUnionField = this.LeftRowObj["fieldname"] + "";
this.ParentKeyField = this.LeftRowObj["fieldsqlid"] + "";
//this.ModuleGridObj.ParentKeyField = this.LeftRowObj["fieldsqlid"] + "";
//this.ModuleGridObj.ParentUnionField = this.LeftRowObj["fieldname"] + "";
DataTable table = BaseModuleImpl.GetCustomQueryFields(this.LeftRowObj["fieldKey"] + "");
string searchSql = this.LeftRowObj["fieldsql"] + "";
if (table != null && table.Rows.Count > 0)
{
// 自定义查询条件
this._leftGridSearchObj = new MyControl(searchSql, this.gridLeft);
this.pl_left_top.Height = this._leftGridSearchObj.InitSearchControl(table, this.pl_left_top);
this._leftGridSearchObj.OnDataSourceBindCallBack += new EventHandler(OnLeftControlObjDataSourceBindCallBack);
}
else
{
DataTable leftGridCondtionTable = BaseImpl.GetDataTableResult(searchSql);
this.pl_left_top.Visible = false;
this.gridLeft.GridControl.DataSource = leftGridCondtionTable;
}
}
}
#endregion
#region
/// <summary>
/// <para>说明:刷新右侧表格数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-19 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="DevExpress.Data.SelectionChangedEventArgs"/> instance containing the event data.</param>
protected void OnGridViewRowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
{
try
{
string sqlValue = ReplaceHelper.ReplaceWhereCond(this.SysModel.MenuSql);
if (this.gridLeft.Visible)
{
DataRow rowitem = this.gridLeft.GridView.GetFocusedDataRow();
sqlValue = this._leftGridSearchObj != null ? this._leftGridSearchObj.ReplaceParentControlValue(sqlValue) : sqlValue;
sqlValue = ReplaceHelper.ReplaceRowParam(rowitem, sqlValue);
}
this.SearchObj.SearchGrid(sqlValue);
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
#endregion
#endregion
#region
/// <summary>
/// <para>说明:数据绑定完成后加载数据</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期: </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
protected void OnLeftControlObjDataSourceBindCallBack(object sender, EventArgs e)
{
try
{
this._leftGridSearchObj.SearchGrid();
}
catch (Exception ex)
{
string Message = ErrorMessage.PromptErrorMessage(ex);
MessageUtil.Show(Message, ex.Message);
}
}
#region
/// <summary>
/// <para>说明:确定</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-20 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void btnOk_Click(object sender, EventArgs e)
{
this.DataRows = gcMain.GetViewFocusedDataRows();
if (DataRows.Length > 0)
{
this.DialogResult = System.Windows.Forms.DialogResult.OK;
}
this.Close();
}
#endregion
#region
/// <summary>
/// <para>说明:取消</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-20 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
private void btnCancel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
#endregion
#region
/// <summary>
/// <para>说明:释放时清理数据源</para>
/// <para>创建人:龚宇超</para>
/// <para>创建日期:2018-03-16 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
private void OnFrmModelLookUp_Disposed(object sender, EventArgs e)
{
GC.Collect();
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
Binary file not shown.