71b2e2bdf6
SVN-Revision: r567
611 lines
28 KiB
C#
611 lines
28 KiB
C#
/******************************
|
|
* 说明:基础档案添加界面
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-11-02
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using Lskj.Control;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Util;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Model;
|
|
using DevExpress.XtraTab;
|
|
using DevExpress.Utils;
|
|
using Lskj.Data;
|
|
using Lskj.Business;
|
|
using System.Threading;
|
|
using DevExpress.XtraEditors;
|
|
using Lskj.Core;
|
|
|
|
namespace Lskj.PubAdd
|
|
{
|
|
/// <summary>
|
|
/// 基础档案添加界面
|
|
/// </summary>
|
|
public partial class FrmMain : BaseForm
|
|
{
|
|
/// <summary>
|
|
/// 主表选中行
|
|
/// </summary>
|
|
public DataRow MaintabFocusedRow { get; private set; }
|
|
/// <summary>
|
|
/// 系统模块实体对象
|
|
/// </summary>
|
|
/// <value>The system model.</value>
|
|
public ModuleModel SysModel { get; private set; }
|
|
/// <summary>
|
|
/// 里面是否使用滚动条
|
|
/// </summary>
|
|
public bool isAutoScroll = false;
|
|
/// <summary>
|
|
/// 调用动态链接库默认传递参数
|
|
/// </summary>
|
|
public DynamicAddModel Model;
|
|
double H_Scaling;
|
|
double W_Scaling;
|
|
|
|
public DataTable details = new DataTable();
|
|
|
|
public FrmMain()
|
|
{
|
|
SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
|
|
InitializeComponent();
|
|
}
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
WaitForm.ShowForm();
|
|
|
|
try
|
|
{
|
|
Console.WriteLine("初始化开始:" + DateTime.Now);
|
|
//this.SuspendLayout();
|
|
this.SysModel = new ModuleModel(MainImpl.GetSystemdllTab(this.Model.ModuleCode));
|
|
this.SysModel.ParmaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode);
|
|
this.ModuleAddControl.OnAddRecordCallBack += OnAddRecordCallBack;
|
|
this.details = BaseModuleImpl.GetBaseAddTabDetail(Model.ModuleCode);
|
|
|
|
this.CreateControlLocation();
|
|
this.SetControlPanelSize();
|
|
|
|
this.CreateTabDetail();
|
|
Console.WriteLine("初始化完成:" + DateTime.Now);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
|
//this.ResumeLayout(false);
|
|
}
|
|
this.Text = Model.FormText + (string.IsNullOrWhiteSpace(Model.ObjectId) ? "" : "[" + Model.ObjectId + "]");
|
|
LogUtil.WriteDebug(Model.ModuleCode, "打开操作", ERPInfo.Instance.UserName, "打开[" + Model.FormText + "] 查看" + Model.ObjectId, Model.ModuleId + "");
|
|
WaitForm.HideForm();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:设置窗口大小</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menuCode">The menu code.</param>
|
|
private void SetControlPanelSize()
|
|
{
|
|
DataRow item = BaseModuleImpl.GetControlParentSize(this.SysModel.FormKey);
|
|
if (item != null)
|
|
{
|
|
int otherHeight = 80;
|
|
bool topVisible = false;
|
|
|
|
if ("lskj.pubadd.dll".Equals((this.SysModel.MenuAddName).ToLower()) ||
|
|
"lskj.pubadd2.dll".Equals((this.SysModel.MenuAddName).ToLower()))
|
|
{
|
|
otherHeight = 130;
|
|
topVisible = true;
|
|
}
|
|
//this.ModuleAddControl.SetTopPanelVisible(topVisible);//2023-9-1 把这个判断放入modulePanelEx初始化中
|
|
|
|
this.Width = Convert.ToInt32(item["width"] + "");
|
|
|
|
int height = this.ModuleAddControl.ControlHeight + this.ModuleAddControl.OperatePanelControlObj.Height + this.ModuleAddControl.SpeciesPanelControlObj.Height;
|
|
height = Convert.ToInt32(item["height"] + "") > height ? height : Convert.ToInt32(item["height"] + "");//如果控件高度小于设置高度,以实际高度为准
|
|
if (ModuleAddControl.SplitContainerControl.PanelVisibility == SplitPanelVisibility.Both)
|
|
{
|
|
height += 200;
|
|
}
|
|
this.Height = height + otherHeight;
|
|
|
|
//this.Height = Convert.ToInt32(item["height"] + "") + otherHeight;
|
|
if (this.Left < 0) this.Left = 0;
|
|
if (this.Top < 0) this.Top = 0;
|
|
this.Left = (Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 2;
|
|
this.Top = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
|
if ((this.Width > Screen.PrimaryScreen.WorkingArea.Width || (this.Height > Screen.PrimaryScreen.WorkingArea.Height)))
|
|
{
|
|
int screenHeight = Screen.PrimaryScreen.WorkingArea.Height;
|
|
screenHeight = screenHeight - 40;
|
|
this.Height = screenHeight;
|
|
this.Top = (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 2;
|
|
isAutoScroll = true;
|
|
ModuleAddControl.plMainControlObj.AutoScroll = isAutoScroll;
|
|
if (ModuleAddControl.SplitContainerControl.PanelVisibility == SplitPanelVisibility.Both)
|
|
{
|
|
this.ModuleAddControl.SplitContainerControl.SplitterPosition = (this.Height * 2) / 3;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
this.ModuleAddControl.plMainControlObj.AutoScroll = true;
|
|
this.ModuleAddControl.plMainControlObj.HorizontalScroll.Visible = false;
|
|
if (ModuleAddControl.SplitContainerControl.PanelVisibility == SplitPanelVisibility.Both)
|
|
{
|
|
this.ModuleAddControl.SplitContainerControl.SplitterPosition = this.ModuleAddControl.ControlHeight;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:初始化多标签</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void CreateTabDetail()
|
|
{
|
|
this.Invoke((EventHandler)delegate
|
|
{
|
|
bool isInside = false;
|
|
|
|
foreach (DataRow item in this.details.Rows)
|
|
{
|
|
if (this.details.Columns.Contains("orderId") && !string.IsNullOrWhiteSpace(item["orderId"] + "") && int.Parse(item["orderId"] + "") < 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
XtraTabPage tabPage = new XtraTabPage();
|
|
GridDetailModel detailModel = new GridDetailModel(item, null, GridCustomColumnStruct.BaseDetailGridView);
|
|
if (!string.IsNullOrEmpty(detailModel.UnionModule))
|
|
{
|
|
ModuleModel moduleModel = new ModuleModel(MainImpl.GetSystemdllTab(detailModel.UnionModule));
|
|
if (string.IsNullOrWhiteSpace(moduleModel.FormKey))
|
|
{
|
|
MessageUtil.Show(detailModel.DetailName + "模块配置错误");
|
|
return;
|
|
}
|
|
detailModel.DetailSql = moduleModel.MenuSql;
|
|
}
|
|
detailModel.GridColumns = ReportImpl.GetReportDetailColumns(Model.ModuleCode, item["id"] + "");
|
|
tabPage.Text = detailModel.DetailName;
|
|
tabPage.Tag = detailModel;
|
|
if (ModuleAddControl.plMainControlObj.Tag is XtraTabControl)
|
|
{
|
|
XtraTabControl xtr = ModuleAddControl.plMainControlObj.Tag as XtraTabControl;
|
|
xtr.TabPages.Add(tabPage);
|
|
isInside = true;
|
|
xtr.SelectedPageChanged += new DevExpress.XtraTab.TabPageChangedEventHandler(this.OnSelectedPageChanged);
|
|
xtr.SelectedPageChanging += new DevExpress.XtraTab.TabPageChangingEventHandler(this.OnSelectedPageChanging);
|
|
}
|
|
else
|
|
{
|
|
this.xtcControl.TabPages.Add(tabPage);
|
|
}
|
|
}
|
|
|
|
this.xtcControl.ShowTabHeader = details.Rows.Count > 0 && !isInside ? DefaultBoolean.True : DefaultBoolean.False;
|
|
});
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:创建控件</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-03 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
private void CreateControlLocation()
|
|
{
|
|
this.ModuleAddControl.SavaState = Model.SaveState.Equals("1");
|
|
this.ModuleAddControl.IsView = Model.IsView;
|
|
this.ModuleAddControl.ParentKey = Model.ParentKey;
|
|
this.ModuleAddControl.ParentValue = Model.ParentValue;
|
|
this.ModuleAddControl.PrimaryKey = this.SysModel.ParmaryKey;// BaseImpl.GetBasePrimaryKey(Model.ModuleCode); 和上方获取主键执行方法相同,直接取上方的值
|
|
this.ModuleAddControl.UnionKey = Model.UnionKey;
|
|
this.ModuleAddControl.UnionValue = Model.UnionValue;
|
|
this.ModuleAddControl.PrimaryValue = Model.ObjectId;
|
|
this.ModuleAddControl.ControlSql = Model.ControlSql;
|
|
this.ModuleAddControl.OnCloseCallback += new EventHandler(OnCloseCallback);
|
|
this.ModuleAddControl.SearchObject = Model.SearchObject;
|
|
|
|
if (this.details.Columns.Contains("orderId"))
|
|
{
|
|
DataRow[] dataRows = details.Select("orderId<0");
|
|
this.ModuleAddControl.DetailsData = dataRows;
|
|
}
|
|
|
|
this.ModuleAddControl.InitializeControl(SysModel, Model, isAutoScroll);
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:关闭按钮回调</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </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 OnCloseCallback(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:查询条件执行前</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
/// <param name="e">The e.</param>
|
|
protected void OnSearchBefore(object sender, SearchArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = xtcControl.SelectedTabPage;
|
|
if (ModuleAddControl.plMainControlObj.Tag is XtraTabControl)
|
|
{
|
|
XtraTabControl xtr = ModuleAddControl.plMainControlObj.Tag as XtraTabControl;
|
|
tabPage = xtr.SelectedTabPage;
|
|
}
|
|
if (tabPage != null)
|
|
{
|
|
ModuleGridEx moduleGrid = tabPage.Tag as ModuleGridEx;
|
|
GridDetailModel detailModel = moduleGrid.Tag as GridDetailModel;
|
|
|
|
moduleGrid.SearchObj.SearchGrid(detailModel.DetailSql + string.Format(" and {0}='{1}'", moduleGrid.DetailKeyField, moduleGrid.UnionValue));
|
|
}
|
|
e.Continue = false;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:查询条件执行后</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-10 </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 OnSearchAfter(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage tabPage = xtcControl.SelectedTabPage;
|
|
if (ModuleAddControl.plMainControlObj.Tag is XtraTabControl)
|
|
{
|
|
XtraTabControl xtr = ModuleAddControl.plMainControlObj.Tag as XtraTabControl;
|
|
tabPage = xtr.SelectedTabPage;
|
|
}
|
|
if (tabPage != null)
|
|
{
|
|
if (tabPage.Tag is ModuleGridEx)
|
|
{
|
|
ModuleGridEx moduleGrid = tabPage.Tag as ModuleGridEx;
|
|
GridDetailModel detailModel = moduleGrid.Tag as GridDetailModel;
|
|
tabPage.Text = detailModel.DetailName + "(" + moduleGrid.SearchObj.GridRowCount + "条)";
|
|
}
|
|
else if (tabPage.Tag is GridControlEx)
|
|
{
|
|
|
|
GridControlEx moduleGrid = tabPage.Tag as GridControlEx;
|
|
GridDetailModel detailModel = moduleGrid.Tag as GridDetailModel;
|
|
tabPage.Text = detailModel.DetailName + "(" + moduleGrid.DataRowCount() + "条)";
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:切换选项卡</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-09 </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="TabPageChangingEventArgs"/> instance containing the event data.</param>
|
|
protected void OnSelectedPageChanging(object sender, TabPageChangingEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
XtraTabPage page = e.Page;
|
|
if (page != null)
|
|
{
|
|
if (e.PrevPage == xtcControl.TabPages[0] && string.IsNullOrEmpty(this.ModuleAddControl.PrimaryValue))
|
|
{
|
|
MessageUtil.Show(ResourceKeys.BeforeSaveData);
|
|
e.Cancel = true;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:切换标签刷新主键值</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-04-09 </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="TabPageChangedEventArgs"/> instance containing the event data.</param>
|
|
protected void OnSelectedPageChanged(object sender, TabPageChangedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
|
|
XtraTabPage tabPage = e.Page;
|
|
ModuleAddControl.OperatePanelControlObj.Visible = true;
|
|
//XtraTabPage tabPage = this.xtcControl.SelectedTabPage;
|
|
if (tabPage.Tag is ModuleGridEx) ModuleAddControl.OperatePanelControlObj.Visible = false;
|
|
if (!(tabPage.Tag is GridDetailModel)) return;
|
|
ModuleAddControl.OperatePanelControlObj.Visible = false;
|
|
if (tabPage.Controls.Count == 0)
|
|
{
|
|
|
|
GridDetailModel detailModel = tabPage.Tag as GridDetailModel;
|
|
ModuleModel moduleModel = null;
|
|
DynamicAddModel addModel = new DynamicAddModel(new string[] {
|
|
detailModel.DetailName,
|
|
ERPInfo.Instance.UserId,
|
|
ERPInfo.Instance.UserName,
|
|
"1",detailModel.UnionModule,"","",""
|
|
});
|
|
if (string.IsNullOrEmpty(detailModel.UnionModule))
|
|
{
|
|
PanelControl plBottom = new PanelControl();
|
|
plBottom.Dock = DockStyle.Bottom;
|
|
plBottom.Visible = false;
|
|
PanelControl plMain = new PanelControl();
|
|
plMain.Dock = DockStyle.Fill;
|
|
GridControlEx gridEx = detailModel.AutoMultiHeader == 1 ? new BandedGridControlEx() : new GridControlEx();
|
|
gridEx.Dock = DockStyle.Fill;
|
|
gridEx.Tag = detailModel;
|
|
gridEx.Parent = plMain;
|
|
gridEx.Model = this.Model;
|
|
gridEx.SetReadOnlyColumns(detailModel.GridColumns, detailModel.GridCustomColumnKey);
|
|
//gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(model.FormKey), this.Model, OnGridViewRightCallBack);
|
|
//gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(model.FormKey));
|
|
|
|
gridEx.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(detailModel.FormKey), this.Model);
|
|
gridEx.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(detailModel.FormKey));
|
|
if (detailModel.IsCheck == 1)//加载复选框
|
|
{
|
|
GridDragGrid.GridAddCheckBox(gridEx.GridView);
|
|
}
|
|
// 加载配置查询条件
|
|
if (Model != null && Model.IsDetailSearch)
|
|
{
|
|
plBottom.Visible = true;
|
|
MyControl searchObj = new MyControl(detailModel.DetailSql, gridEx);
|
|
plBottom.Height = searchObj.InitSearchControl(BaseModuleImpl.GetCustomQueryFields(detailModel.FormKey), plBottom);
|
|
}
|
|
tabPage.Tag = gridEx;
|
|
tabPage.Controls.AddRange(new PanelControl[] { plBottom, plMain });
|
|
if (detailModel.AutoRefresh)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(this.ModuleAddControl.ParentKey))
|
|
{
|
|
string codeSql = "select";
|
|
codeSql += string.Format(" '{0}' as {1}", this.ModuleAddControl.PrimaryValue, this.ModuleAddControl.PrimaryKey);
|
|
gridEx.SetGridViewDataSource(SqlHelper.ExecuteDataTable(ReplaceHelper.ReplaceRowParam(BaseImpl.GetDataRowResult(codeSql), ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql))));
|
|
}
|
|
else if(this.ModuleAddControl.ControlObj.CurrentData!=null)
|
|
{
|
|
gridEx.SetGridViewDataSource(SqlHelper.ExecuteDataTable(ReplaceHelper.ReplaceRowParam(this.ModuleAddControl.ControlObj.CurrentData, ReplaceHelper.ReplaceWhereCond(detailModel.DetailSql))));
|
|
}
|
|
// 自动刷新
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
moduleModel = new ModuleModel(MainImpl.GetSystemdllTab(detailModel.UnionModule));
|
|
ModuleGridEx moduleGrid = new ModuleGridEx();
|
|
moduleGrid.IsDetail = true;
|
|
moduleGrid.Dock = DockStyle.Fill;
|
|
moduleGrid.Tag = detailModel;
|
|
moduleGrid.ParentKeyField = string.IsNullOrEmpty(detailModel.UnionParentField) ? SysModel.ParmaryKey : detailModel.UnionParentField;
|
|
|
|
//直接在控件数据源中取值,控件可能是禁显状态(没用控件获取不到值)
|
|
if (!string.IsNullOrWhiteSpace(moduleGrid.ParentKeyField) && this.ModuleAddControl.ControlObj.CurrentData.Table.Columns.Contains(moduleGrid.ParentKeyField))
|
|
{
|
|
moduleGrid.ParentKeyValue = moduleGrid.UnionValue = this.ModuleAddControl.ControlObj.CurrentData[moduleGrid.ParentKeyField] + "";
|
|
}
|
|
|
|
//moduleGrid.ParentKeyValue = this.ModuleAddControl.ControlObj.GetControlValue(moduleGrid.ParentKeyField);
|
|
moduleGrid.DetailKeyField = detailModel.UnionValue;
|
|
moduleGrid.UnionKey = detailModel.UnionValue;
|
|
//moduleGrid.UnionValue = this.ModuleAddControl.ControlObj.GetControlValue(moduleGrid.ParentKeyField); //Model.ObjectId;
|
|
moduleGrid.SearchControlSql = Model.ControlSql;
|
|
moduleGrid.InitializeControl(moduleModel, addModel);
|
|
moduleGrid.SearchObj.OnSearchBeforeCallBack += new SearchEventHandler(OnSearchBefore);
|
|
moduleGrid.SearchObj.OnSearchAfterCallBack += new EventHandler(OnSearchAfter);
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(moduleGrid);
|
|
tabPage.Controls.Add(moduleGrid);
|
|
tabPage.Tag = moduleGrid;
|
|
if (detailModel.AutoRefresh)
|
|
{
|
|
moduleGrid.SearchObj.OnDataSourceBindCallBack += new EventHandler(OnMainSearchDataSourceBindCallBack);
|
|
// 自动刷新
|
|
//moduleGrid.SearchObj.SearchGrid(ReplaceHelper.ReplaceWhereCond(moduleModel.MenuSql) + string.Format(" and {0}='{1}'", moduleGrid.DetailKeyField, moduleGrid.UnionValue));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:查询条件绑定完成查询数据</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期: </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 void OnMainSearchDataSourceBindCallBack(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
MyControl searchobj = sender as MyControl;
|
|
//if (!string.IsNullOrEmpty(this.SysModel.CustomColumnSQL))
|
|
//{
|
|
// BaseImpl.ExecSqlValue(searchobj.ReplaceControlValue(this.SysModel.CustomColumnSQL));
|
|
//}
|
|
searchobj.SearchGrid();
|
|
OnSearchAfter(null, null);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// 添加保存成功后执行
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void OnAddRecordCallBack(object sender, EventArgs e)
|
|
{
|
|
FormDialogModel dialogModel = new FormDialogModel()
|
|
{
|
|
DialogDllName = "Lskj.PubAdd.dll",
|
|
PubDialogType = DialogType.PubAddRecord,
|
|
ReturnTag = ModuleAddControl.ControlObj
|
|
};
|
|
this.Tag = dialogModel;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:窗口关闭</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-07-15 </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="FormClosedEventArgs"/> instance containing the event data.</param>
|
|
protected void OnFormClosed(object sender, FormClosedEventArgs e)
|
|
{
|
|
if (this.ModuleAddControl.ControlObj != null)
|
|
{
|
|
this.ModuleAddControl.ControlObj.ReleaseImageResources();
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:窗口关闭之前</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2019-07-15 </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="FormClosingEventArgs"/> instance containing the event data.</param>
|
|
protected void OnFormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.ModuleAddControl != null && this.ModuleAddControl.IsCard)
|
|
{
|
|
this.ModuleAddControl.CloseIDCardThread();
|
|
}
|
|
this.DialogResult = DialogResult.OK;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
protected override CreateParams CreateParams
|
|
{
|
|
get
|
|
{
|
|
CreateParams cp = base.CreateParams;
|
|
cp.ExStyle |= 0x02000000;
|
|
return cp;
|
|
}
|
|
}
|
|
}
|
|
}
|