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 CoreFS.CA06;
using Core.Mes.Client.Comm.Server;
using Core.Mes.Client.Comm.Control;
using Core.Mes.Client.Comm.Tool;
using Infragistics.Win.UltraWinGrid;
namespace Core.StlMes.Client.BuyBillet
{
public partial class FrmJGONLINE : FrmBase
{
public FrmJGONLINE()
{
InitializeComponent();
}
private void FrmJGONLINE_Load(object sender, EventArgs e)
{
ug.DisplayLayout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
doQuery();
}
public override void ToolBar_Click(object sender, string ToolbarKey)
{
base.ToolBar_Click(sender, ToolbarKey);
switch (ToolbarKey)
{
case "Close":
this.Close();
break;
case "doQuery":
doQuery();
break;
case "doExcel":
Export();
break;
}
}
private void ug_bind()
{
DataTable dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_Rpt_JG_ONLINE", new object[] { }, this.ob);
DataTable dt1 = ds.Tables[0];
GridHelper.CopyDataToDatatable(dt, dt1, true);
RefreshAndAutoSize(ug);
}
private void doQuery()
{
ug_bind();
}
///
/// 刷新Grid数据并根据数据调整Grid列宽
///
/// 需要处理的Grid
public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid)
{
try
{
ultraGrid.DataBind();
foreach (Infragistics.Win.UltraWinGrid.UltraGridBand band in ultraGrid.DisplayLayout.Bands)
{
foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn column in band.Columns)
{
column.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand);
}
}
ultraGrid.Refresh();
}
catch { }
}
private void Export()
{
if (ug.Rows.Count == 0)
{
MessageUtil.ShowWarning("查询数据为空,无法导出!");
}
else
{
GridHelper.ulGridToExcel(ug, "接箍在线");
}
}
}
}