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.Data; using Lskj.Model; namespace Lskj.BaseSelect { public partial class FrmMain : BaseForm { public string ParmaryKey; public DataTable QueryTable = new DataTable(); public DataTable GridColumns = new DataTable(); public MyControl SearchObj = new MyControl(); public DynamicBaseSelectModel Model; /// /// 系统模块实体对象 /// /// The system model. public ModuleModel SysModel { get; private set; } public FrmMain() { InitializeComponent(); } /// /// 说明:初始化 /// 创建人:龚宇超 /// 创建日期: /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The instance containing the event data. protected override void OnLoad(EventArgs e) { WaitForm.ShowForm(); try { DataRow modelRow = MainImpl.GetSystemdllTab(this.Model.ModuleCode); if (modelRow == null) { MessageUtil.Show("模块编号[" + this.Model.ModuleCode + "],配置错误!\r\n该模块信息未找到!"); return; } this.lblTotal.Text = Model.AmountValue; this.SysModel = new ModuleModel(modelRow); this.ParmaryKey = BaseImpl.GetBasePrimaryKey(this.Model.ModuleCode); this.QueryTable = BaseModuleImpl.GetCustomQueryFields(this.SysModel.CondKey); this.GridColumns = BaseModuleImpl.GetBaseGridColumns(this.Model.ModuleCode); this.SearchObj = new MyControl(this.SysModel.MenuSql, gcMain, null, null, null); this.PlSearch.Height = this.SearchObj.InitSearchControl(QueryTable, this.PlSearch); if (this.QueryTable == null || this.QueryTable.Rows.Count > 0) { this.PlSearch.Visible = false; } this.gcMain.SetEditColumns(this.GridColumns, GridCustomColumnStruct.BaseMainGridView + this.SysModel.FormKey); this.gcMain.SetGridRowColors(BaseModuleImpl.GetBaseGridRowColors(this.Model.ModuleCode)); this.gcMain.SetGridRightMenus(BaseModuleImpl.GetBaseGridRightMenus(this.Model.ModuleCode), this.Model, OnGridViewRightCallBack, this.SearchObj, null); } catch (Exception ex) { LogHelper.Instance.WriteError(ex, ResourceKeys.BaseModule); //MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace); throw; } WaitForm.HideForm(); } /// /// 说明:右键菜单执行后刷新数据,刷新规则按照上一次查询条件刷新 /// 创建人:龚宇超 /// 创建日期:2017-11-02 /// 修改人: /// 修改日期: /// 修改备注: /// 版本:1.0 /// /// The sender. /// The instance containing the event data. protected void OnGridViewRightCallBack(object sender, EventArgs e) { this.SearchObj.SearchLastGrid(); } } }