private void txtType_KeyPress(object sender, KeyPressEventArgs e) { Control ctrl = (Control)sender; if ((int)e.KeyChar != 13) { string[] headText = new string[] { "分类代码", "分类名称", "拼音码" }; string[] mappName = new string[] { "ID", "MC", "pym" }; int[] colWidth = new int[] { 90, 90, 40 }; string[] searchFields = new string[] { "pym", "MC" }; TrasenFrame.Forms.FrmSelectCard selectCard = new TrasenFrame.Forms.FrmSelectCard(searchFields, headText, mappName, colWidth); selectCard.sourceDataTable = InstanceForm.BDatabase.GetDataTable("select ID,MC,dbo.getpywb(mc,0) pym from JC_MZ_YSPB_KSFL order by id asc"); selectCard.ReciveString = e.KeyChar.ToString(); e.Handled = true; selectCard.Width = 300; selectCard.srcControl = txtType; selectCard.WorkForm = this; selectCard.ShowDialog(); if (selectCard.DialogResult == DialogResult.OK) { this.txtType.Text = selectCard.SelectDataRow["MC"].ToString().Trim(); this.txtType.Tag = selectCard.SelectDataRow["ID"].ToString().Trim(); txtPXXH.Focus(); } } }
private void txtDept_KeyPress(object sender, KeyPressEventArgs e) { Control ctrl = (Control)sender; if (cfg3035.Config == "0") { if ((int)e.KeyChar != 13) { string[] headText = new string[] { "科室代码", "科室名称", "拼音码" }; string[] mappName = new string[] { "DEPT_ID", "NAME", "pym" }; int[] colWidth = new int[] { 90, 90, 40 }; string[] searchFields = new string[] { "pym", "NAME" }; TrasenFrame.Forms.FrmSelectCard selectCard = new TrasenFrame.Forms.FrmSelectCard(searchFields, headText, mappName, colWidth); selectCard.sourceDataTable = InstanceForm.BDatabase.GetDataTable("SELECT DEPT_ID ,[NAME],py_code pym FROM JC_DEPT_PROPERTY WHERE MZ_FLAG = 1 and jgbm=" + FrmMdiMain.Jgbm + " AND DELETED = 0 AND DEPT_ID in (select DEPT_ID from jc_dept_type_relation where type_code = '001') ORDER BY SORT_ID ASC"); selectCard.ReciveString = e.KeyChar.ToString(); e.Handled = true; selectCard.Width = 300; selectCard.srcControl = txtDept; selectCard.WorkForm = this; selectCard.ShowDialog(); if (selectCard.DialogResult == DialogResult.OK) { this.txtDept.Text = selectCard.SelectDataRow["NAME"].ToString().Trim(); this.txtDept.Tag = selectCard.SelectDataRow["DEPT_ID"].ToString().Trim(); txtType.Focus(); } } } else { if ((int)e.KeyChar != 13) { string[] headText = new string[] { "诊间代码", "诊间名称", "拼音码" }; string[] mappName = new string[] { "ZJID_QC", "ZJMC_QC", "pym" }; int[] colWidth = new int[] { 90, 90, 40 }; string[] searchFields = new string[] { "pym", "ZJMC_QC" }; TrasenFrame.Forms.FrmSelectCard selectCard = new TrasenFrame.Forms.FrmSelectCard(searchFields, headText, mappName, colWidth); selectCard.sourceDataTable = InstanceForm.BDatabase.GetDataTable("SELECT ZJID_QC ,ZJMC_QC,PYM FROM JC_ZJSZ_QC WHERE DELETED = 0"); selectCard.ReciveString = e.KeyChar.ToString(); e.Handled = true; selectCard.Width = 300; selectCard.srcControl = txtDept; selectCard.WorkForm = this; selectCard.ShowDialog(); if (selectCard.DialogResult == DialogResult.OK) { this.txtDept.Text = selectCard.SelectDataRow["ZJMC_QC"].ToString().Trim(); this.txtDept.Tag = selectCard.SelectDataRow["ZJID_QC"].ToString().Trim(); txtType.Focus(); } } } }
private void txtDept_KeyPress(object sender, KeyPressEventArgs e) { try { string sqlYS = @"select DEPT_ID AS ID,NAME,PY_CODE,WB_CODE from JC_DEPT_PROPERTY where MZ_FLAG=1 and P_DEPT_ID!=0 and DELETED=0"; DataTable dtYLFL = FrmMdiMain.Database.GetDataTable(sqlYS); if ((int)e.KeyChar == 8 || (int)e.KeyChar == 46) { txtDept.Text = ""; txtDept.Tag = ""; return; } Control control = (Control)sender; if ((int)e.KeyChar != 13) { string[] headtext = new string[] { "±àºÅ", "¿ÆÊÒÃû³Æ", "Æ´ÒôÂë", "Îå±ÊÂë" }; string[] mappingname = new string[] { "ID", "NAME", "PY_CODE", "WB_CODE" }; string[] searchfields = new string[] { "PY_CODE", "WB_CODE" }; int[] colwidth = new int[] { 0, 340, 0, 0 }; TrasenFrame.Forms.FrmSelectCard f = new TrasenFrame.Forms.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["ID"].ToString(); e.Handled = true; } } else { if (!string.IsNullOrEmpty(txtDept.Text)) { btnFind.Focus(); } } } catch { txtDept.Focus(); } }
private void txtDoctor_KeyPress(object sender, KeyPressEventArgs e) { try { Control ctrl = (Control)sender; if ((int)e.KeyChar != 13) { if (ctrl.Text == this.txtDoctor.Text) { string[] headText = new string[] { "编码", "姓名", "拼音码", "五笔码", "医生代码" }; string[] mappName = new string[] { "ID", "NAME", "PY_CODE", "WB_CODE", "D_CODE" }; int[] colWidth = new int[] { 60, 80, 70, 70, 80 }; string[] searchFields = new string[] { "NAME", "PY_CODE", "WB_CODE", "D_CODE" }; TrasenFrame.Forms.FrmSelectCard selectCard = new TrasenFrame.Forms.FrmSelectCard(searchFields, headText, mappName, colWidth); selectCard.sourceDataTable = _DataBase.GetDataTable("SELECT DISTINCT EMPLOYEE_ID AS ID,NAME,PY_CODE,WB_CODE,YS_CODE AS D_CODE FROM JC_EMPLOYEE_PROPERTY WHERE DELETE_BIT=0 AND (RYLX=6 or RYLX=1)"); selectCard.WorkForm = this; selectCard.srcControl = txtDoctor; selectCard.Font = txtDoctor.Font; selectCard.Width = 400; selectCard.Left = this.Left; selectCard.Top = this.Top; selectCard.ReciveString = e.KeyChar.ToString(); e.Handled = true; selectCard.ShowDialog(); if (selectCard.DialogResult == DialogResult.OK) { this.txtDoctor.Text = selectCard.SelectDataRow["NAME"].ToString().Trim(); this.txtDoctor.Tag = selectCard.SelectDataRow["ID"].ToString().Trim(); this.txtDoctor.Focus(); } return; } } } catch (Exception err) { MessageBox.Show(err.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }