private void txtjzks_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; int nkey = (int)e.KeyChar; if (nkey == 8 || nkey == 46) { control.Text = ""; control.Tag = ""; return; } if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "科室名称", "数字码", "拼音码", "dept_id" }; string[] mappingname = new string[] { "name", "d_code", "py_code", "dept_id" }; string[] searchfields = new string[] { "d_code", "py_code", "wb_code" }; int[] colwidth = new int[] { 150, 100, 100, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Fun.GetGhks(false, InstanceForm.BDatabase); f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); return; } else { control.Tag = Convert.ToInt32(f.SelectDataRow["dept_id"]); control.Text = f.SelectDataRow["name"].ToString().Trim(); } } }
void cmbYbzlx_KeyPress(object sender, KeyPressEventArgs e) { try { ComboBox cmbbs1 = sender as ComboBox; if (e.KeyChar == 13) { if (cmbbs1.Text == "") { cmbbs1.SelectedIndex = 0; return; } string ssql = @" select CODE,NAME from JC_YBZLX where DELETE_BIT=0"; TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "CODE", "Name" }, new string[] { "编码", "名称" }, new string[] { "CODE", "Name" }, new int[] { 80, 150 }); frmSelectCard.sourceDataTable = InstanceForm._database.GetDataTable(ssql); frmSelectCard.srcControl = cmbbs1; frmSelectCard.WorkForm = this; frmSelectCard.ReciveString = cmbbs1.Text; if (frmSelectCard.ShowDialog() == DialogResult.OK) { cmbbs1.Text = ""; cmbbs1.SelectedValue = Convert.ToInt32(frmSelectCard.SelectDataRow["CODE"]); cmbbs1.Text = frmSelectCard.SelectDataRow["Name"].ToString(); } DoFilterData(cmbbs1, "ybzlx_name", chkYbzlx.Checked); } } catch { } }
private void txtjzys_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; int nkey = (int)e.KeyChar; if (nkey == 8 || nkey == 46) { control.Text = ""; control.Tag = ""; return; } if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "医生姓名", "代码", "工号", "拼音码", "五笔码", "employee_id" }; string[] mappingname = new string[] { "name", "ys_code", "code", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "ys_code", "py_code", "wb_code" };//, "code" Modify By Tany 2008-12-19 不一定有工号 int[] colwidth = new int[] { 100, 75, 75, 75, 75, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Fun.GetGhys(0, InstanceForm.BDatabase); f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { control.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); control.Text = f.SelectDataRow["name"].ToString().Trim(); } } }
private void txthtdwmc_KeyUp(object sender, KeyEventArgs e) { Control control = (Control)sender; if ((int)e.KeyData != 13) { string[] headtext = new string[] { "单位名称", "数字码", "拼音码", "五笔码" }; string[] mappingname = new string[] { "dwmc", "szm", "pym", "wbm" }; string[] searchfields = new string[] { "dwmc", "szm", "pym", "wbm" }; int[] colwidth = new int[] { 150, 100, 100, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = InstanceForm.BDatabase.GetDataTable("select * from jc_htdw"); f.WorkForm = this; f.srcControl = txthtdwmc; f.Font = txthtdwmc.Font; f.Width = 400; f.ReciveString = txthtdwmc.Text; if (f.ShowDialog() == DialogResult.Cancel) { txthtdwmc.Focus(); } else { txthtdwmc.Tag = Convert.ToInt32(f.SelectDataRow["id"]); txthtdwmc.Text = f.SelectDataRow["dwmc"].ToString().Trim(); butok.Focus(); } } else { butok.Focus(); } e.Handled = true; }
private void txtDept_TextChanged(object sender, EventArgs e) { if (txtDept.Text.Trim() != string.Empty) { try { string ssql = @"select a.NAME as name,a.PY_CODE pym,a.WB_CODE wbm from JC_DEPT_PROPERTY a left join JC_DEPT_PROPERTY parentKs on a.P_DEPT_ID = parentKs.DEPT_ID "; TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "name", "pym", "wbm" }, new string[] { "科室名称", "拼音码", "五笔码" }, new string[] { "name", "pym", "wbm" }, new int[] { 150, 80, 80 }); DataTable datalist = InstanceForm._database.GetDataTable(ssql); frmSelectCard.sourceDataTable = datalist; frmSelectCard.srcControl = txtDept; frmSelectCard.WorkForm = this; frmSelectCard.Text = txtDept.Text.Trim(); //frmSelectCard.ReciveString = cmbbs1.Text; if (frmSelectCard.ShowDialog() == DialogResult.OK) { txtDept.Text += string.IsNullOrEmpty(txtDept.Text.Trim()) ? (frmSelectCard.SelectDataRow["name"].ToString() + ";") : (";" + frmSelectCard.SelectDataRow["name"].ToString() + ";"); } } catch { } } }
private void txtks_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar == 8) { txtys.Text = ""; txtys.Tag = ""; return; } if ((int)e.KeyChar == 8) { txtks.Text = ""; txtks.Tag = ""; return; } if ((int)e.KeyChar == 46) { txtys.Text = ""; txtys.Tag = ""; return; } if ((int)e.KeyChar == 46) { txtks.Text = ""; txtks.Tag = ""; return; } if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "科室名称", "数字码", "拼音码", "dept_id" }; string[] mappingname = new string[] { "name", "d_code", "py_code", "dept_id" }; string[] searchfields = new string[] { "d_code", "py_code", "wb_code" }; int[] colwidth = new int[] { 150, 100, 100, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbks; f.WorkForm = this; f.srcControl = txtks; f.Font = txtks.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); if (f.ShowDialog() == DialogResult.Cancel) { txtks.Focus(); e.Handled = true; } else { txtks.Tag = Convert.ToInt32(f.SelectDataRow["dept_id"]); txtks.Text = f.SelectDataRow["name"].ToString().Trim(); SendKeys.Send("{TAB}"); e.Handled = true; } } else { if (txtks.Text.Trim() == "") { txtks.Focus(); return; } SendKeys.Send("{TAB}"); e.Handled = true; } }
private void ks_select(object sender, KeyPressEventArgs e) { try { string sqlYS = string.Format(@"SELECT b.NAME AS DocName , b.PY_CODE , b.WB_CODE , b.EMPLOYEE_ID FROM JC_ROLE_DOCTOR a INNER JOIN JC_EMPLOYEE_PROPERTY b ON a.EMPLOYEE_ID = b.EMPLOYEE_ID INNER JOIN dbo.JC_EMP_DEPT_ROLE c ON a.EMPLOYEE_ID = c.EMPLOYEE_ID WHERE a.DOC_ID NOT IN ( SELECT TS_DOCGROUPMANAGE.DocId FROM TS_DOCGROUPMANAGE WHERE GroupID = {0} ) AND c.DEPT_ID = {1}", strGroupID, this.txtDept.Tag); DataTable dtYLFL = FrmMdiMain.Database.GetDataTable(sqlYS); if ((int)e.KeyChar == 8 || (int)e.KeyChar == 46) { textBox1.Text = ""; textBox1.Tag = ""; return; } Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "ҽʦÃû³Æ", "Æ´ÒôÂë", "Îå±ÊÂë", "±àºÅ", }; string[] mappingname = new string[] { "DocName", "PY_CODE", "WB_CODE", "EMPLOYEE_ID" }; string[] searchfields = new string[] { "PY_CODE", "WB_CODE" }; int[] colwidth = new int[] { 100, 80, 80, 1 }; using (FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth)) { f.sourceDataTable = dtYLFL; f.WorkForm = this; f.srcControl = textBox1; f.Font = textBox1.Font; f.Width = 350; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { textBox1.Focus(); return; } else { textBox1.Text = f.SelectDataRow["DocName"].ToString().Trim(); textBox1.Tag = f.SelectDataRow["EMPLOYEE_ID"].ToString(); e.Handled = true; } } } } catch { textBox1.Focus(); } }
private void txtitem_code_KeyPress(object sender, KeyPressEventArgs e) { try { Control control = (Control)sender; if ((int)e.KeyChar == 13) { txtnum.Focus(); return; } ; //Modify By Tany 2015-06-03 增加数字码检索 string[] headtext = new string[] { "项目名称", "单位", "单价", "编码", "拼音码", "五笔码", "数字码", "itemid", "统计项目", "套餐标志" }; string[] mappingname = new string[] { "item_name", "item_unit", "price", "item_code", "py_code", "wb_code", "d_code", "itemid", "statitem_code", "tc_flag" }; string[] searchfields = new string[] { "item_name", "py_code", "wb_code", "d_code", "item_code", "statitem_code", "tc_flag" }; int[] colwidth = new int[] { 220, 70, 70, 100, 100, 100, 100, 0, 0, 100 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbitem; f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 900; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { this.txtitem_code.Text = f.SelectDataRow["item_code"].ToString().Trim(); this.txtitem_code.Tag = f.SelectDataRow["itemid"].ToString().Trim(); this.txtitem_name.Text = f.SelectDataRow["item_name"].ToString().Trim(); this.txtitem_name.Tag = f.SelectDataRow["tc_flag"].ToString().Trim(); //Modify By Tany 2015-06-29 增加套餐标示来区分套餐 this.txtunit.Text = f.SelectDataRow["item_unit"].ToString().Trim(); this.txtprice.Text = f.SelectDataRow["price"].ToString().Trim(); this.txtacvalue.Text = f.SelectDataRow["price"].ToString().Trim(); this.lblstatitemcode.Text = f.SelectDataRow["statitem_code"].ToString().Trim(); this.txtnum.Text = "1"; if (Convert.ToDecimal(f.SelectDataRow["price"]) == 0 || new SystemCfg(10002, _DataBase).Config == "1") { txtprice.Enabled = true; txtprice.Focus(); } else { txtprice.Enabled = false; txtnum.Focus(); } } } catch (Exception err) { MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void ks_selectDept(object sender, KeyPressEventArgs e) { try { string sqlYS = string.Format(@"SELECT NAME , PY_CODE , WB_CODE , DEPT_ID FROM dbo.JC_DEPT_PROPERTY WHERE P_DEPT_ID != 0 AND P_DEPT_ID != 1"); DataTable dtYLFL = FrmMdiMain.Database.GetDataTable(sqlYS); if ((int)e.KeyChar == 8 || (int)e.KeyChar == 46) { textBox1.Text = ""; textBox1.Tag = ""; return; } Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "¿ÆÊÒÃû³Æ", "Æ´ÒôÂë", "Îå±ÊÂë", "±àºÅ", }; string[] mappingname = new string[] { "NAME", "PY_CODE", "WB_CODE", "DEPT_ID" }; string[] searchfields = new string[] { "PY_CODE", "WB_CODE" }; int[] colwidth = new int[] { 100, 80, 80, 1 }; using (FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth)) { f.sourceDataTable = dtYLFL; f.WorkForm = this; f.srcControl = txtDept; f.Font = txtDept.Font; f.Width = 350; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txtDept.Focus(); return; } else { txtDept.Text = f.SelectDataRow["NAME"].ToString().Trim(); txtDept.Tag = f.SelectDataRow["DEPT_ID"].ToString(); e.Handled = true; } } } } catch { txtDept.Focus(); } }
private void txtys_KeyPress(object sender, KeyPressEventArgs e) { try { //Control control = (Control)sender; if ((int)e.KeyChar == 13) { return; } ; if ((int)e.KeyChar == 8) { txtys.Text = ""; txtys.Tag = "0"; return; } ; string[] headtext = new string[] { "项目名称", "id", "拼音码", "五笔码" }; string[] mappingname = new string[] { "name", "employee_id", "py_code", "wb_code" }; string[] searchfields = new string[] { "py_code", "wb_code" }; int[] colwidth = new int[] { 300, 50, 100, 80 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbys; f.WorkForm = this; f.srcControl = toolStrip2; //f.Font = control.Font; f.Width = 600; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txtys.Focus(); } else { this.txtys.Text = f.SelectDataRow["name"].ToString().Trim(); this.txtys.Tag = f.SelectDataRow["employee_id"].ToString().Trim(); txtkhbl.Focus(); int bzybz = rdozy.Checked == true ? 1 : 0; int khlxid = Convert.ToInt32(Convertor.IsNull(label_title.Tag, "")); int ksdm = Convert.ToInt32(Convertor.IsNull(txtks.Tag, "0")); int ysdm = Convert.ToInt32(Convertor.IsNull(txtys.Tag, "0")); Select_blsz(bzybz, khlxid, ksdm, ysdm); } } catch (Exception err) { MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void loadData() { //获得机构编码 Modiby by Zouchihua 2011-10-11 LoadJgbm(); this.cmbJgbm.SelectedValueChanged += new EventHandler(cmbJgbm_SelectedValueChanged); string sSql = "select a.dept_id dept_br,a.name,a.inpatient_no,a.bed_no,c.name in_diagnosis,a.ward_id,b.ward_name from dbo.VI_ZY_VINPATIENT_ALL a left join jc_ward b on a.ward_id=b.ward_id left join jc_disease c on a.in_diagnosis=c.coding and isnull(a.ybjklx,0)=c.ybjklx where inpatient_id='" + this.BinID + "' and baby_id=0 "; DataTable myTb = InstanceForm._database.GetDataTable(sSql); if (myTb.Rows.Count == 0) { return; } lblName.Text = myTb.Rows[0]["name"].ToString().Trim(); lblZyh.Text = myTb.Rows[0]["inpatient_no"].ToString().Trim(); lblBedNo.Text = myTb.Rows[0]["bed_no"].ToString(); lblDiag.Text = myTb.Rows[0]["in_diagnosis"].ToString().Trim(); lblWard.Tag = myTb.Rows[0]["ward_id"]; lblWard.Text = myTb.Rows[0]["ward_name"].ToString(); Dept_Br = Convert.ToInt64(myTb.Rows[0]["dept_br"]); cmbJgbm_SelectedValueChanged(null, null); //Add By Tany 2014-12-19 增加下拉选择 cmbWard.KeyPress += delegate(object s, KeyPressEventArgs kpe) { if (kpe.KeyChar == '\r') { if (cmbWard.Text == "") { cmbWard.SelectedIndex = 0; return; } string ssql = @" select a.name,a.dept_id,a.py_code as pym,a.wb_code as wbm,b.ward_id from jc_dept_property a inner join jc_ward b on a.dept_id=b.dept_id where a.DELETED=0 ";//a.dept_id in(select dept_id from dbo.JC_DEPT_TYPE_RELATION where type_code='009') ssql = ssql + " and a.jgbm=" + this.cmbJgbm.SelectedValue.ToString(); TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "Ward_Id", "Name", "pym", "wbm" }, new string[] { "代码", "名称", "拼音码", "五笔码", "编号" }, new string[] { "Ward_Id", "Name", "PYM", "WBM", "Dept_id" }, new int[] { 80, 150, 80, 80, 80 }); frmSelectCard.sourceDataTable = InstanceForm._database.GetDataTable(ssql); frmSelectCard.srcControl = cmbWard; frmSelectCard.WorkForm = this; frmSelectCard.ReciveString = cmbWard.Text; if (frmSelectCard.ShowDialog() == DialogResult.OK) { cmbWard.Text = frmSelectCard.SelectDataRow["Name"].ToString(); cmbWard.SelectedValue = frmSelectCard.SelectDataRow["Ward_Id"].ToString();; } } }; }
private void txtjcxm_KeyPress(object sender, KeyPressEventArgs e) { try { Control control = (Control)sender; if ((int)e.KeyChar == 13) { return; } ; if ((int)e.KeyChar == 8) { txtjcxm.Text = ""; txtjcxm.Tag = "0"; return; } ; string[] headtext = new string[] { "项目名称", "单位", "orderid", "拼音码", "五笔码" }; string[] mappingname = new string[] { "item_name", "item_unit", "orderid", "py_code", "wb_code" }; string[] searchfields = new string[] { "item_name", "py_code", "wb_code" }; int[] colwidth = new int[] { 300, 50, 0, 100, 80 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbitem; f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 600; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { this.txtjcxm.Text = f.SelectDataRow["item_name"].ToString().Trim(); this.txtjcxm.Tag = f.SelectDataRow["orderid"].ToString().Trim(); btrefresh_Click(sender, null); } } catch (Exception err) { MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void txtYs_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar == 8) { control.Text = ""; control.Tag = "0"; return; } if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "医生姓名", "代码", "工号", "拼音码", "五笔码", "employee_id" }; string[] mappingname = new string[] { "name", "ys_code", "code", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "ys_code", "code", "py_code", "wb_code" }; int[] colwidth = new int[] { 100, 75, 75, 75, 75, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbys; f.WorkForm = this; f.srcControl = txtYs; f.Font = txtks.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txtYs.Focus(); } else { txtYs.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); txtYs.Text = f.SelectDataRow["name"].ToString().Trim(); //this.SelectNextControl(control, true, false, true, true); SendKeys.Send("{TAB}"); e.Handled = true; } } else { if (txtYs.Text.Trim() == "") { txtYs.Focus(); return; } SendKeys.Send("{TAB}"); e.Handled = true; } }
private void txtItemName_KeyPress(object sender, KeyPressEventArgs e) { try { string sqlYS = string.Format(@" select rtrim(order_name) as item_name, rtrim(order_unit) as item_unit,jc_hoitemdiction.order_id as orderid, py_code, wb_code from jc_hoitemdiction ,JC_HOI_DEPT where jc_hoitemdiction.ORDER_ID=JC_HOI_DEPT.ORDER_ID and jc_hoitemdiction.delete_bit=0 and jc_hoitemdiction.order_type<>7 and JC_HOI_DEPT.EXEC_DEPT={0}" , FrmMdiMain.CurrentDept.DeptId); DataTable dtYLFL = InstanceForm.BDatabase.GetDataTable(sqlYS); Control control = (Control)sender; if ((int)e.KeyChar == 13) { return; } if ((int)e.KeyChar == 8) { txtItemName.Text = ""; txtItemName.Tag = ""; return; } string[] headtext = new string[] { "ÏîÄ¿Ãû³Æ", "µ¥Î»", "orderid", "Æ´ÒôÂë", "Îå±ÊÂë" }; string[] mappingname = new string[] { "item_name", "item_unit", "orderid", "py_code", "wb_code" }; string[] searchfields = new string[] { "item_name", "py_code", "wb_code" }; int[] colwidth = new int[] { 300, 80, 0, 100, 80 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = dtYLFL; f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 600; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { this.txtItemName.Text = f.SelectDataRow["item_name"].ToString().Trim(); this.txtItemName.Tag = f.SelectDataRow["orderid"].ToString().Trim(); } } catch (Exception err) { MessageBox.Show(err.Message, "´íÎó", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void txtXzdz_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar == 8) { control.Text = ""; control.Tag = "0"; return; } if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "地址名称", "拼音码", "五笔码", "编码" }; string[] mappingname = new string[] { "NAME", "PY_CODE", "WB_CODE", "CODE" }; string[] searchfields = new string[] { "PY_CODE", "WB_CODE", "CODE" }; int[] colwidth = new int[] { 150, 90, 90, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbdz; f.WorkForm = this; f.srcControl = txtXzdz; f.Font = txtXzdz.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txtXzdz.Focus(); } else { txtXzdz.Tag = f.SelectDataRow["NAME"]; txtXzdz.Text = f.SelectDataRow["NAME"].ToString().Trim(); SendKeys.Send("{TAB}"); e.Handled = true; } } else { if (txtXzdz.Text.Trim() == "") { txtXzdz.Focus(); return; } SendKeys.Send("{TAB}"); e.Handled = true; } }
private void txtys_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar == 8 || (int)e.KeyChar == 46) { txtys.Tag = ""; txtys.Text = ""; e.Handled = true; return; } if ((int)e.KeyChar != 13 && Convertor.IsNumeric(e.KeyChar.ToString()) == false) { if (_menuTag.Function_Name == "Fun_ts_yp_ksstj_zyyp_all_ks") { Tbys = Fun.GetGhys(Convert.ToInt32(Convertor.IsNull(txtks.Tag, "0")), 0, InstanceForm.BDatabase); } string[] headtext = new string[] { "医生姓名", "代码", "工号", "拼音码", "五笔码", "employee_id" }; string[] mappingname = new string[] { "name", "ys_code", "code", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "ys_code", "py_code", "wb_code", "code" };//, "code" Modify By Tany 2008-12-19 不一定有工号 int[] colwidth = new int[] { 100, 75, 75, 75, 75, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbys; f.WorkForm = this; f.srcControl = txtys; f.Font = txtys.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txtys.Focus(); } else { txtys.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); txtys.Text = f.SelectDataRow["name"].ToString().Trim(); e.Handled = true; } } }
private void txtks_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if (e.KeyChar != '\r') { string[] strArray = new string[] { "科室名称", "数字码", "拼音码", "dept_id" }; string[] strArray2 = new string[] { "name", "d_code", "py_code", "dept_id" }; string[] strArray3 = new string[] { "d_code", "py_code", "wb_code" }; int[] numArray = new int[] { 150, 100, 100, 0 }; FrmSelectCard card = new FrmSelectCard(strArray3, strArray, strArray2, numArray); card.sourceDataTable = this.Tbks; card.WorkForm = this; card.srcControl = this.txtks; card.Font = this.txtks.Font; card.Width = 400; card.ReciveString = e.KeyChar.ToString(); if (card.ShowDialog() == DialogResult.Cancel) { this.txtks.Focus(); e.Handled = true; } else { this.txtks.Tag = Convert.ToInt32(card.SelectDataRow["dept_id"]); this.txtks.Text = card.SelectDataRow["name"].ToString().Trim(); SendKeys.Send("{TAB}"); e.Handled = true; this.GetZQ(Convert.ToInt16(this.txtks.Tag)); } } else if (this.txtks.Text.Trim() == "") { this.txtks.Focus(); } else { SendKeys.Send("{TAB}"); e.Handled = true; } }
private void txtuser_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "收费员", "拼音码", "五笔码", "employee_id" }; string[] mappingname = new string[] { "name", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "d_code", "py_code", "wb_code" }; int[] colwidth = new int[] { 150, 100, 100, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbuser; f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { control.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); control.Text = f.SelectDataRow["name"].ToString().Trim(); cmbsyzt_SelectedIndexChanged(sender, null); //this.SelectNextControl(control, true, false, true, true); SendKeys.Send("{TAB}"); e.Handled = true; } } else { if (control.Text.Trim() == "") { control.Focus(); return; } SendKeys.Send("{TAB}"); e.Handled = true; } }
private void ks_select(object sender, KeyPressEventArgs e) { string sqlYLFL = "select ID,FLMC,dbo.FUN_YP_ylfl(FID) as fid,PYM,WBM from YP_YLFL where BDELETE='0' and FLBH<>'0' order by id"; DataTable dtYLFL = InstanceForm.BDatabase.GetDataTable(sqlYLFL); if ((int)e.KeyChar == 8 || (int)e.KeyChar == 46) { txtYLFL.Text = ""; txtYLFL.Tag = ""; return; } Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "ID", "药理分类", "父类型", "拼音码", "五笔码" }; string[] mappingname = new string[] { "ID", "FLMC", "fid", "PYM", "WBM" }; string[] searchfields = new string[] { "PYM", "WBM" }; int[] colwidth = new int[] { 0, 150, 100, 80, 80 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = dtYLFL; f.WorkForm = this; f.srcControl = txtYLFL; f.Font = txtYLFL.Font; f.Width = 450; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txtYLFL.Focus(); return; } else { txtYLFL.Text = f.SelectDataRow["FLMC"].ToString().Trim(); txtYLFL.Tag = f.SelectDataRow["ID"].ToString(); e.Handled = true; } } }
void cmbGrjb_KeyPress(object sender, KeyPressEventArgs e) { try { ComboBox cmbbs1 = sender as ComboBox; if (e.KeyChar == 13) { if (cmbGflx.Text.Trim().Equals("江岸区公费")) { this.SelectNextControl(cmbbs1, true, false, true, true); return; } if (cmbbs1.Text == "") { cmbbs1.SelectedIndex = 0; return; } //OPTIONCODE, OPTIONNAME, OPTIONKIND, DEFAULTS, MEMO, PYM, WBM TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "OPTIONNAME", "wbm", "pym" }, new string[] { "编码", "个人级别", "五笔码", "拼音码" }, new string[] { "OPTIONCODE", "OPTIONNAME", "wbm", "pym" }, new int[] { 80, 150, 60, 60 }); frmSelectCard.sourceDataTable = _dtGrjb; frmSelectCard.srcControl = cmbbs1; frmSelectCard.WorkForm = this; frmSelectCard.ReciveString = cmbbs1.Text; if (frmSelectCard.ShowDialog() == DialogResult.OK) { cmbbs1.Text = ""; cmbbs1.SelectedValue = frmSelectCard.SelectDataRow["OPTIONCODE"]; cmbbs1.Text = frmSelectCard.SelectDataRow["OPTIONNAME"].ToString(); } this.SelectNextControl(cmbbs1, true, false, true, true); } } catch { } }
private void button3_Click(object sender, EventArgs e) { try { string ssql = "select ID,NAME,PY_CODE,WB_CODE from JC_DISEASE where BSCBZ=0 "; TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "ID", "NAME", "PY_CODE", "WB_CODE" }, new string[] { "代码", "主要诊断", "拼音码", "五笔码" }, new string[] { "ID", "NAME", "PY_CODE", "WB_CODE" }, new int[] { 80, 150, 80, 80 }); frmSelectCard.sourceDataTable = InstanceForm._database.GetDataTable(ssql); frmSelectCard.srcControl = txtZyZd; frmSelectCard.WorkForm = this; //frmSelectCard.ReciveString = cmbbs1.Text; if (frmSelectCard.ShowDialog() == DialogResult.OK) { txtZyZd.Text += string.IsNullOrEmpty(txtZyZd.Text.Trim()) ? (frmSelectCard.SelectDataRow["NAME"].ToString() + ";") : (";" + frmSelectCard.SelectDataRow["NAME"].ToString() + ";"); } } catch { } }
void cmbSflb_KeyPress(object sender, KeyPressEventArgs e) { try { ComboBox cmbbs1 = sender as ComboBox; if (e.KeyChar == 13) { if (cmbbs1.Text == "") { cmbbs1.SelectedIndex = 0; return; } string ssql = @" select ITEM_NAME as name,CODE as sflb,WB_CODE as wbm,PY_CODE as pym,'' as szm from jc_stat_item where CODE in (01,02,03) union all select name,sflb,wbm,pym,szm from jc_gf_sflb where del_bit=0"; TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "sflb", "Name", "wbm", "pym", "szm" }, new string[] { "编码", "名称", "五笔码", "拼音码", "数字码" }, new string[] { "sflb", "Name", "wbm", "pym", "szm" }, new int[] { 80, 150, 60, 60, 60 }); frmSelectCard.sourceDataTable = InstanceForm._database.GetDataTable(ssql); frmSelectCard.srcControl = cmbbs1; frmSelectCard.WorkForm = this; frmSelectCard.ReciveString = cmbbs1.Text; if (frmSelectCard.ShowDialog() == DialogResult.OK) { cmbbs1.Text = ""; cmbbs1.SelectedValue = frmSelectCard.SelectDataRow["sflb"]; cmbbs1.Text = frmSelectCard.SelectDataRow["Name"].ToString(); } this.SelectNextControl(cmbbs1, true, false, true, true); } } catch { } }
private void txttjys_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "医生姓名", "代码", "工号", "拼音码", "五笔码", "employee_id" }; string[] mappingname = new string[] { "name", "ys_code", "code", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "ys_code", "py_code", "wb_code", "code" }; int[] colwidth = new int[] { 100, 75, 75, 75, 75, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbys; //Fun.GetDocZyks(Convert.ToInt64(cmbjgbm.SelectedValue), InstanceForm.BDatabase); ; f.WorkForm = this; f.srcControl = txttjys; f.Font = txttjys.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txttjys.Focus(); } else { txttjys.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); txttjys.Text = f.SelectDataRow["name"].ToString().Trim(); txtmzzd.Focus(); } } else { if (Convert.ToInt32(txttjys.Tag) == 0 || txttjys.Text.Trim() == "") { return; } } }
private void txtzy_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "名称", "编码", "拼音码", "五笔码" }; string[] mappingname = new string[] { "name", "code", "py_code", "wb_code" }; string[] searchfields = new string[] { "name", "code", "py_code", "wb_code" }; int[] colwidth = new int[] { 150, 70, 70, 70 }; DataTable Tb = InstanceForm.BDatabase.GetDataTable("select code,name,py_code,wb_code from JC_OCCUPATI"); TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tb; f.WorkForm = this; f.srcControl = control; //f.Font = control.Font; f.Width = 400; f.Left = txtzy.Left; f.Top = txtzy.Top + txtzy.Height; f.ReciveString = e.KeyChar.ToString(); if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { txtzy.Text = f.SelectDataRow["name"].ToString().Trim(); txtzy.Focus(); SendKeys.Send("{TAB}"); } } else { SendKeys.Send("{TAB}"); } }
private DataTable Tbys; //¹ÒºÅÒ½ÉúÊý¾Ý private void txtKs_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "¿ÆÊÒÃû³Æ", "Îå±ÊÂë", "Æ´ÒôÂë", "dept_id" }; string[] mappingname = new string[] { "name", "wb_code", "py_code", "dept_id" }; string[] searchfields = new string[] { "py_code", "wb_code" }; int[] colwidth = new int[] { 150, 100, 100, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbks; f.WorkForm = this; f.srcControl = txtKs; f.Font = txtKs.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); if (f.ShowDialog() == DialogResult.Cancel) { txtKs.Focus(); e.Handled = true; } else { txtKs.Tag = f.SelectDataRow["dept_id"]; txtKs.Text = f.SelectDataRow["name"].ToString().Trim(); SendKeys.Send("{TAB}"); e.Handled = true; } } else { SendKeys.Send("{TAB}"); e.Handled = true; } }
private void txtYs_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar != 13 && Convertor.IsNumeric(e.KeyChar.ToString()) == false) { string[] headtext = new string[] { "Ò½ÉúÐÕÃû", "´úÂë", "¹¤ºÅ", "Æ´ÒôÂë", "Îå±ÊÂë", "employee_id" }; string[] mappingname = new string[] { "name", "ys_code", "code", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "ys_code", "code", "py_code", "wb_code" }; int[] colwidth = new int[] { 100, 75, 75, 75, 75, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbys; f.WorkForm = this; f.srcControl = txtYs; f.Font = txtKs.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); if (f.ShowDialog() == DialogResult.Cancel) { txtYs.Focus(); e.Handled = true; } else { txtYs.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); txtYs.Text = f.SelectDataRow["name"].ToString().Trim(); e.Handled = true; SendKeys.Send("{TAB}"); } } else { SendKeys.Send("{TAB}"); e.Handled = true; } }
private void ks_select(object sender, KeyPressEventArgs e) { try { Control control = (Control)sender; if ((int)e.KeyChar == 8 || (int)e.KeyChar == 46) { txtMZorKS.Tag = ""; txtMZorKS.Text = ""; e.Handled = true; return; } string selectSql = ""; DataTable tb_ksORys = new DataTable(); if ((int)e.KeyChar != 13) { string[] headtext = new string[5]; string[] mappingname = new string[5]; string[] searchfields = new string[2]; int[] colwidth = new int[5]; if (MZorZY == 1) { selectSql = @"select DEPT_ID,NAME,PY_CODE,WB_CODE,jgbm from JC_DEPT_PROPERTY where ZY_FLAG=1 and DELETED=0 and dept_id not in(select dmid from jc_ypkhbl_info where mzorzy=1) order by SORT_ID" ; tb_ksORys = InstanceForm.BDatabase.GetDataTable(selectSql); headtext = new string[] { "科室名称", "拼音码", "五笔码", "dept_id", "jgbm" }; mappingname = new string[] { "name", "PY_CODE", "WB_CODE", "dept_id", "jgbm" }; searchfields = new string[] { "PY_CODE", "WB_CODE" }; colwidth = new int[] { 160, 100, 100, 0, 0 }; } else { selectSql = @" select * from (select a.id as [user_id],a.code,b.[name],b.PY_CODE,b.WB_CODE from pub_user a left join jc_employee_property b on a.employee_id = b.employee_id where b.delete_bit = 0 and a.locked_bit=0) c where [user_id] in (select [user_id] from pub_group_user where group_id=4 or Group_Id =57) and user_id not in(select dmid from jc_ypkhbl_info where mzorzy=0)" ; tb_ksORys = InstanceForm.BDatabase.GetDataTable(selectSql); headtext = new string[] { "工号", "医生", "拼音码", "五笔码", "user_id" }; mappingname = new string[] { "code", "name", "PY_CODE", "WB_CODE", "user_id" }; searchfields = new string[] { "code", "PY_CODE", "WB_CODE" }; colwidth = new int[] { 80, 100, 90, 90, 0 }; } TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = tb_ksORys; f.WorkForm = this; f.srcControl = txtMZorKS; f.Font = txtMZorKS.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); return; } else { if (MZorZY == 1) { txtMZorKS.Tag = Convert.ToInt32(f.SelectDataRow["DEPT_ID"]); } else { txtMZorKS.Tag = Convert.ToInt32(f.SelectDataRow["user_id"]); } txtMZorKS.Text = f.SelectDataRow["name"].ToString().Trim(); e.Handled = true; } e.Handled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
void txtWrkUnit_KeyPress(object sender, KeyPressEventArgs e) { try { // Control control = (Control)sender; // if (e.KeyChar == 13) // { // if (control.Text == "") // { // control.Text = ""; // return; // } // string ssql = @" select ITEM_NAME as name,CODE as sflb,WB_CODE as wbm,PY_CODE as pym,'' as szm from jc_stat_item where CODE in (01,02,03) // union all // select name,sflb,wbm,pym,szm from jc_gf_sflb where del_bit=0"; // TrasenFrame.Forms.FrmSelectCard frmSelectCard = new FrmSelectCard(new string[] { "sflb", "Name", "wbm", "pym", "szm" }, // new string[] { "编码", "名称", "五笔码", "拼音码", "数字码" }, // new string[] { "sflb", "Name", "wbm", "pym", "szm" }, // new int[] { 80, 150, 60, 60, 60 }); // frmSelectCard.sourceDataTable = InstanceForm._database.GetDataTable(ssql); // frmSelectCard.srcControl = txt; // frmSelectCard.WorkForm = this; // frmSelectCard.ReciveString = txt; // if (frmSelectCard.ShowDialog() == DialogResult.OK) // { // txt.Text = ""; // cmbbs1.SelectedValue = frmSelectCard.SelectDataRow["sflb"]; // cmbbs1.Text = frmSelectCard.SelectDataRow["Name"].ToString(); // } // this.SelectNextControl(txt, true, false, true, true); // } // } // catch { } Control control = (Control)sender; int nkey = (int)e.KeyChar; if (nkey == 8 || nkey == 46) { control.Text = ""; control.Tag = ""; return; } if (nkey == 13) { if (cmbGflx.Text.Trim().Equals("武汉市公费")) { this.SelectNextControl(control, true, false, true, true); return; } if (string.IsNullOrEmpty(control.Text.Trim())) { control.Text = ""; control.Tag = ""; return; } else { this.SelectNextControl(control, true, false, true, true); } } if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "工作单位", "数字码", "拼音码" }; string[] mappingname = new string[] { "name", "pym", "wbm" }; string[] searchfields = new string[] { "name", "pym", "wbm" }; int[] colwidth = new int[] { 150, 100, 100 }; //string ssql = string.Format(@"select name,pym,wbm from jc_gf_WrkUnit where del_bit=0 "); TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = _dtWrkUnit; f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); return; } else { control.Tag = f.SelectDataRow["name"].ToString().Trim(); control.Text = f.SelectDataRow["name"].ToString().Trim(); } } } catch { } }
/// <summary> /// 套餐根据套餐名称进行检索 /// Add By Daniel 2014-12-09 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void txtitem_name_KeyPress(object sender, KeyPressEventArgs e) { try { Control control = (Control)sender; if ((int)e.KeyChar == 13) { txtnum.Focus(); return; } ; string[] headtext = new string[] { "项目名称", "单位", "单价", "编码", "拼音码", "五笔码", "itemid", "统计项目" }; string[] mappingname = new string[] { "item_name", "item_unit", "price", "item_code", "py_code", "wb_code", "itemid", "statitem_code" }; string[] searchfields = new string[] { "item_name", "py_code", "wb_code", "item_code", "statitem_code" }; int[] colwidth = new int[] { 150, 50, 70, 100, 80, 80, 30, 40 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbitem; f.WorkForm = this; f.srcControl = control; f.Font = control.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { control.Focus(); } else { this.txtitem_code.Text = f.SelectDataRow["item_code"].ToString().Trim(); this.txtitem_code.Tag = f.SelectDataRow["itemid"].ToString().Trim(); this.txtitem_name.Text = f.SelectDataRow["item_name"].ToString().Trim(); this.txtitem_name.Tag = f.SelectDataRow["tc_flag"].ToString().Trim(); //Modify By jchl 2017-03-20 增加套餐标示来区分套餐 this.txtunit.Text = f.SelectDataRow["item_unit"].ToString().Trim(); this.txtprice.Text = f.SelectDataRow["price"].ToString().Trim(); this.txtacvalue.Text = f.SelectDataRow["price"].ToString().Trim(); this.lblstatitemcode.Text = f.SelectDataRow["statitem_code"].ToString().Trim(); this.txtnum.Text = "1"; if (Convert.ToDecimal(f.SelectDataRow["price"]) == 0 || new SystemCfg(10002, _DataBase).Config == "1") { txtprice.Enabled = true; txtprice.Focus(); } else { txtprice.Enabled = false; txtnum.Focus(); } } //string sql = "select ITEM_CODE as code,a.ITEM_NAME as name,a.COST_PRICE as price,b.UNIT as item_unit,b.NUM,b.ACVALUE as je," // + "charge_bit as jz,b.statitem_code,xmid,cast(b.ID as varchar(100)) as id,'' as cz_id,'' DELETE_BIT ,cz_id as y_cz_id from ZY_FEE_SPECI b left join JC_HSITEM a on b.XMID=a.ITEM_ID " // + "where b.CHARGE_BIT=0 and a.DELETE_BIT=0 and a.ITEM_ID in (select a.SUBITEM_ID from JC_TC_MX a,JC_TC b where a.MAINITEM_ID=b.ITEM_ID and b.ITEM_NAME='" + txtitem_name.Text.Trim() + "') " // + "and b.ORDER_ID='" + order_id + "'"; //DataTable tbtc = _DataBase.GetDataTable(sql); //dgvyzxm.DataSource = tbtc; } catch (Exception err) { MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void txttjys_KeyPress(object sender, KeyPressEventArgs e) { Control control = (Control)sender; if ((int)e.KeyChar == 8) { txttjys.Tag = "0"; txttjys.Text = ""; e.Handled = true; return; } if ((int)e.KeyChar == 13 && Convertor.IsNumeric(txttjys.Text.Trim()) == true) { DataRow[] rows = Tbys.Select("code='" + txttjys.Text.Trim() + "'", ""); if (rows.Length == 1) { txttjys.Tag = rows[0]["employee_id"].ToString(); txttjys.Text = rows[0]["name"].ToString().Trim(); txtbz.Focus(); e.Handled = true; return; } else { txttjys.Tag = "0"; txttjys.Text = ""; e.Handled = true; return; } } if ((int)e.KeyChar != 13 && Convertor.IsNumeric(e.KeyChar.ToString()) == false) { string[] headtext = new string[] { "医生姓名", "代码", "工号", "拼音码", "五笔码", "employee_id" }; string[] mappingname = new string[] { "name", "ys_code", "code", "py_code", "wb_code", "employee_id" }; string[] searchfields = new string[] { "ys_code", "py_code", "wb_code", "code" };//, "code" Modify By Tany 2008-12-19 不一定有工号 int[] colwidth = new int[] { 100, 75, 75, 75, 75, 0 }; TrasenFrame.Forms.FrmSelectCard f = new FrmSelectCard(searchfields, headtext, mappingname, colwidth); f.sourceDataTable = Tbys; f.WorkForm = this; f.srcControl = txttjys; f.Font = txttjys.Font; f.Width = 400; f.ReciveString = e.KeyChar.ToString(); e.Handled = true; if (f.ShowDialog() == DialogResult.Cancel) { txttjys.Focus(); } else { txttjys.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]); txttjys.Text = f.SelectDataRow["name"].ToString().Trim(); txtbz.Focus(); e.Handled = true; } } if ((int)e.KeyChar == 13) { if (Convert.ToInt32(txttjys.Tag) == 0 || txttjys.Text.Trim() == "") { return; } txtbz.Focus(); } }