/// <summary>Initializes the ApplicantInfoSection control, and hides the EmailFriendSection control.</summary> /// <param name="setInitialInfo">if set to <c>true</c> show user info in the user text boxes; otherwise, leave them alone.</param> private void InitializeApplicantInfoSection(bool setInitialInfo = false) { this.ApplicantInfoSection.Visible = true; this.EmailFriendSection.Visible = false; this.BasePage.ScrollToControl(this.ApplicantInfoSection); this.FillLeadDropDown(); var fileExtensionsList = Host.AllowedExtensionWhitelist; var fileExtensionValidationExpression = BuildFileExtensionValidationExpression(fileExtensionsList); this.ResumeFileExtensionValidator.ValidationExpression = this.CoverLetterFileExtensionValidator.ValidationExpression = fileExtensionValidationExpression; this.ResumeFileExtensionValidator.ErrorMessage = string.Format(CultureInfo.CurrentCulture, this.Localize("regexResumeFile.Text"), fileExtensionsList.ToDisplayString()); this.CoverLetterFileExtensionValidator.ErrorMessage = string.Format(CultureInfo.CurrentCulture, this.Localize("regexCoverLetterFile.Text"), fileExtensionsList.ToDisplayString()); SetFieldVisibility(this.ApplicantNameRow, this.ApplicantNameRequiredValidator, this.ApplicantNameRequiredLabel, this.DisplayName); SetFieldVisibility(this.ApplicantEmailRow, this.ApplicantEmailRequiredValidator, this.ApplicantEmailRequiredLabel, this.DisplayEmail); SetFieldVisibility(this.ApplicantPhoneRow, this.ApplicantPhoneRequiredValidator, this.ApplicantPhoneRequiredLabel, this.DisplayPhone); SetFieldVisibility(this.ApplicationMessageRow, this.ApplicationMessageRequiredValidator, this.MessageRequiredLabel, this.DisplayMessage); SetFieldVisibility(this.SalaryRow, this.SalaryRequiredFieldValidator, this.SalaryRequiredLabel, this.DisplaySalaryRequirement); this.SalaryMessageRow.Visible = this.DisplaySalaryRequirement == Visibility.Optional; this.ApplicantEmailRegexValidator.ValidationExpression = Engage.Utility.EmailRegEx; var alreadyHasCoverLetter = this.JobApplication != null && this.JobApplication.GetDocuments().Any(d => d.DocumentTypeId == DocumentType.CoverLetter.GetId()); var coverLetterVisibility = this.DisplayCoverLetter == Visibility.Required && alreadyHasCoverLetter ? Visibility.Optional : this.DisplayCoverLetter; SetFieldVisibility(this.CoverLetterRow, this.CoverLetterFileRequiredValidator, this.CoverLetterRequiredLabel, coverLetterVisibility); var alreadyHasResume = this.UserId != -1 && JobApplication.GetResumeId(this.UserId) != null; var resumeVisibility = this.DisplayResume == Visibility.Required && alreadyHasResume ? Visibility.Optional : this.DisplayResume; SetFieldVisibility(this.ResumeRow, this.ResumeFileRequiredValidator, this.ResumeRequiredLabel, resumeVisibility); this.ResumeMessageRow.Visible = alreadyHasResume; if (setInitialInfo) { this.ApplicantNameTextBox.Text = this.UserInfo.DisplayName; this.ApplicantEmailTextBox.Text = this.UserInfo.Email; this.ApplicantPhoneTextBox.Text = this.UserInfo.Profile.Telephone; } }