Exemple #1
0
 /// <summary>
 /// Deserializes workflow markup into an TEventoInfEventoDetEvento object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output TEventoInfEventoDetEvento object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out TEventoInfEventoDetEvento obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(TEventoInfEventoDetEvento);
     try
     {
         obj = Deserialize(xml);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
Exemple #2
0
 public static bool LoadFromFile(string fileName, out TEventoInfEventoDetEvento obj)
 {
     System.Exception exception = null;
     return(LoadFromFile(fileName, out obj, out exception));
 }
Exemple #3
0
 public static bool LoadFromFile(string fileName, out TEventoInfEventoDetEvento obj, out System.Exception exception)
 {
     return(LoadFromFile(fileName, Encoding.UTF8, out obj, out exception));
 }
Exemple #4
0
 /// <summary>
 /// Deserializes xml markup from file into an TEventoInfEventoDetEvento object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TEventoInfEventoDetEvento object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, System.Text.Encoding encoding, out TEventoInfEventoDetEvento obj, out System.Exception exception)
 {
     exception = null;
     obj       = default(TEventoInfEventoDetEvento);
     try
     {
         obj = LoadFromFile(fileName, encoding);
         return(true);
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return(false);
     }
 }
Exemple #5
0
 public static bool Deserialize(string xml, out TEventoInfEventoDetEvento obj)
 {
     System.Exception exception = null;
     return(Deserialize(xml, out obj, out exception));
 }
 public static bool LoadFromFile(string fileName, out TEventoInfEventoDetEvento obj)
 {
     System.Exception exception = null;
     return LoadFromFile(fileName, out obj, out exception);
 }
 public static bool LoadFromFile(string fileName, out TEventoInfEventoDetEvento obj, out System.Exception exception)
 {
     return LoadFromFile(fileName, Encoding.UTF8, out obj, out exception);
 }
 /// <summary>
 /// Deserializes xml markup from file into an TEventoInfEventoDetEvento object
 /// </summary>
 /// <param name="fileName">string xml file to load and deserialize</param>
 /// <param name="obj">Output TEventoInfEventoDetEvento object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool LoadFromFile(string fileName, System.Text.Encoding encoding, out TEventoInfEventoDetEvento obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TEventoInfEventoDetEvento);
     try
     {
         obj = LoadFromFile(fileName, encoding);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
 public static bool Deserialize(string xml, out TEventoInfEventoDetEvento obj)
 {
     System.Exception exception = null;
     return Deserialize(xml, out obj, out exception);
 }
 /// <summary>
 /// Deserializes workflow markup into an TEventoInfEventoDetEvento object
 /// </summary>
 /// <param name="xml">string workflow markup to deserialize</param>
 /// <param name="obj">Output TEventoInfEventoDetEvento object</param>
 /// <param name="exception">output Exception value if deserialize failed</param>
 /// <returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
 public static bool Deserialize(string xml, out TEventoInfEventoDetEvento obj, out System.Exception exception)
 {
     exception = null;
     obj = default(TEventoInfEventoDetEvento);
     try
     {
         obj = Deserialize(xml);
         return true;
     }
     catch (System.Exception ex)
     {
         exception = ex;
         return false;
     }
 }
Exemple #11
0
        public CartaCorrecao.TRetEnvEvento CartaCorrecao(TNfeProc nota, string Correcao, X509Certificate2 pCertificado, int numLote, int nSequencia, TAmb ambiente, out ACBr.Net.NFe.CartaCorrecao.TProcEvento procEvento)
        {
            string arqPedCorecao = _PastaLog + nota.NFe.infNFe.Id.Substring(3) + "-ped-evento.xml";//-ped-cce.xml ???
            string retPedCorrecao = _PastaLog + nota.NFe.infNFe.Id.Substring(3) + "-eve.xml";
            C_WebService.ListaUrl listaURL = default(C_WebService.ListaUrl);
            listaURL = WsUrls.BuscaURL(nota.NFe.infNFe.ide.cUF, ambiente);

            #region evento
            CartaCorrecao.TEvento evento = new CartaCorrecao.TEvento();
            evento.versao = "1.00";

            #region infEvento
            CartaCorrecao.TEventoInfEvento infEvento = new CartaCorrecao.TEventoInfEvento();
            infEvento.tpAmb = ambiente;
            infEvento.chNFe = nota.NFe.infNFe.Id.Substring(3);
            infEvento.cOrgao = PegarCodigoOrgaoUF(nota.NFe.infNFe.ide.cUF);
            infEvento.dhEvento = DateTime.Now.ToString("yyyy-MM-ddTHH:mm:sszzzz");
            infEvento.Id = "ID" + "110110" + nota.NFe.infNFe.Id.Substring(3) + nSequencia.ToString("D2");
            infEvento.ItemElementName = ACBr.Net.NFe.CartaCorrecao.ItemChoiceTypeCC.CNPJ;
            infEvento.Item = nota.NFe.infNFe.emit.Item;
            infEvento.nSeqEvento = nSequencia.ToString();
            infEvento.verEvento = ACBr.Net.NFe.CartaCorrecao.TEventoInfEventoVerEvento.Item100;
            infEvento.tpEvento = ACBr.Net.NFe.CartaCorrecao.TEventoInfEventoTpEvento.Item110110;

            #region detEvento
            CartaCorrecao.TEventoInfEventoDetEvento detEvento = new CartaCorrecao.TEventoInfEventoDetEvento();
            detEvento.descEvento = ACBr.Net.NFe.CartaCorrecao.TEventoInfEventoDetEventoDescEvento.CartadeCorrecao;
            detEvento.versao = ACBr.Net.NFe.CartaCorrecao.TEventoInfEventoDetEventoVersao.Item100;
            detEvento.xCondUso = ACBr.Net.NFe.CartaCorrecao.TEventoInfEventoDetEventoXCondUso.ACartadeCorrecaoedisciplinadapeloparagrafo1oAdoart7odoConvenioSNde15dedezembrode1970epodeserutilizadapararegularizacaodeerroocorridonaemissaodedocumentofiscaldesdequeoerronaoestejarelacionadocomIasvariaveisquedeterminamovalordoimpostotaiscomobasedecalculoaliquotadiferencadeprecoquantidadevalordaoperacaooudaprestacaoIIacorrecaodedadoscadastraisqueimpliquemudancadoremetenteoudodestinatarioIIIadatadeemissaooudesaida;
            detEvento.xCorrecao = Correcao;
            #endregion detEvento

            infEvento.detEvento = detEvento;
            #endregion infEvento

            evento.infEvento = infEvento;

            XmlDocument xmldoc = new XmlDocument();
            xmldoc.LoadXml(Funcoes.RemoveNameSpaceFromXml(evento.Serialize()));
            xmldoc = CertificadoDigital.Assinar(xmldoc, "infEvento", pCertificado);
            xmldoc.Save(arqPedCorecao);

            #endregion evento

            dynamic envEvento = GeraLoteEvento(arqPedCorecao, numLote);

            try
            {
                RecepcaoEvento.nfeCabecMsg cab = new RecepcaoEvento.nfeCabecMsg();
                RecepcaoEvento.RecepcaoEvento wsMsg = default(RecepcaoEvento.RecepcaoEvento);

                // UF E VERSÃO DO CABEÇALHO
                cab.cUF = PegarCodigoUF(nota.NFe.infNFe.ide.cUF);
                cab.versaoDados = "1.00";

                //CABEÇALHO USADA PARA ENVIO DE LOTE
                wsMsg = new RecepcaoEvento.RecepcaoEvento(listaURL.UrlRecepcaoEvento);
                wsMsg.nfeCabecMsgValue = cab;
                wsMsg.Timeout = 100000;
                wsMsg.ClientCertificates.Add(pCertificado);
                wsMsg.SoapVersion = SoapProtocolVersion.Soap12;

                //RETORNO DA SEFAZ
                XmlElement strRetorno = wsMsg.nfeRecepcaoEvento(envEvento);
                XmlDocument xmlRetorno = new XmlDocument();
                xmlRetorno.LoadXml(strRetorno.OuterXml);
                xmlRetorno.Save(retPedCorrecao);

                ACBr.Net.NFe.CartaCorrecao.TRetEnvEvento retCorrecaoNFe = ACBr.Net.NFe.CartaCorrecao.TRetEnvEvento.LoadFromFile(retPedCorrecao);

                //saída
                procEvento = new CartaCorrecao.TProcEvento();
                procEvento.evento = ACBr.Net.NFe.CartaCorrecao.TEvento.Deserialize(xmldoc.OuterXml);
                procEvento.retEvento = retCorrecaoNFe.retEvento[0];
                procEvento.versao = "1.00";

                return retCorrecaoNFe;
            }
            catch (Exception ex)
            {
                throw new System.InvalidOperationException("Erro ao corrigir NFe. Erro: " + ex.Message);
            }
        }