| 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 Core.Mes.Client.Comm.Control;
- using Core.Mes.Client.Comm.Server;
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- namespace Core.StlMes.Client.ZGMil.Common
- {
- public partial class BaseInfoPopup : FrmBase
- {
- private DataTable _dt;
- private UltraGridRow _choicedRow;
- private string _whereColumn;
- public UltraGridRow ChoicedRow
- {
- get { return _choicedRow; }
- set { _choicedRow = value; }
- }
- public BaseInfoPopup(DataTable dt, string whereColumn, params string[] hideColumns)
- {
- InitializeComponent();
- _dt = dt;
- ultraGrid1.DataSource = _dt.DefaultView;
- _whereColumn = whereColumn;
- labelTextBox1.Caption = dt.Columns[whereColumn].Caption;
- foreach (UltraGridColumn column in ultraGrid1.DisplayLayout.Bands[0].Columns)
- {
- if (hideColumns.Contains(column.Key))
- {
- ultraGrid1.DisplayLayout.Bands[0].Columns[column.Key].Hidden = true;
- }
- }
- ultraGrid1.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.False;
- //GridHelper.RefreshAndAutoSize(ultraGrid1);
- }
- private void Query()
- {
- string txt = labelTextBox1.Checked ? labelTextBox1.Text.Trim() : "";
- _dt.DefaultView.RowFilter = _whereColumn + " LIKE '%"+ txt +"%'";
- }
- private void Choice()
- {
- ultraGrid1.UpdateData();
- if (ultraGrid1.ActiveRow == null)
- {
- MessageUtil.ShowWarning("请选择一条记录!");
- return;
- }
- _choicedRow = ultraGrid1.ActiveRow;
- this.DialogResult = System.Windows.Forms.DialogResult.OK;
- }
- private void ultraToolbarsManager1_ToolClick(object sender, Infragistics.Win.UltraWinToolbars.ToolClickEventArgs e)
- {
- switch (e.Tool.Key)
- {
- case "查询":
- Query();
- break;
- case "确认选择":
- Choice();
- break;
- }
- }
- private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
- {
- Choice();
- }
- private void labelTextBox1_TextBox_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyData == Keys.Enter)
- {
- Query();
- }
- }
- }
- }
|