public override void LoadControl() { OfficeCount = 0; var table = Elections.GetWinnersData(Page.GetElectionKey()); var incumbentsToEliminate = ElectionsOffices.GetOfficesWithCandidatesToEliminate(Page.GetElectionKey()); if (table.Rows.Count == 0) { Page.IdentifyWinnersMessage.RemoveCssClass("hidden"); Page.IdentifyWinnersInstructions.RemoveCssClass("hidden"); Page.IdentifyWinnersControl.AddCssClasses("hidden"); Page.IdentifyWinnersMessage.InnerHtml = "No offices were found for this election"; } else if (incumbentsToEliminate.Count > 0) { Page.IdentifyWinnersMessage.RemoveCssClass("hidden"); Page.IdentifyWinnersInstructions.AddCssClasses("hidden"); Page.IdentifyWinnersControl.AddCssClasses("hidden"); Page.IdentifyWinnersMessage.InnerHtml = "<em>There are too many incumbents for the following offices:</em><br/><br/>" + Join("<br/>", incumbentsToEliminate.Select(g => Offices.FormatOfficeName(g.First()))) + "<br/><br/><em>Please use the </em>Adjust Incumbents<em> tab to remove the extra incumbents or use the </em>Add/Remove Offices<em> tab to remove the office contest.</em>"; } else { Page.IdentifyWinnersMessage.AddCssClasses("hidden"); Page.IdentifyWinnersInstructions.RemoveCssClass("hidden"); Page.IdentifyWinnersControl.RemoveCssClass("hidden"); OfficeCount = Page.PopulateWinnersTree(table, Page.PlaceHolderIdentifyWinnersTree); } }
public override void LoadControl() { var incumbentsToEliminate = ElectionsOffices.GetOfficesWithCandidatesToEliminate(Page.GetElectionKey()); OfficeCount = incumbentsToEliminate.Count; Page.ControlAdjustIncumbentsListValue.Value = string.Empty; if (OfficeCount == 0) { Page.AdjustIncumbentsMessage.RemoveCssClass("hidden"); Page.AdjustIncumbentsControl.AddCssClasses("hidden"); Page.AdjustIncumbentsMessage.InnerHtml = "No offices that require incumbents to be removed were found for this election"; } else { Page.AdjustIncumbentsMessage.AddCssClasses("hidden"); Page.AdjustIncumbentsControl.RemoveCssClass("hidden"); PopulateIncumbentsToAdjustList(incumbentsToEliminate, Page.PlaceHolderAdjustIncumbentsList); } }