Exemplo n.º 1
0
 public static bool IsValid(string stateCode, string countyCode) =>
 CountyCache.CountyExists(stateCode, countyCode);
Exemplo n.º 2
0
        public static string GetElectoralClassShortDescription(string stateCode,
                                                               string countyCode = "", string localCode = "")
        {
            switch (GetElectoralClass(stateCode, countyCode, localCode))
            {
            case ElectoralClass.USPresident:
                return("US President");

            case ElectoralClass.USSenate:
                return("US Senate");

            case ElectoralClass.USHouse:
                return("US House");

            case ElectoralClass.USGovernors:
                return("Governors");

            case ElectoralClass.State:
                return(StateCache.IsValidStateCode(stateCode)
            ? StateCache.GetShortName(stateCode)
            : string.Empty);

            case ElectoralClass.County:
                if (countyCode == "000")
                {
                    return(GetElectoralClassShortDescription(stateCode) + " Counties");
                }
                if (CountyCache.CountyExists(stateCode, countyCode))
                {
                    if (stateCode != "DC")
                    {
                        return(CountyCache.GetCountyName(stateCode, countyCode) + ", " +
                               StateCache.GetShortName(stateCode));
                    }
                    else
                    {
                        return(StateCache.GetShortName(stateCode) + " Local");
                    }
                }
                return(string.Empty);

            case ElectoralClass.Local:
                if (countyCode == "000")
                {
                    return(GetElectoralClassShortDescription(stateCode, countyCode) +
                           " Locals");
                }
                var localName = VotePage.GetPageCache()
                                .LocalDistricts.GetLocalDistrict(stateCode, countyCode, localCode);
                if (!string.IsNullOrWhiteSpace(localName))
                {
                    return(localName + ", " +
                           CountyCache.GetCountyName(stateCode, countyCode) + ", " +
                           StateCache.GetShortName(stateCode));
                }
                return(string.Empty);

            default:
                return(string.Empty);
            }
        }
Exemplo n.º 3
0
 public static bool IsValid(string stateCode, string countyCode)
 {
     return(CountyCache.CountyExists(stateCode, countyCode));
 }