private void comboBoxEmp_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyData != Keys.Enter && e.KeyData != Keys.Up && e.KeyData != Keys.Down && e.KeyData != Keys.PageUp &&
         e.KeyData != Keys.PageDown)
     {
         textEmp.Select();
     }
 }
예제 #2
0
        private void ParseEmployee(bool skip)
        {
            string txt    = textEmp.Text.Trim();
            string regTxt = txt;

            DataRow[] emps = parser.Parse(ref txt);
            if (emps.Length == 1)
            {
                if (textEmp.Text != txt)
                {
                    textEmp.Text = txt;
                    regTxt       = "^(?<text>" + regTxt + ").*$";

                    Match m = Regex.Match(txt, regTxt.Replace("-", " "), RegexOptions.IgnoreCase);
                    if (m.Success)
                    {
                        int len = m.Groups["text"].Value.Length;
                        textEmp.Select(len, textEmp.Text.Length - len);
                    }
                }
                if (findEmployeeID != (int)emps[0]["КодСотрудника"])
                {
                    findEmployeeID = (int)emps[0]["КодСотрудника"];
                    OnFindEmployee(findEmployeeID);
                }
            }
            else
            {
                if ((emps.Length != 1) || (!textEmp.Text.Equals(emps[0]["Сотрудник"])))
                {
                    findEmployeeID = 0;
                    OnFindEmployee(findEmployeeID);
                }
                for (int i = 0; i < emps.Length; i++)
                {
                    textEmp.Text =
                        textEmp.Text.Replace(emps[i]["ФИО"].ToString(), "").Trim(new char[] { ' ', ',', ';' });
                }
            }

            if (!skip)
            {
                comboBoxEmp.DroppedDown = false;
            }
            if (parser.CandidateCount > 1 && parser.CandidateCount < 9)
            {
                ShowEmployees(parser.CandidateEmployees);
                var findForm = FindForm();
                if (findForm != null)
                {
                    findForm.Cursor = Cursors.Default;
                }
            }
        }
 public void Select(int start, int length)
 {
     txtView.Select(start, length);
 }