提交当前本机最新程序
This commit is contained in:
@@ -18,6 +18,7 @@ using System.Windows.Forms;
|
||||
using DevExpress.XtraEditors;
|
||||
using DevExpress.XtraEditors.Controls;
|
||||
using Lskj.Control.Model;
|
||||
using Lskj.Business.Impl;
|
||||
|
||||
namespace Lskj.Control
|
||||
{
|
||||
@@ -51,12 +52,48 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
/// <value>The label.</value>
|
||||
public Label Label { get { return lblText; } }
|
||||
/// <summary>
|
||||
/// The contro object
|
||||
/// </summary>
|
||||
public MyControl ControlObj;
|
||||
/// <summary>
|
||||
/// 数据源
|
||||
/// </summary>
|
||||
public string SourceSQL = string.Empty;
|
||||
/// <summary>
|
||||
/// 是否带参数
|
||||
/// </summary>
|
||||
public bool Isparameters = false;
|
||||
|
||||
|
||||
public LabelComboxEdit()
|
||||
{
|
||||
InitializeComponent();
|
||||
// 绑定事件
|
||||
txtEdit.QueryPopUp += TxtEdit_QueryPopUp;
|
||||
|
||||
}
|
||||
|
||||
private void TxtEdit_QueryPopUp(object sender, CancelEventArgs e)
|
||||
{
|
||||
this.RefreshData();
|
||||
}
|
||||
|
||||
public void RefreshData()
|
||||
{
|
||||
if (Isparameters && !string.IsNullOrWhiteSpace(this.SourceSQL) && this.ControlObj != null)
|
||||
{
|
||||
string oldValue = this.EditValue;
|
||||
|
||||
string sqlValue = this.ControlObj.ReplaceControlValue(this.SourceSQL);
|
||||
sqlValue = sqlValue.Replace("#", "");
|
||||
DataTable table = BaseImpl.GetDataTableResult(sqlValue);
|
||||
this.SetDataSource(table, true);
|
||||
this.EditText = oldValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置控件显示文本</para>
|
||||
@@ -261,9 +298,25 @@ namespace Lskj.Control
|
||||
/// </summary>
|
||||
/// <param name="dataSource">数据源</param>
|
||||
public void SetDataSource(DataTable dataSource)
|
||||
{
|
||||
SetDataSource(dataSource, false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>说明:设置数据源</para>
|
||||
/// </summary>
|
||||
/// <param name="dataSource">数据源</param>
|
||||
/// <param name="clearBeforeBind">绑定前是否清空原数据源</param>
|
||||
public void SetDataSource(DataTable dataSource, bool clearBeforeBind)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (clearBeforeBind)
|
||||
{
|
||||
ClearDataSource();
|
||||
}
|
||||
if (dataSource == null) return;
|
||||
|
||||
foreach (DataRow item in dataSource.Rows)
|
||||
{
|
||||
ComboBoxModel model = new ComboBoxModel
|
||||
@@ -282,6 +335,17 @@ namespace Lskj.Control
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空下拉数据源和已选项,避免带参数下拉每次弹出重复追加。
|
||||
/// </summary>
|
||||
private void ClearDataSource()
|
||||
{
|
||||
this._sources.Clear();
|
||||
this.txtEdit.SelectedItem = null;
|
||||
this.txtEdit.EditValue = null;
|
||||
this.txtEdit.Properties.Items.Clear();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 背景颜色
|
||||
/// </summary>
|
||||
@@ -347,4 +411,4 @@ namespace Lskj.Control
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user