You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.7 KiB
104 lines
2.7 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
using PDAForm.Comm;
|
|
|
|
namespace PDAForm.SelectComm
|
|
{
|
|
public partial class frmSelectBase : Form
|
|
{
|
|
public F_SelectBase m_Base = null;
|
|
public string selectValue = "";
|
|
public frmSelectBase()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public DialogResult ShowSelect()
|
|
{
|
|
m_Base.Init();
|
|
if (this.selectValue != "")
|
|
{
|
|
this.txtCode.Text = this.selectValue;
|
|
this.txtCode.Focus();
|
|
this.txtCode.SelectAll();
|
|
m_Base.Search(this.txtCode.Text.Trim());
|
|
}
|
|
m_Base.ShowGrid(this.dgShow);
|
|
this.lblState.Text = "记录:" + m_Base.dsShow.Tables[0].Rows.Count.ToString();
|
|
this.Text = "选择" + m_Base.name;
|
|
return this.ShowDialog();
|
|
}
|
|
|
|
private void frmSelectBase_Load(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
m_Base.Search(this.txtCode.Text.Trim());
|
|
m_Base.ShowGrid(this.dgShow);
|
|
this.lblState.Text = "记录:" + m_Base.dsShow.Tables[0].Rows.Count.ToString();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void txtCode_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
btnSearch_Click(new object(), new EventArgs());
|
|
}
|
|
}
|
|
|
|
private void btnSelect_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.dgShow.CurrentRowIndex < 0) throw new Exception("请选择一行记录!");
|
|
selectValue = Select();
|
|
this.DialogResult = DialogResult.OK;
|
|
this.Close();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyMessageBox.ShowErrorMessage(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void dgShow_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
btnSelect_Click(new object(), new EventArgs());
|
|
}
|
|
|
|
private void btnClose_Click(object sender, EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
#region 可覆写的方法
|
|
|
|
public virtual string Select()
|
|
{
|
|
return m_Base.dsShow.Tables[0].Rows[this.dgShow.CurrentRowIndex]["Code"].ToString();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|