示例#1
0
        private void txtCMT_Validating(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (!CheckTextBoxNullValue.ValidationTextEditNullValue(txtCMT))
            {
                CheckTextBoxNullValue.ShowError(dxErrorProvider1, txtCMT, toolTipController1, "Vui lòng nhập vào 'Số chứng minh thư' của ứng viên!");
            }
            else
            {
                string value = txtCMT.Text;
                if (value.Length < 9 || value.Length > 10)
                {
                    CheckTextBoxNullValue.ShowError(dxErrorProvider1, txtCMT, toolTipController1, "'Số chứng minh thư' không đúng định dạng. Vui lòng nhập lại!");
                }

                var result = _resultService.GetResultByCMT(value);
                if (result != null)
                {
                    CheckTextBoxNullValue.ShowError(dxErrorProvider1, txtCMT, toolTipController1, $"'Số chứng minh thư' đã tồn tại '{result.FullName}-{result.CMT}'. Vui lòng kiểm tra lại!");
                }
            }
        }