160 lines
6.0 KiB
C#
160 lines
6.0 KiB
C#
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.Model;
|
|
using Lskj.Control.Model;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Util;
|
|
using Lskj.Data;
|
|
using DevExpress.XtraEditors;
|
|
|
|
namespace Lskj.PubChart
|
|
{
|
|
public partial class FrmMain : BaseForm
|
|
{
|
|
public DynamicPubchartModel PubchartModel;
|
|
/// <summary>
|
|
/// 系统模块实体对象
|
|
/// </summary>
|
|
/// <value>The system model.</value>
|
|
public ModuleModel SysModel { get; private set; }
|
|
/// <summary>
|
|
/// 控件数据源
|
|
/// </summary>
|
|
private DataTable _controlTable;
|
|
/// <summary>
|
|
/// 查询条件
|
|
/// </summary>
|
|
private DataTable _queryTable = new DataTable();
|
|
/// <summary>
|
|
/// 控件对象
|
|
/// </summary>
|
|
public MyControl SearchObj { get; private set; }
|
|
/// <summary>
|
|
/// 数据源
|
|
/// </summary>
|
|
private DataTable dtData;
|
|
//是否初始化完成
|
|
public bool _isInitFinish = false;
|
|
public FrmMain()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:窗体加载时</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-09-01 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
WaitForm.ShowForm();
|
|
try
|
|
{
|
|
this.PubchartModel.Privilege = this.PubchartModel.Privilege.Equals("3") ? "1" : PubchartModel.ModuleId > 0 ? BaseImpl.GetUserPurviewsByMenuId(PubchartModel.ModuleId + "") + "" : BaseImpl.GetUserPurviewsByMenuCode(PubchartModel.ModuleCode) + "";
|
|
this.SysModel = new ModuleModel(MainImpl.GetSystemdllTab(this.PubchartModel.ModuleCode));
|
|
this._queryTable = BaseModuleImpl.GetCustomQueryFields(this.SysModel.CondKey);
|
|
this.SearchObj = new MyControl(this.SysModel.MenuSql, this.chartControlEx.GridControlObj);
|
|
this.pl_right_where.Height = this.SearchObj.InitSearchControl(_queryTable, this.pl_right_where, null);
|
|
this.SearchObj.OnSearchAfterCallBack += new EventHandler(OnSearchAfter);
|
|
DataTable gridColumn = BaseModuleImpl.GetBaseGridColumns(this.PubchartModel.ModuleCode);
|
|
this.chartControlEx.PanelControlObj.Visible = true;
|
|
this.chartControlEx.SplitMain.PanelVisibility = SplitPanelVisibility.Both;//初始化时默认隐藏
|
|
|
|
this.chartControlEx.GridControlObj.GridView.OptionsView.ColumnAutoWidth = true;
|
|
this.chartControlEx.GridControlObj.SetEditColumns(gridColumn);
|
|
this.chartControlEx.GridControlObj.gridControl.DataSource = dtData;
|
|
this.chartControlEx.SetCharts(BaseModuleImpl.GetChartParams(SysModel.FormKey));
|
|
|
|
this.chartControlEx.SplitMain.SplitterMoved += new System.EventHandler(this.OnTopSplitterMoved);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.Instance.WriteError(ex, ResourceKeys.ChartModel);
|
|
//MessageUtil.Show(ex.Message + "\r\n" + ex.StackTrace);
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
this.InitializeSplitterPosition();
|
|
Lskj.Control.Model.AutoSizeChange.ControllInitializeSize(this);
|
|
this.chartControlEx.Visible = true;
|
|
}
|
|
|
|
WaitForm.HideForm();
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:查询条件执行后</para>
|
|
/// <para>创建人:王一帆</para>
|
|
/// <para>创建日期:2019-11-13 </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
|
|
{
|
|
dtData = this.chartControlEx.GridControlObj.gridControl.DataSource as DataTable;
|
|
this.chartControlEx.CreateChart(dtData);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message,ex.Message);
|
|
}
|
|
}
|
|
|
|
|
|
//分割条改变时
|
|
private void OnTopSplitterMoved(object sender, EventArgs e)
|
|
{
|
|
if (this._isInitFinish)// 是否为初始化创建
|
|
{
|
|
IniHelper.Write(string.Format("PubChart_{0}", this.PubchartModel.ModuleCode), this.chartControlEx.SplitMain.SplitterPosition + "");
|
|
}
|
|
}
|
|
|
|
//初始化设置分割条为准
|
|
public void InitializeSplitterPosition()
|
|
{
|
|
try
|
|
{
|
|
|
|
string splitterPosition = IniHelper.Read(string.Format("PubChart_{0}", this.PubchartModel.ModuleCode));
|
|
if (!string.IsNullOrEmpty(splitterPosition))
|
|
{
|
|
this.chartControlEx.SplitMain.SplitterPosition = Convert.ToInt32(splitterPosition);
|
|
}
|
|
else
|
|
{
|
|
this.chartControlEx.SplitMain.SplitterPosition = this.chartControlEx.Height / 2;
|
|
}
|
|
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
}
|
|
finally
|
|
{
|
|
_isInitFinish = true;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|