Example #1
0
        private void txtUse_KeyPress(object sender, KeyPressEventArgs e)
        {
            Control control = (Control)sender;

            if ((int)e.KeyChar != 13)
            {
                string[] headText     = new string[] { "编码", "名称", "拼音码", "五笔码", "数字码" };
                string[] mappName     = new string[] { "id", "name", "py_code", "wb_code", "d_CODE" };
                int[]    colWidth     = new int[] { 75, 70, 75, 75, 75 };
                string[] searchFields = new string[] { "py_code", "wb_code", "d_code" };
                TrasenFrame.Forms.FrmSelectCard selectCard = new TrasenFrame.Forms.FrmSelectCard(searchFields, headText, mappName, colWidth);
                selectCard.sourceDataTable = InstanceForm.BDatabase.GetDataTable("select id,name,py_code,wb_code,d_code from jc_usagediction order by id");
                selectCard.ReciveString    = e.KeyChar.ToString();
                e.Handled             = true;
                selectCard.Width      = 300;
                selectCard.srcControl = txtUse;
                selectCard.WorkForm   = this;
                selectCard.ShowDialog();
                if (selectCard.DialogResult == DialogResult.OK)
                {
                    this.txtUse.Text = selectCard.SelectDataRow["name"].ToString().Trim();
                    this.txtUse.Tag  = selectCard.SelectDataRow["id"].ToString().Trim();
                    txtNum.Focus();
                }
            }
        }
        private void txtksdm_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 TrasenFrame.Forms.FrmSelectCard(searchfields, headtext, mappingname, colwidth);
                f.sourceDataTable = InstanceForm.BDatabase.GetDataTable("select * from jc_dept_property where deleted=0 and layer=3 ");
                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();
                }
            }
        }
Example #3
0
        private void txtYs_KeyPress(object sender, KeyPressEventArgs e)
        {
            Control control = (Control)sender;

            if ((int)e.KeyChar == 8)
            {
                txtYs.Tag  = "0";
                txtYs.Text = "";
                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 TrasenFrame.Forms.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();
                f.StartPosition   = FormStartPosition.CenterScreen;
                //f.Top = txtYs.DisplayRectangle.Top + txtYs.Height;
                //f.Left = txtYs.DisplayRectangle.Left;

                //f.Top = dataGridView1.GetCellDisplayRectangle(ncol, nrow, true).Top + dataGridView1.Top;
                //buthelp.Left = dataGridView1.GetCellDisplayRectangle(ncol, nrow, true).Left + dataGridView1.Left + dataGridView1.GetCellDisplayRectangle(ncol, nrow, true).Width - buthelp.Width;

                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();
                    txtYs.Focus();
                    e.Handled = true;
                }
            }
            else
            {
                SendKeys.Send("{TAB}");
                e.Handled = true;
            }
        }
Example #4
0
        private void txtHtdw_KeyPress(object sender, KeyPressEventArgs e)
        {
            Control control = (Control)sender;

            if ((int)e.KeyChar == 8)
            {
                txthtdw.Tag  = "0";
                txthtdw.Text = "";
                return;
            }
            if ((int)e.KeyChar != 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 TrasenFrame.Forms.FrmSelectCard(searchfields, headtext, mappingname, colwidth);
                f.sourceDataTable = InstanceForm.BDatabase.GetDataTable("select * from jc_htdw");
                f.WorkForm        = this;
                f.srcControl      = txthtdw;
                f.Font            = txthtdw.Font;
                f.Width           = 400;
                f.ReciveString    = e.KeyChar.ToString();
                if (f.ShowDialog() == DialogResult.Cancel)
                {
                    txthtdw.Focus();
                    e.Handled = true;
                }
                else
                {
                    txthtdw.Tag  = Convert.ToInt32(f.SelectDataRow["id"]);
                    txthtdw.Text = f.SelectDataRow["dwmc"].ToString().Trim();

                    e.Handled = true;


                    //txtYs.Tag = Convert.ToInt32(f.SelectDataRow["employee_id"]);
                    //txtYs.Text = f.SelectDataRow["name"].ToString().Trim();
                    //txtYs.Focus();
                    //e.Handled = true;
                }
            }
            else
            {
                SendKeys.Send("{TAB}");
                e.Handled = true;
            }
        }
Example #5
0
        private void txtYs_KeyPress(object sender, KeyPressEventArgs e)
        {
            Control control = (Control)sender;

            if ((int)e.KeyChar == 8)
            {
                txtYs.Tag  = "0";
                txtYs.Text = "";
                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 TrasenFrame.Forms.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();
                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();
                    txtYs.Focus();
                    e.Handled = true;
                }
            }
            else
            {
                SendKeys.Send("{TAB}");
                e.Handled = true;
            }
        }
Example #6
0
        private void txtHsitem_KeyPress(object sender, KeyPressEventArgs e)
        {
            Control control = (Control)sender;

            if ((int)e.KeyChar != 13)
            {
                string[] headText     = new string[] { "编码", "名称", "拼音码", "五笔码" };
                string[] mappName     = new string[] { "ITEM_ID", "ITEM_NAME", "py_code", "wb_code" };
                int[]    colWidth     = new int[] { 60, 90, 75, 75, 75 };
                string[] searchFields = new string[] { "py_code", "wb_code" };
                TrasenFrame.Forms.FrmSelectCard selectCard = new TrasenFrame.Forms.FrmSelectCard(searchFields, headText, mappName, colWidth);
                selectCard.sourceDataTable = InstanceForm.BDatabase.GetDataTable("select ITEM_ID,ITEM_NAME,py_code,wb_code from JC_HSITEM where DELETE_BIT=0 order by ITEM_ID");
                selectCard.ReciveString    = e.KeyChar.ToString();
                e.Handled             = true;
                selectCard.Width      = 300;
                selectCard.srcControl = txtHsitem;
                selectCard.WorkForm   = this;
                selectCard.ShowDialog();
                if (selectCard.DialogResult == DialogResult.OK)
                {
                    this.txtHsitem.Text = selectCard.SelectDataRow["ITEM_NAME"].ToString().Trim();
                    this.txtHsitem.Tag  = selectCard.SelectDataRow["ITEM_ID"].ToString().Trim();
                }
                if (mod == 1)
                {
                    if (MessageBox.Show("您确定要修改这条记录?", "修改提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
                    {
                        toolbtnSav_Click(null, null);
                    }
                }
                else
                {
                    if (MessageBox.Show("您确定要添加这条记录?", "保存提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
                    {
                        toolbtnSav_Click(null, null);
                    }
                }
            }
        }
Example #7
0
        private void txtSerch_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (_dtSrc == null || _dtSrc.Rows.Count <= 0)
            {
                return;
            }

            int     nkey    = (int)e.KeyChar;
            Control control = (Control)sender;

            //if ((nkey >= 65 && nkey <= 90) || (nkey >= 48 && nkey <= 57) || (nkey >= 96 && nkey <= 105) || nkey == 8 || nkey == 32 || nkey == 46 || (nkey == 13 && (Convert.ToString(control.Tag) == "0" || Convert.ToString(control.Tag) == ""))) { }
            //else { return; }


            if (nkey == 8 || nkey == 46)
            {
                control.Text = ""; control.Tag = ""; return;
            }

            try
            {
                TrasenFrame.Forms.FrmSelectCard f2 = new TrasenFrame.Forms.FrmSelectCard(_searchfields, _headtext, _mappingname, _colwidth);

                f2.sourceDataTable = _dtSrc;

                f2.srcControl   = control;
                f2.Font         = control.Font;
                f2.Width        = 700;
                f2.Height       = 300;
                f2.ReciveString = e.KeyChar.ToString();
                e.Handled       = true;
                if (f2.ShowDialog() == DialogResult.Cancel)
                {
                    control.Focus();
                    return;
                }
                else
                {
                    //control.Text = row["ypspm"].ToString();
                    //control.Tag = row["cjid"].ToString();
                    _row = f2.SelectDataRow;

                    if (_row != null)
                    {
                        //string swhere = "1=1 ";
                        //swhere += chkBed.Checked ? "and 床号='" + txtMxBed.Text.Trim() + "'" : "";
                        //swhere += chkZyh.Checked ? "and 住院号='" + txtMxZyh.Text.Trim() + "'" : "";
                        //swhere += chkName.Checked ? "and 姓名='" + txtMxName.Text.Trim() + "'" : "";

                        //dt.DefaultView.RowFilter = swhere;
                        try
                        {
                            MyDelEvent();
                            txtSerch.Focus();
                            txtSerch.SelectAll();
                        }
                        catch { }
                    }
                }
            }
            catch (System.Exception err)
            {
                MessageBox.Show("发生错误" + err.Message);
            }
        }
Example #8
0
        private void txtDept_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                Control control = (Control)sender;
                int     nkey    = (int)e.KeyChar;
                if (nkey == 8 || nkey == 46)
                {
                    control.Text = ""; control.Tag = ""; return;
                }
                if (nkey == 13)
                {
                    if (string.IsNullOrEmpty(control.Text.Trim()))
                    {
                        control.Text = "";
                        control.Tag  = "";

                        dataGridView1.DataSource = null;
                        dataGridView2.DataSource = null;

                        return;
                    }
                    else
                    {
                        DoQuery();
                    }
                }
                if ((int)e.KeyChar != 13)
                {
                    string[] headtext     = new string[] { "科室", "拼音码", "五笔码" };
                    string[] mappingname  = new string[] { "name", "PY_CODE", "WB_CODE" };
                    string[] searchfields = new string[] { "name", "PY_CODE", "WB_CODE" };
                    int[]    colwidth     = new int[] { 150, 100, 100 };

                    TrasenFrame.Forms.FrmSelectCard f = new TrasenFrame.Forms.FrmSelectCard(searchfields, headtext, mappingname, colwidth);

                    f.sourceDataTable = _dtDept;

                    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["DEPT_ID"].ToString().Trim();
                        control.Text = f.SelectDataRow["name"].ToString().Trim();
                        txtDept.SelectAll();

                        if (string.IsNullOrEmpty(control.Text.Trim()))
                        {
                            control.Text = "";
                            control.Tag  = "";

                            dataGridView1.DataSource = null;
                            dataGridView2.DataSource = null;

                            return;
                        }
                        else
                        {
                            DoQuery();
                        }
                    }
                }
            }
            catch { }
        }