|
|
@@ -276,30 +276,31 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
fields.Add(field[i]);
|
|
|
}
|
|
|
//将查询到的结果返回界面
|
|
|
- string sql = "select " + BaseUtil.AddField(fields.ToArray()) + " from " + tableName + " where " + Tag + "='" + TextBox.Text.ToUpper() + "'";
|
|
|
+ string sql = "select " + BaseUtil.AddField(fields.ToArray()) + " from " + tableName + " where " + Name + "='" + TextBox.Text.ToUpper() + "'";
|
|
|
if (condition != null)
|
|
|
{
|
|
|
sql += " and " + condition;
|
|
|
}
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
- FormCollection fmCollection = Application.OpenForms;
|
|
|
- ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- for (int i = 0; i < dt.Columns.Count; i++)
|
|
|
- {
|
|
|
- fillControl( i, fmCollection[FormName]);
|
|
|
- }
|
|
|
- LeaveFindData = true;
|
|
|
- }
|
|
|
- else
|
|
|
- LeaveFindData = false;
|
|
|
+ dt = (DataTable)dh.ExecuteSql(sql, "select");
|
|
|
+ ReturnDataToFrom();
|
|
|
+ //FormCollection fmCollection = Application.OpenForms;
|
|
|
+ //ControlCollection controls = (ControlCollection)fmCollection[FormName].Controls;
|
|
|
+ //if (dt.Rows.Count > 0)
|
|
|
+ //{
|
|
|
+ // for (int i = 0; i < dt.Columns.Count; i++)
|
|
|
+ // {
|
|
|
+ // fillControl(i, fmCollection[FormName]);
|
|
|
+ // }
|
|
|
+ // LeaveFindData = true;
|
|
|
+ //}
|
|
|
+ //else
|
|
|
+ // LeaveFindData = false;
|
|
|
//不允许工单号为空的情况
|
|
|
LockCheckBox.Checked = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void fillControl( int i, Control ct)
|
|
|
+ private void fillControl(int i, Control ct)
|
|
|
{
|
|
|
for (int j = 0; j < setValueField.Length; j++)
|
|
|
{
|
|
|
@@ -308,7 +309,7 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
Control.ControlCollection controls = ct.Controls;
|
|
|
for (int k = 0; k < ct.Controls.Count; k++)
|
|
|
{
|
|
|
- fillControl( i, controls[k]);
|
|
|
+ fillControl(i, controls[k]);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -323,7 +324,6 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
{
|
|
|
SearchIconClick?.Invoke(sender, new EventArgs());
|
|
|
db = new DbFind(Name, tableName, selectField, setValueField, caller, formName, condition);
|
|
|
- db.FormClosing += Db_FormClosing;
|
|
|
db.Text = DBTitle1;
|
|
|
LogManager.DoLog("DbFind查询,发起窗口【" + formName + "】,查询表【" + tableName + "】,字段" + selectField + ",条件" + condition);
|
|
|
if (db.IsAbleDbFind1)
|
|
|
@@ -336,10 +336,10 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void Db_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
+ private void ReturnDataToFrom()
|
|
|
{
|
|
|
ReturnData1 = dt;
|
|
|
- DbChange?.Invoke(sender, new EventArgs());
|
|
|
+ DbChange?.Invoke(new object(), new EventArgs());
|
|
|
}
|
|
|
|
|
|
public void TextBox_Leave(object sender, EventArgs e)
|
|
|
@@ -358,7 +358,5 @@ namespace UAS_MES.CustomControl.TextBoxWithIcon
|
|
|
{
|
|
|
TextBox.Width = this.Width - Search_Icon.Width - 3;
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|