基线 SVN r240
SVN-Revision: r240
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using Lskj.Core;
|
||||
using DevExpress.XtraEditors;
|
||||
using DevExpress.XtraEditors.Controls;
|
||||
using DevExpress.XtraGrid.Views.Grid;
|
||||
using System.Reflection;
|
||||
using DevExpress.Data.Filtering;
|
||||
|
||||
namespace CsHospital.UserControls
|
||||
{
|
||||
public partial class UserJsjg : UserControl
|
||||
{
|
||||
public UserJsjg()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
private void binddb(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
DBConfig.Instance.CreateConnection();
|
||||
string sql = string.Format(" SELECT dm_yy.yymc,dm_yy.PYM FROM dm_yy where 1=1 and (dbo.P_getpy('yydm') like '%%' or yydm like '%%')");
|
||||
DataTable employee = SqlHelper.ExecuteDataTable(sql);
|
||||
this.GridLookUpEdit1.Properties.DataSource = employee;
|
||||
}
|
||||
private void gridLookUpEdit1_Popup(object sender, EventArgs e)
|
||||
{
|
||||
GridLookUpEdit edit = sender as GridLookUpEdit;
|
||||
FilterLookup(sender, new string[] { "yymc", "PYM" });//中文,全拼英,简拼
|
||||
}
|
||||
|
||||
|
||||
private void gridLEdit1_EditValueChanging(object sender, ChangingEventArgs e)
|
||||
{
|
||||
this.BeginInvoke(new System.Windows.Forms.MethodInvoker(delegate
|
||||
{
|
||||
FilterLookup(sender, new string[] { "yymc", "PYM" });
|
||||
}));
|
||||
}
|
||||
private void gridLUpEdit1_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
GridLookUpEdit edit = sender as GridLookUpEdit;
|
||||
edit.SelectionStart = edit.Text.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 拼英模糊查询的关键方法
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="arrFilterField"></param>
|
||||
private void FilterLookup(object sender, string[] arrFilterField)
|
||||
{
|
||||
GridLookUpEdit edit = sender as GridLookUpEdit;
|
||||
GridView gridView = edit.Properties.View as GridView;
|
||||
FieldInfo fi = gridView.GetType().GetField("extraFilter", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
CriteriaOperator[] arrCriteriaOperator = new CriteriaOperator[arrFilterField.Length];
|
||||
for (int i = 0; i < arrFilterField.Length; i++)
|
||||
{
|
||||
arrCriteriaOperator[i] = new BinaryOperator(arrFilterField[i], "%" + edit.AutoSearchText + "%", BinaryOperatorType.Like);
|
||||
}
|
||||
string filterCondition = new GroupOperator(GroupOperatorType.Or, arrCriteriaOperator).ToString();
|
||||
fi.SetValue(gridView, filterCondition);
|
||||
MethodInfo mi = gridView.GetType().GetMethod("ApplyColumnsFilterEx", BindingFlags.NonPublic | BindingFlags.Instance);
|
||||
mi.Invoke(gridView, null);
|
||||
}
|
||||
/// <summary>
|
||||
/// 回车触发下一个
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
public void textBox_KeyPress(object sender, KeyPressEventArgs e)
|
||||
{
|
||||
GridLookUpEdit gu = sender as GridLookUpEdit;
|
||||
if (e.KeyChar == (char)Keys.Enter)
|
||||
{
|
||||
SendKeys.Send("{tab}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user