public belEncerramentoMDFe(PesquisaManifestosModel objPesquisa, string cUF, string cMun) { this.objPesquisa = objPesquisa; XNamespace pf = "http://www.portalfiscal.inf.br/mdfe"; XContainer envCTe = new XElement(pf + "evEncMDFe", new XElement(pf + "descEvento", "Encerramento"), new XElement(pf + "nProt", objPesquisa.protocolo), new XElement(pf + "dtEnc", daoUtil.GetDateServidor().ToString("yyyy-MM-dd")), new XElement(pf + "cUF", cUF), new XElement(pf + "cMun", cMun.Trim())); XmlDocument xmlCanc = new XmlDocument(); xmlCanc.LoadXml(envCTe.ToString()); string sPath = Pastas.PROTOCOLOS + objPesquisa.protocolo + "evEnc.xml"; if (File.Exists(sPath)) File.Delete(sPath); xmlCanc.Save(sPath); try { belValidaXml.ValidarXml("http://www.portalfiscal.inf.br/mdfe", Pastas.SCHEMA_MDFe + "\\evEncMDFe_v1.00.xsd", sPath); } catch (Exception ex) { throw ex; } objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110112"); // Encerramento(); }
public belEncerramentoMDFe(PesquisaManifestosModel objPesquisa, string cUF, string cMun) { this.objPesquisa = objPesquisa; XNamespace pf = "http://www.portalfiscal.inf.br/mdfe"; XContainer envCTe = new XElement(pf + "evEncMDFe", new XElement(pf + "descEvento", "Encerramento"), new XElement(pf + "nProt", objPesquisa.protocolo), new XElement(pf + "dtEnc", daoUtil.GetDateServidor().ToString("yyyy-MM-dd")), new XElement(pf + "cUF", cUF), new XElement(pf + "cMun", cMun.Trim())); XmlDocument xmlCanc = new XmlDocument(); xmlCanc.LoadXml(envCTe.ToString()); string sPath = Pastas.PROTOCOLOS + objPesquisa.protocolo + "evEnc.xml"; if (File.Exists(sPath)) { File.Delete(sPath); } xmlCanc.Save(sPath); try { belValidaXml.ValidarXml("http://www.portalfiscal.inf.br/mdfe", Pastas.SCHEMA_MDFe + "\\evEncMDFe_v1.00.xsd", sPath); } catch (Exception ex) { throw ex; } objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110112"); // Encerramento(); }
public belCancelamentoMDFe(PesquisaManifestosModel objPesquisa, string xJust) { this.xJust = xJust; this.objPesquisa = objPesquisa; XNamespace pf = "http://www.portalfiscal.inf.br/mdfe"; XContainer envCTe = new XElement(pf + "evCancMDFe", new XElement(pf + "descEvento", "Cancelamento"), new XElement(pf + "nProt", objPesquisa.protocolo), new XElement(pf + "xJust", xJust.Trim())); XmlDocument xmlCanc = new XmlDocument(); xmlCanc.LoadXml(envCTe.ToString()); objEvento = new belEventoMDFe(xmlCanc.DocumentElement, objPesquisa, "110111"); // ExecuteCancelamento(); }