示例#1
0
        public MDFeRetEnviMDFe MDFeRecepcao(long lote, MDFeEletronico mdfe)
        {
            var enviMDFe = ClassesFactory.CriaEnviMDFe(lote, mdfe);

            switch (MDFeConfiguracao.VersaoWebService.VersaoLayout)
            {
            case VersaoServico.Versao100:
                mdfe.InfMDFe.InfModal.VersaoModal = MDFeVersaoModal.Versao100;
                mdfe.InfMDFe.Ide.ProxyDhIniViagem = mdfe.InfMDFe.Ide.DhIniViagem.ParaDataHoraStringSemUtc();
                break;

            case VersaoServico.Versao300:
                mdfe.InfMDFe.InfModal.VersaoModal = MDFeVersaoModal.Versao300;
                mdfe.InfMDFe.Ide.ProxyDhIniViagem = mdfe.InfMDFe.Ide.DhIniViagem.ParaDataHoraStringUtc();
                break;
            }

            enviMDFe.MDFe.Assina(GerouChave, this);
            enviMDFe.Valida();
            enviMDFe.SalvarXmlEmDisco();

            var webService = WsdlFactory.CriaWsdlMDFeRecepcao();

            OnAntesDeEnviar(enviMDFe);

            var retornoXml = webService.mdfeRecepcaoLote(enviMDFe.CriaXmlRequestWs());

            var retorno = MDFeRetEnviMDFe.LoadXml(retornoXml.OuterXml, enviMDFe);

            retorno.SalvarXmlEmDisco();

            return(retorno);
        }
        public MDFeRetEnviMDFe MDFeRecepcao(long lote, MDFeEletronico mdfe)
        {
            var enviMDFe = ClassesFactory.CriaEnviMDFe(lote, mdfe);

            enviMDFe.MDFe.Assina();
            enviMDFe.Valida();
            enviMDFe.SalvarXmlEmDisco();

            var webService = WsdlFactory.CriaWsdlMDFeRecepcao();
            var retornoXml = webService.mdfeRecepcaoLote(enviMDFe.CriaXmlRequestWs());

            var retorno = MDFeRetEnviMDFe.LoadXml(retornoXml.OuterXml, enviMDFe);

            retorno.SalvarXmlEmDisco();

            return(retorno);
        }