NFe.Components.WebServiceNFSe.WebServicesHomologacao C# (CSharp) Method

WebServicesHomologacao() public static method

public static WebServicesHomologacao ( PadroesNFSe &padrao, int idMunicipio ) : string
padrao PadroesNFSe
idMunicipio int
return string
        public static string WebServicesHomologacao(ref PadroesNFSe padrao, int idMunicipio = 0)
        {
            return getURLs(NFe.Components.NFeStrConstants.LocalHomologacao, ref padrao, idMunicipio);

        }

Usage Example

Example #1
0
        /// <summary>
        /// Carrega a lista de webservices definidos no arquivo WebService.XML
        /// </summary>
        public static bool CarregaWebServicesList()
        {
            bool atualizaWSDL = false;

            if (webServicesList == null)
            {
                webServicesList        = new List <webServices>();
                Propriedade.Municipios = null;
                Propriedade.Municipios = new List <Municipio>();

                XmlDocument doc = new XmlDocument();
                /// danasa 1-2012
                if (File.Exists(Propriedade.NomeArqXMLMunicipios))
                {
                    doc.Load(Propriedade.NomeArqXMLMunicipios);
                    XmlNodeList estadoList = doc.GetElementsByTagName(NFe.Components.NFeStrConstants.Registro);
                    foreach (XmlNode registroNode in estadoList)
                    {
                        XmlElement registroElemento = (XmlElement)registroNode;
                        if (registroElemento.Attributes.Count > 0)
                        {
                            int    IDmunicipio = Convert.ToInt32("0" + Functions.OnlyNumbers(registroElemento.Attributes[TpcnResources.ID.ToString()].Value));
                            string Nome        = registroElemento.Attributes[NFeStrConstants.Nome].Value;
                            string Padrao      = registroElemento.Attributes[NFeStrConstants.Padrao].Value;
                            string UF          = Functions.CodigoParaUF(Convert.ToInt32(IDmunicipio.ToString().Substring(0, 2)));

                            ///
                            /// danasa 9-2013
                            /// verifica se o 'novo' padrao existe, nao existindo retorna para atualizar os wsdl's dele
                            string dirSchemas = Path.Combine(Propriedade.PastaExecutavel, "NFse\\schemas\\NFSe\\" + Padrao);
                            if (!Directory.Exists(dirSchemas))
                            {
                                atualizaWSDL = true;
                            }
                            PadroesNFSe pdr = WebServiceNFSe.GetPadraoFromString(Padrao);

                            string urlsH = WebServiceNFSe.WebServicesHomologacao(ref pdr, IDmunicipio);
                            string urlsP = WebServiceNFSe.WebServicesProducao(ref pdr, IDmunicipio);

                            if (!string.IsNullOrEmpty(urlsH) || !string.IsNullOrEmpty(urlsP))
                            {
                                var ci = (from i in webServicesList where i.ID == IDmunicipio select i).FirstOrDefault();
                                if (ci == null)
                                {
                                    webServices wsItem = new webServices(IDmunicipio, Nome, UF);

                                    PreencheURLw(wsItem.LocalHomologacao,
                                                 NFe.Components.NFeStrConstants.LocalHomologacao,
                                                 urlsH,
                                                 "",
                                                 "NFse\\");
                                    PreencheURLw(wsItem.LocalProducao,
                                                 NFe.Components.NFeStrConstants.LocalProducao,
                                                 urlsP,
                                                 "",
                                                 "NFse\\");
                                    webServicesList.Add(wsItem);
                                }
                            }
                            ///
                            /// adiciona na lista que serĂ¡ usada na manutencao
                            ///
                            Propriedade.Municipios.Add(new Municipio(IDmunicipio, UF, Nome, pdr));
                        }
                    }
                }
                /// danasa 1-2012

                bool salvaXmlLocal = false;
                LoadArqXMLWebService(Propriedade.NomeArqXMLWebService_NFe, "NFe\\");
                salvaXmlLocal = LoadArqXMLWebService(Propriedade.NomeArqXMLWebService_NFSe, "NFse\\");

                if (salvaXmlLocal)
                {
                    WebServiceNFSe.SalvarXMLMunicipios(null, null, 0, null, false);
                }
            }
            return(atualizaWSDL);
        }