| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- 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();
- }
- /// <summary>
- /// 刷新Grid数据并根据数据调整Grid列宽
- /// </summary>
- /// <param name="ultraGrid">需要处理的Grid</param>
- 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, "接箍在线");
- }
- }
- }
- }
|