| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- using Core.Mes.Client.Comm.Tool;
- using CoreFS.CA06;
- using Infragistics.Win.UltraWinGrid;
- using System.Data;
- using System.Linq;
- namespace Core.StlMes.Client.Judge.Forms
- {
- 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;
- _whereColumn = whereColumn;
- 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()
- {
- 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 ultraTextEditor1_EditorButtonClick(object sender, Infragistics.Win.UltraWinEditors.EditorButtonEventArgs e)
- {
- PopupTextBox popupTextBox = new PopupTextBox(ultraGrid1.ActiveCell.Value.ToString(), 10000);
- popupTextBox.TxtInfo.ReadOnly = true;
- popupTextBox.UltraPanel1.Visible = false;
- popupTextBox.ShowDialog();
- }
- private void ultraGrid1_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
- {
- Choice();
- }
- }
- }
|