示例#1
0
        // does Validation on VendorID Search TextBox
        private Boolean inputIsValid()
        {
            string errText = this.txtVendorIDSearch.Text;

            if (Validation.IsBlank(this.txtVendorIDSearch.Text) ||
                Validation.IsNullOrEmpty(this.txtVendorIDSearch.Text))
            {
                MessageBox.Show("There must be an Id to search for.");
                this.txtVendorIDSearch.Focus();
                this.txtVendorIDSearch.Clear();
                return(false);
            }
            else if (!Validation.IsInt(this.txtVendorIDSearch.Text))
            {
                MessageBox.Show("'" + errText + "'" + " is not a valid Vendor ID. " +
                                "\nId must be a numeric value.");
                this.txtVendorIDSearch.Focus();
                this.txtVendorIDSearch.Clear();
                return(false);
            }

            int venID = Convert.ToInt32(txtVendorIDSearch.Text);
            int maxID = _myVendorManager.GetMaxVendorID();

            if (!Validation.IsIntRange(1, maxID, venID))
            {
                MessageBox.Show("'" + errText + "'" + " is not a valid Vendor ID. " +
                                "\nId must be greater than 0 but less than " + maxID);
                this.txtVendorIDSearch.Focus();
                this.txtVendorIDSearch.Clear();
                return(false);
            }

            return(true);
        }