Пример #1
0
        private bool IsValid()
        {
            bool result = true;

            errorProvider.SetError(txtStaffNumber, string.Empty);

            #region Staff Number 唔可以吉
            errorProvider.SetError(txtStaffNumber, string.Empty);
            if (txtStaffNumber.Text.Trim() == string.Empty)
            {
                errorProvider.SetError(txtStaffNumber, "Cannot be blank!");
                return(false);
            }
            #endregion

            #region 新增,要 check Staff Number 係咪 in use
            if (_EditMode == EnumHelper.EditMode.Add && txtStaffNumber.Text.Trim() != string.Empty)
            {
                if (StaffEx.IsStaffNumberInUse(txtStaffNumber.Text.Trim()))
                {
                    errorProvider.SetError(txtStaffNumber, "Staff Number in use");
                    return(false);
                }
            }
            #endregion

            return(result);
        }