public static AddCandidatesTabItem[] GetTabInfo(ManagePoliticiansPanel control, FeedbackContainerControl feedback) { var addCandidatesTabInfo = new[] { new AddCandidatesTabItem(control) { Column = "CandidateList", Description = control.Mode == DataMode.ManageIncumbents ? "Incumbent List" : "Candidate List", Validator = ValidateIncumbents } }; foreach (var item in addCandidatesTabInfo) { item.InitializeItem(control, true, feedback); } // handled by outer page //InitializeGroup(control, GroupName); return(addCandidatesTabInfo); }
public static EditPoliticianDialogItem[] GetDialogInfo(ManagePoliticiansPanel control) { var editPoliticianInfo = new[] { new EditPoliticianDialogItem(control) { Column = "FName", Description = "First Name", Validator = ValidateFirstName }, new EditPoliticianDialogItem(control) { Column = "MName", Description = "Middle Name", Validator = ValidateMiddleName }, new EditPoliticianDialogItem(control) { Column = "Nickname", Description = "Nickname", Validator = ValidateNickname }, new EditPoliticianDialogItem(control) { Column = "LName", Description = "Last Name", Validator = ValidateLastName }, new EditPoliticianDialogItem(control) { Column = "Suffix", Description = "Suffix", Validator = ValidateSuffix }, new EditPoliticianDialogItem(control) { Column = "AddOn", Description = "ANC AddOn" }, new EditPoliticianDialogItem(control) { Column = "DateOfBirth", Description = "Date of Birth", Validator = ValidateDateOfBirthOptional }, new EditPoliticianDialogItem(control) { Column = "StateAddress", Description = "State Street Address", Validator = ValidateStreet }, new EditPoliticianDialogItem(control) { Column = "StateCityStateZip", Description = "State City, State Zip", Validator = ValidateCityStateZip }, new EditPoliticianDialogItem(control) { Column = "StatePhone", Description = "State Phone" }, new EditPoliticianDialogItem(control) { Column = "StateEmailAddr", Description = "State Email", Validator = ValidateEmail }, new EditPoliticianDialogItem(control) { Column = "StateWebAddr", Description = "State Web Site", Validator = ValidateWebAddress }, new EditPoliticianDialogItem(control) { Column = "Address", Description = "Candidate Street Address", Validator = ValidateStreet }, new EditPoliticianDialogItem(control) { Column = "CityStateZip", Description = "Candidate City, State Zip", Validator = ValidateCityStateZip }, new EditPoliticianDialogItem(control) { Column = "Phone", Description = "Candidate Phone" }, new EditPoliticianDialogItem(control) { Column = "EmailAddr", Description = "Candidate Email", Validator = ValidateEmail }, new EditPoliticianDialogItem(control) { Column = "WebAddr", Description = "Candidate Web Site", Validator = ValidateWebAddress }, new EditPoliticianDialogItem(control) { Column = "PartyKey", Description = "Political Party" } }; foreach (var item in editPoliticianInfo) { item.InitializeItem(control); } InitializeGroup(control, GroupName); return(editPoliticianInfo); }
private EditPoliticianDialogItem(ManagePoliticiansPanel thisControl) : base(GroupName) { ThisControl = thisControl; }
internal EditPoliticianIncumbentDialogItem(ManagePoliticiansPanel thisControl) : base(thisControl) { }
private AddCandidatesTabItem(ManagePoliticiansPanel thisControl) : base(GroupName) { _ThisControl = thisControl; }
public static SetupAdDialogItem[] GetDialogInfo(ManagePoliticiansPanel control) { var setupAdInfo = new [] { new SetupAdDialogItem(control) { Column = "AdType", Description = "Ad Type (YouTube or Image)", Validator = @base => { if (!ValidateRequired(@base)) { return(false); } var politicianKey = control.AdSetupCandidate.Value; if (IsNullOrWhiteSpace(Politicians.GetPublicWebAddress(politicianKey))) { var link = SecurePage.IsPoliticianUser ? SecurePoliticianPage.GetPoliticianFolderPageUrl("updateintro") : SecurePoliticianPage.GetUpdateIntroPageUrl(politicianKey); { control.FeedbackSetupAd.PostValidationError(@base.DataControl, "An Image ad needs a link to navigate to when clicked." + $" <a href=\"{link}\" target=\"intro\">Please enter a link for" + " your web site or an equivalent page</b>, like your" + " Facebook page.</a>"); return(false); } } return(true); } //Validator = ValidateRequired }, new SetupAdDialogItem(control) { Column = "AdUrl", Description = "Video or Channel URL", Validator = b => { // only required for type "Y" var adTypeItem = control._SetupAdDialogInfo.First(i => i.Column == "AdType"); return(adTypeItem.DataControl.GetValue() != "Y" || ValidateYouTubeAddressRequired(b)); } }, new SetupAdDialogItem(control) { Column = "AdThumbnailUrl", Description = "Video for Channel Thumbnail", Validator = ValidateYouTubeVideoAddressOptional }, new SetupAdDialogItem(control) { Column = "AdImageName", Description = "Name of Ad Image File" }, new SetupAdDialogItem(control) { Column = "AdImageChanged", ConvertFn = ToBool }, new SetupAdDialogItem(control) { Column = "AdImageUpdated", Description = "Ad Image", ConvertFn = ToBool }, new SetupAdDialogItem(control) { Column = "AdTimeStamp", Description = "Ad Date for Sorting", ConvertFn = ToDateTime, Validator = ValidateDateOptional }, new SetupAdDialogItem(control) { Column = "AdEnabled", Description = "Ad Enabled", ConvertFn = ToBool }, new SetupAdDialogItem(control) { Column = "AdSponsor", Description = "Ad Sponsor", Validator = @base => { // if there is a sponsor URL, there must be either an ad sponsor or the checkbox must be checked var sponsorUrlItem = control._SetupAdDialogInfo.First(i => i.Column == "AdSponsorUrl"); if (!IsNullOrWhiteSpace(sponsorUrlItem.DataControl.GetValue())) { var checkboxItem = control._SetupAdDialogInfo.First(i => i.Column == "AdIsCandidateSponsored"); if (IsNullOrWhiteSpace(@base.DataControl.GetValue()) && checkboxItem.DataControl.GetValue().Equals("false", StringComparison.OrdinalIgnoreCase)) { control.FeedbackSetupAd.PostValidationError(@base.DataControl, "Since you provided a Sponsor URL you need to either enter a" + " Ad Sponsor or check the 'Use candidate's campaigm as Ad Sponsor'" + " checkbox."); return(false); } } return(true); } }, new SetupAdDialogItem(control) { Column = "AdSponsorUrl", Description = "Ad Sponsor URL" }, new SetupAdDialogItem(control) { Column = "AdIsCandidateSponsored", Description = "Ad Is Candidate Sponsored", ConvertFn = ToBool } }; foreach (var item in setupAdInfo) { item.InitializeItem(control); } InitializeGroup(control, GroupName); return(setupAdInfo); }