/******************************
* 说明:带左侧树、表格操作右侧表格的自定义控件
* 创建人:龚宇超
* 创建日期:2017-09-01
* 修改人:
* 修改日期:
* 修改备注:
* 版本:1.0.0.0
******************************/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Lskj.Business.Impl;
using Lskj.Util;
using Lskj.Model;
using Lskj.Control.Model;
using Lskj.Data;
using DevExpress.XtraEditors;
using DevExpress.XtraGrid.Views.Grid;
using System.IO;
using DevExpress.XtraGrid;
using DevExpress.XtraBars;
using DevExpress.XtraTab;
using DevExpress.XtraGrid.Columns;
using FastReport;
using DevExpress.XtraGrid.Views.BandedGrid;
using System.Diagnostics;
using Lskj.Core;
using Lskj.Business;
using DevExpress.XtraTreeList.Nodes;
using DevExpress.XtraTreeList;
using System.Collections;
using System.Threading.Tasks;
using DevExpress.XtraRichEdit;
using System.Data.SqlClient;
namespace Lskj.Control
{
///
/// 带左侧树、表格操作右侧表格的自定义控件
///
public partial class ModuleEx : UserControl
{
///
/// 当前富文本框是否改变
///
private bool _richTextDirty;
///
/// BMP字段
///
private string _labPicName;
///
/// 当前行
///
private DataRow _currentRow;
///
/// 左侧表格查询条件
///
private MyControl _leftGridSearchObj;
private GridDragTree _gridDragTree;
private GridDragGrid _gridDragGrid;
private BandedGridDragGrid _bandedGridDragGrid;
public bool IsExcel { get { return Model is DynamicExcelModel; } }
///
/// 是否为拖拽明细模式
///
public bool IsDragDetail;
///
/// 左侧条件
///
public string LeftCond;
///
/// 左侧树数据
///
public DataRow LeftRowObj;
///
/// 系统模块实体对象
///
/// The system model.
public ModuleModel SysModel { get; private set; }
///
/// 调用动态链接库默认传递参数对象
///
public DynamicModel Model { get; private set; }
///
/// 底部表格数据
///
public List Details;
///
/// 查询条件
///
/// The search object.
public MyControl SearchObj { get { return this.moduleGridDetailEx1.SearchObj; } }
///
/// 常用操作对象,用于加载时暂时获取焦点
///
/// The title label object.
public DevExpress.XtraEditors.DropDownButton ddbOperObj { get { return ModuleGridObj.ddbOperObj; } }
///
/// 带操作表格的自定义控件对象
///
public ModuleGridEx ModuleGridObj { get { return this.MainBodyTab.Visible ? (this.MainBodyTab.SelectedTabPage.Tag as ModuleGridDetailEx).ModuleGridObj : this.moduleGridDetailEx1.ModuleGridObj; } }
///
/// Gets the module grid detail object.
///
/// The module grid detail object.
public ModuleGridDetailEx ModuleGridDetailObj { get { return this.MainBodyTab.Visible ? this.MainBodyTab.SelectedTabPage.Tag as ModuleGridDetailEx : this.moduleGridDetailEx1; } }
///
/// 左侧树结构对象
///
/// The TreeView object.
public TreeViewEx LeftTreeViewObj { get { return this.treeLeft; } }
///
/// 左侧表格对象
///
/// The left grid view object.
public GridControlEx LeftGridViewObj { get { return this.gridLeft; } }
///
/// Excel控件
///
public ExcelControlEx ExcelControlObj;
///
/// 左侧表格行点击事件回调
///
public event EventHandler OnLeftGridViewRowClickCallBack;
///
/// 左侧树结构选中节后点回调
///
public event EventHandler OnLeftTreeViewRowClickCallBack;
///
/// 禁止刷新主表(树表格节点展开时禁止刷新主表)
///
public bool RefreshDisable = false;
///
/// 上一次选中的树表格节点
///
public TreeListNode treeListNode;
///
/// 动态列名表
///
public DataTable ColumnNameTable;
public ModuleEx()
{
InitializeComponent();
this.Disposed += OnModuleExDisposed;
}
///
/// Excel 控件包含 SpreadsheetControl、BarManager 和命令注册项,
/// 普通表格模块不应在设计器初始化阶段创建这些重型资源。
///
private ExcelControlEx EnsureExcelControl()
{
if (this.excelControlEx1 != null && !this.excelControlEx1.IsDisposed)
{
return this.excelControlEx1;
}
this.excelControlEx1 = new ExcelControlEx
{
AddEnabled = true,
DeleteEnabled = true,
Dock = DockStyle.Fill,
Margin = new Padding(6),
Name = "excelControlEx1",
PrintEnabled = true,
SaveEnabled = true,
TabIndex = 1,
Visible = false
};
this.pl_right.Controls.Add(this.excelControlEx1);
this.ExcelControlObj = this.excelControlEx1;
return this.excelControlEx1;
}
///
/// 说明:创建界面
/// 创建人:龚宇超
/// 创建日期:2017-09-12
/// 修改人:
/// 修改日期:
/// 修改备注:
/// 版本:1.0
///
/// The menu code.
public void InitControls(DynamicModel model)
{
try
{
if (model != null)
{
this.Model = model;
Dictionary