Example #1
0
        private void  ValidateCruiseName()
        {
            errorProvider1.SetError(CruiseName, null);
            if (CruiseName.Text == null)
            {
                CruiseName.Text = "";
            }
            CruiseName.Text = CruiseName.Text.Trim();
            String cruiseNameErrorDesc = PicesSipperCruise.ValidateCruiseName(CruiseName.Text);

            if (cruiseNameErrorDesc != null)
            {
                errorProvider1.SetError(CruiseName, cruiseNameErrorDesc);
                validationErrorsFound = true;
                return;
            }

            if (CruiseName.Text.CompareTo(cruise.CruiseName) != 0)
            {
                PicesSipperCruise existingCruise = DbConn().SipperCruiseLoad(CruiseName.Text);
                if (existingCruise != null)
                {
                    errorProvider1.SetError(CruiseName, "Cruise Name[" + CruiseName.Text + "] is already in use.");
                    validationErrorsFound = true;
                    return;
                }
            }

            return;
        } /* ValidateCruiseName */