| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- 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.YdmPipeManage
- {
- public partial class BaseInfoPopup1 : FrmBase
- {
- private DataTable _dt;
- private UltraGridRow _choicedRow;
- private string _whereColumn;
- public UltraGridRow ChoicedRow
- {
- get { return _choicedRow; }
- set { _choicedRow = value; }
- }
- public BaseInfoPopup1(DataTable dt, string whereColumn, params string[] hideColumns)
- {
- InitializeComponent();
- _dt = dt;
- ultraGrid1.DataSource = _dt.DefaultView;
- _whereColumn = whereColumn;
- labelTextBox1.Caption = dt.Columns[whereColumn].Caption;
- dt.Columns["GRADENAME"].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();
- }
- }
- }
- }
|