Exemplo n.º 1
0
        private void ValidateDataComplete()
        {
            bool okEnabled = true;

            if (String.IsNullOrEmpty(tourTitleTextbox.Text) || tourTitleTextbox.Text == Language.GetLocalizedText(485, "Please enter a title for the tour..."))
            {
                okEnabled = false;
                tourTitleTextbox.BackColor = highlightNeeded ? Color.Red : OrganizationName.BackColor;
            }
            else
            {
                tourTitleTextbox.BackColor = OrganizationName.BackColor;
            }

            // if (string.IsNullOrEmpty(authorEmailText.Text) || UiTools.IsEmail(authorEmailText.Text))
            if (Strict && !UiTools.IsEmail(authorEmailText.Text))
            {
                okEnabled = false;
                authorEmailText.BackColor = highlightNeeded ? Color.Red : OrganizationName.BackColor;
            }
            else
            {
                authorEmailText.BackColor = OrganizationName.BackColor;
            }

            //todo validate URLS's

            if (Strict && string.IsNullOrEmpty(this.authorNameTextbox.Text))
            {
                okEnabled = false;
                this.authorNameTextbox.BackColor = highlightNeeded ? Color.Red : OrganizationName.BackColor;
            }
            else
            {
                this.authorNameTextbox.BackColor = OrganizationName.BackColor;
            }

            if (Strict && string.IsNullOrEmpty(this.tourDescriptionTextbox.Text))
            {
                okEnabled = false;
                this.tourDescriptionTextbox.BackColor = highlightNeeded ? Color.Red : OrganizationName.BackColor;
            }
            else
            {
                this.tourDescriptionTextbox.BackColor = OrganizationName.BackColor;
            }

            if (authorImageNeeded && authorImagePicturebox.Image == null)
            {
                okEnabled = false;
                authorImagePicturebox.BackColor = highlightNeeded ? Color.Red : OrganizationName.BackColor;
            }
            else
            {
                authorImagePicturebox.BackColor = OrganizationName.BackColor;
            }

            OK.Enabled = okEnabled;
        }