public static ArrayList CarregaMunicipios()
{
ArrayList UF = new ArrayList();
Propriedade.Municipios.ForEach((mun) => { UF.Add(new ComboElem(mun.UF, mun.CodigoMunicipio, mun.Nome)); });
if (File.Exists(Propriedade.NomeArqXMLWebService_NFSe))
{
//Carregar os dados do arquivo XML de configurações da Aplicação
XElement axml = XElement.Load(Propriedade.NomeArqXMLWebService_NFSe);
var s = (from p in axml.Descendants(NFe.Components.NFeStrConstants.Estado)
where (string)p.Attribute(TpcnResources.UF.ToString()) != "XX"
select p);
foreach (var item in s)
{
if (Convert.ToInt32("0" + OnlyNumbers(item.Attribute(TpcnResources.ID.ToString()).Value)) == 0)
continue;
var temp = Propriedade.Municipios.FirstOrDefault(x => x.CodigoMunicipio == Convert.ToInt32(item.Attribute(TpcnResources.ID.ToString()).Value));
if (temp == null)
{
UF.Add(new ComboElem(item.Attribute(TpcnResources.UF.ToString()).Value,
Convert.ToInt32(item.Attribute(NFe.Components.TpcnResources.ID.ToString()).Value),
item.Element(NFe.Components.NFeStrConstants.Nome).Value));
}
}
}
UF.Sort(new OrdenacaoPorNome());
return UF;
}