public void populaTagdet(dsDanfe dsdanfe, XmlDocument xml, string CodinfNfeId) { XmlNodeList xNdDet = xml.GetElementsByTagName("det"); XmlNodeList xNdProd = xml.GetElementsByTagName("prod"); XmlNodeList xNdImposto = xml.GetElementsByTagName("imposto"); XmlNodeList xNdICMS = xml.GetElementsByTagName("ICMS"); XmlNodeList xNdICMS00 = xml.GetElementsByTagName("ICMS00"); XmlNodeList xNdICMS10 = xml.GetElementsByTagName("ICMS10"); XmlNodeList xNdICMS20 = xml.GetElementsByTagName("ICMS20"); XmlNodeList xNdICMS30 = xml.GetElementsByTagName("ICMS30"); XmlNodeList xNdICMS40 = xml.GetElementsByTagName("ICMS40"); XmlNodeList xNdICMS51 = xml.GetElementsByTagName("ICMS51"); XmlNodeList xNdICMS60 = xml.GetElementsByTagName("ICMS60"); XmlNodeList xNdICMS70 = xml.GetElementsByTagName("ICMS70"); XmlNodeList xNdICMS90 = xml.GetElementsByTagName("ICMS90"); XmlNodeList xNdICMSPart = xml.GetElementsByTagName("ICMSPart"); XmlNodeList xNdICMSST = xml.GetElementsByTagName("ICMSST"); XmlNodeList xNdICMSSN101 = xml.GetElementsByTagName("ICMSSN101"); XmlNodeList xNdICMSSN102 = xml.GetElementsByTagName("ICMSSN102"); XmlNodeList xNdICMSSN201 = xml.GetElementsByTagName("ICMSSN201"); XmlNodeList xNdICMSSN500 = xml.GetElementsByTagName("ICMSSN500"); XmlNodeList xNdICMSSN900 = xml.GetElementsByTagName("ICMSSN900"); XmlNodeList xNdIPI = xml.GetElementsByTagName("IPI"); XmlNodeList xNdIPItrib = xml.GetElementsByTagName("IPITrib"); XmlNodeList xNdIPInt = xml.GetElementsByTagName("IPINT"); XmlNodeList xndII = xml.GetElementsByTagName("II"); XmlNodeList xndPIS = xml.GetElementsByTagName("PIS"); XmlNodeList xndPISAliq = xml.GetElementsByTagName("PISAliq"); XmlNodeList xndPISQtde = xml.GetElementsByTagName("PISQtde"); XmlNodeList xndPISNT = xml.GetElementsByTagName("PISNT"); XmlNodeList xndPISOutr = xml.GetElementsByTagName("PISOutr"); XmlNodeList xndPISST = xml.GetElementsByTagName("PISST"); XmlNodeList xndCOFINS = xml.GetElementsByTagName("COFINS"); XmlNodeList xndCOFINSaliq = xml.GetElementsByTagName("COFINSAliq"); XmlNodeList xndCOFINSqtde = xml.GetElementsByTagName("COFINSQtde"); XmlNodeList xndCOFINSnt = xml.GetElementsByTagName("COFINSNT"); XmlNodeList xndCOFINSoutr = xml.GetElementsByTagName("COFINSOutr"); XmlNodeList xndCOFINSst = xml.GetElementsByTagName("COFINSST"); XmlNodeList xndISSQN = xml.GetElementsByTagName("ISSQN"); XmlNodeList xndInfAdProd = xml.GetElementsByTagName("infAdProd"); drDet = dsdanfe.det.NewdetRow(); drProd = dsdanfe.prod.NewprodRow(); drImposto = dsdanfe.imposto.NewimpostoRow(); drICMS = dsdanfe.ICMS.NewICMSRow(); drICMS00 = dsdanfe.ICMS00.NewICMS00Row(); drICMS10 = dsdanfe.ICMS10.NewICMS10Row(); drICMS20 = dsdanfe.ICMS20.NewICMS20Row(); drICMS30 = dsdanfe.ICMS30.NewICMS30Row(); drICMS40 = dsdanfe.ICMS40.NewICMS40Row(); drICMS60 = dsdanfe.ICMS60.NewICMS60Row(); drICMS70 = dsdanfe.ICMS70.NewICMS70Row(); drICMS90 = dsdanfe.ICMS90.NewICMS90Row(); drICMSPart = dsdanfe.ICMSPart.NewICMSPartRow(); drICMSST = dsdanfe.ICMSST.NewICMSSTRow(); drICMSSN101 = dsdanfe.ICMSSN101.NewICMSSN101Row(); drICMSSN102 = dsdanfe.ICMSSN102.NewICMSSN102Row(); drICMSSN201 = dsdanfe.ICMSSN201.NewICMSSN201Row(); drICMSSN500 = dsdanfe.ICMSSN500.NewICMSSN500Row(); drICMSSN900 = dsdanfe.ICMSSN900.NewICMSSN900Row(); //Claudinei - o.s. sem - 18/12/2009 drICMS51 = dsdanfe.ICMS51.NewICMS51Row(); //Fim - Claudinei - o.s. sem - 18/12/2009 drIPI = dsdanfe.IPI.NewIPIRow(); drIPItrib = dsdanfe.IPITrib.NewIPITribRow(); drIPInt = dsdanfe.IPINT.NewIPINTRow(); drII = dsdanfe.II.NewIIRow(); drPIS = dsdanfe.PIS.NewPISRow(); drPisAliq = dsdanfe.PISAliq.NewPISAliqRow(); drPisQtde = dsdanfe.PISQtde.NewPISQtdeRow(); drPisNT = dsdanfe.PISNT.NewPISNTRow(); drPisOutr = dsdanfe.PISOutr.NewPISOutrRow(); drPisST = dsdanfe.PISST.NewPISSTRow(); drCofins = dsdanfe.COFINS.NewCOFINSRow(); drCofinsAliq = dsdanfe.COFINSAliq.NewCOFINSAliqRow(); drCofinsNT = dsdanfe.COFINSNT.NewCOFINSNTRow(); drCofinsOutr = dsdanfe.COFINSOutr.NewCOFINSOutrRow(); drCofinsST = dsdanfe.COFINSST.NewCOFINSSTRow(); drISSQN = dsdanfe.ISSQN.NewISSQNRow(); drInfAdProd = dsdanfe.infAdProd.NewinfAdProdRow(); // Diego - OS. 24144 - 19/02/2010 drRetira = dsdanfe.retirada.NewretiradaRow(); // Diego - OS. 24144 - 19/02/2010 - FIM // Diego - OS_24302 - 01/04/2010 int iPK_itens_notaAnterior = dsdanfe.det.Count; // Diego - OS_24302 - 01/04/2010 Fim if (xNdProd.Count > 0) { int i = 0; int detID = 0; while (i < xNdProd.Count) { if (dsdanfe.det.Count > 0) { detID = dsdanfe.det.Count + 1; } else { detID = i + 1; } drDet = dsdanfe.det.NewdetRow(); populaDadosDet(detID, CodinfNfeId); dsdanfe.det.AdddetRow(drDet); i++; } } if (xNdProd.Count > 0) { for (int i = 0; i < xNdProd.Count; i++) { int prodId = 0; if (dsdanfe.prod.Count > 0) { prodId = dsdanfe.prod.Count + 1; } else { prodId = i + 1; } // qtde de nodes iqtdeComercial = Convert.ToInt16(LeRegWin.LeRegConfig("QtdeCasasProdutos")); for (int j = 0; j < xNdProd[i].ChildNodes.Count; j++) { populaDadosProd(xNdProd[i].ChildNodes[j].LocalName, xNdProd[i].ChildNodes[j].InnerText, prodId.ToString()); } dsdanfe.prod.AddprodRow(drProd); drProd = dsdanfe.prod.NewprodRow(); } } if (xNdImposto.Count > 0) // POPULA TABLE IMPOSTO - ICMS - PIS - COFINS { int i = 0; int impostoID = 0; while (i < xNdImposto.Count) { impostoID = dsdanfe.imposto.Count + 1; drImposto = dsdanfe.imposto.NewimpostoRow(); drICMS = dsdanfe.ICMS.NewICMSRow(); drPIS = dsdanfe.PIS.NewPISRow(); drCofins = dsdanfe.COFINS.NewCOFINSRow(); populaDadosImposto_ICMS_PIS_COFINS(impostoID); dsdanfe.ICMS.AddICMSRow(drICMS); dsdanfe.imposto.AddimpostoRow(drImposto); dsdanfe.PIS.AddPISRow(drPIS); dsdanfe.COFINS.AddCOFINSRow(drCofins); i++; } } int i00 = 0; int i10 = 0; int i20 = 0; int i30 = 0; int i40 = 0; int i51 = 0; int i60 = 0; int i70 = 0; int i90 = 0; int iPart = 0; int iST = 0; int i101 = 0; int i102 = 0; int i201 = 0; int i500 = 0; int i900 = 0; for (int i = 0; i < xNdICMS.Count; i++) { // Diego - OS_24302 - 01/04/2010 iPK_itens_notaAnterior++; switch (xNdICMS[i].FirstChild.Name) { case "ICMS00": for (int j = 0; j < xNdICMS00[i00].ChildNodes.Count; j++) { populaDadosICMS00(xNdICMS00[i00].ChildNodes[j].LocalName, xNdICMS00[i00].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS00.AddICMS00Row(drICMS00); drICMS00 = dsdanfe.ICMS00.NewICMS00Row(); i00++; break; case "ICMS10": for (int j = 0; j < xNdICMS10[i10].ChildNodes.Count; j++) { populaDadosICMS10(xNdICMS10[i10].ChildNodes[j].LocalName, xNdICMS10[i10].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS10.AddICMS10Row(drICMS10); drICMS10 = dsdanfe.ICMS10.NewICMS10Row(); i10++; break; case "ICMS20": for (int j = 0; j < xNdICMS20[i20].ChildNodes.Count; j++) { populaDadosICMS20(xNdICMS20[i20].ChildNodes[j].LocalName, xNdICMS20[i20].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS20.AddICMS20Row(drICMS20); drICMS20 = dsdanfe.ICMS20.NewICMS20Row(); i20++; break; case "ICMS30": for (int j = 0; j < xNdICMS30[i30].ChildNodes.Count; j++) { populaDadosICMS30(xNdICMS30[i30].ChildNodes[j].LocalName, xNdICMS30[i30].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS30.AddICMS30Row(drICMS30); drICMS30 = dsdanfe.ICMS30.NewICMS30Row(); i30++; break; case "ICMS40": for (int j = 0; j < xNdICMS40[i40].ChildNodes.Count; j++) { populaDadosICMS40(xNdICMS40[i40].ChildNodes[j].LocalName, xNdICMS40[i40].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS40.AddICMS40Row(drICMS40); drICMS40 = dsdanfe.ICMS40.NewICMS40Row(); i40++; break; case "ICMS51": for (int j = 0; j < xNdICMS51[i51].ChildNodes.Count; j++) { populaDadosICMS51(xNdICMS51[i51].ChildNodes[j].LocalName, xNdICMS51[i51].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS51.AddICMS51Row(drICMS51); drICMS51 = dsdanfe.ICMS51.NewICMS51Row(); i51++; break; case "ICMS60": for (int j = 0; j < xNdICMS60[i60].ChildNodes.Count; j++) { populaDadosICMS60(xNdICMS60[i60].ChildNodes[j].LocalName, xNdICMS60[i60].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS60.AddICMS60Row(drICMS60); drICMS60 = dsdanfe.ICMS60.NewICMS60Row(); i60++; break; case "ICMS70": for (int j = 0; j < xNdICMS70[i70].ChildNodes.Count; j++) { populaDadosICMS70(xNdICMS70[i70].ChildNodes[j].LocalName, xNdICMS70[i70].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS70.AddICMS70Row(drICMS70); drICMS70 = dsdanfe.ICMS70.NewICMS70Row(); i70++; break; case "ICMS90": for (int j = 0; j < xNdICMS90[i90].ChildNodes.Count; j++) { populaDadosICMS90(xNdICMS90[i90].ChildNodes[j].LocalName, xNdICMS90[i90].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMS90.AddICMS90Row(drICMS90); drICMS90 = dsdanfe.ICMS90.NewICMS90Row(); i90++; break; case "ICMSPart": for (int j = 0; j < xNdICMSPart[iPart].ChildNodes.Count; j++) { populaDadosICMSPart(xNdICMSPart[iPart].ChildNodes[j].LocalName, xNdICMSPart[iPart].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSPart.AddICMSPartRow(drICMSPart); drICMSPart = dsdanfe.ICMSPart.NewICMSPartRow(); iPart++; break; case "ICMSST": for (int j = 0; j < xNdICMSST[iST].ChildNodes.Count; j++) { populaDadosICMSST(xNdICMSST[iST].ChildNodes[j].LocalName, xNdICMSST[iST].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSST.AddICMSSTRow(drICMSST); drICMSST = dsdanfe.ICMSST.NewICMSSTRow(); iST++; break; case "ICMSSN101": for (int j = 0; j < xNdICMSSN101[i101].ChildNodes.Count; j++) { populaDadosICMSSN101(xNdICMSSN101[i101].ChildNodes[j].LocalName, xNdICMSSN101[i101].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSSN101.AddICMSSN101Row(drICMSSN101); drICMSSN101 = dsdanfe.ICMSSN101.NewICMSSN101Row(); i101++; break; case "ICMSSN102": for (int j = 0; j < xNdICMSSN102[i102].ChildNodes.Count; j++) { populaDadosICMSSN102(xNdICMSSN102[i102].ChildNodes[j].LocalName, xNdICMSSN102[i102].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSSN102.AddICMSSN102Row(drICMSSN102); drICMSSN102 = dsdanfe.ICMSSN102.NewICMSSN102Row(); i102++; break; case "ICMSSN201": for (int j = 0; j < xNdICMSSN201[i201].ChildNodes.Count; j++) { populaDadosICMSSN201(xNdICMSSN201[i201].ChildNodes[j].LocalName, xNdICMSSN201[i201].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSSN201.AddICMSSN201Row(drICMSSN201); drICMSSN201 = dsdanfe.ICMSSN201.NewICMSSN201Row(); i201++; break; case "ICMSSN500": for (int j = 0; j < xNdICMSSN500[i500].ChildNodes.Count; j++) { populaDadosICMSSN500(xNdICMSSN500[i500].ChildNodes[j].LocalName, xNdICMSSN500[i500].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSSN500.AddICMSSN500Row(drICMSSN500); drICMSSN500 = dsdanfe.ICMSSN500.NewICMSSN500Row(); i500++; break; case "ICMSSN900": for (int j = 0; j < xNdICMSSN900[i900].ChildNodes.Count; j++) { populaDadosICMSSN900(xNdICMSSN900[i900].ChildNodes[j].LocalName, xNdICMSSN900[i900].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ICMSSN900.AddICMSSN900Row(drICMSSN900); drICMSSN900 = dsdanfe.ICMSSN900.NewICMSSN900Row(); i900++; break; } // Diego - OS_24302 - 01/04/2010 - Fim if (xNdIPI.Count > 0) { for (int j = 0; j < xNdIPI[i].ChildNodes.Count; j++) { populaDadosIPI(xNdIPI[i].ChildNodes[j].LocalName, xNdIPI[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior), (iPK_itens_notaAnterior).ToString()); } dsdanfe.IPI.AddIPIRow(drIPI); drIPI = dsdanfe.IPI.NewIPIRow(); } //Claudinei - o.s. sem - 18/02/2010 // Diego - Sem O.S - 18/02/2010 for (int x = 0; x < xNdIPI[i].ChildNodes.Count; x++) { if (xNdIPI[i].ChildNodes[x].Name.Equals("IPITrib")) { if (xNdIPItrib[icountxNdIPI] != null) { for (int j = 0; j < xNdIPItrib[icountxNdIPI].ChildNodes.Count; j++) { populaDadosIPItrib(xNdIPItrib[icountxNdIPI].ChildNodes[j].LocalName, xNdIPItrib[icountxNdIPI].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } icountxNdIPI++; dsdanfe.IPITrib.AddIPITribRow(drIPItrib); drIPItrib = dsdanfe.IPITrib.NewIPITribRow(); } } } for (int x = 0; x < xNdIPI[i].ChildNodes.Count; x++) { if (xNdIPI[i].ChildNodes[x].Name.Equals("IPINT")) { if (xNdIPInt[icontxNdIPInt] != null) { for (int j = 0; j < xNdIPInt[icontxNdIPInt].ChildNodes.Count; j++) { populaDadosIPInt(xNdIPInt[icontxNdIPInt].ChildNodes[j].LocalName, xNdIPInt[icontxNdIPInt].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } icontxNdIPInt++; dsdanfe.IPINT.AddIPINTRow(drIPInt); drIPInt = dsdanfe.IPINT.NewIPINTRow(); } } } // Diego - Sem O.S - 18/02/2010 - fIM if (xndII.Count > 0) { for (int j = 0; j < xndII[i].ChildNodes.Count; j++) { populaDadosII(xndII[i].ChildNodes[j].LocalName, xndII[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.II.AddIIRow(drII); drII = dsdanfe.II.NewIIRow(); } if (xndPISAliq.Count > 0) { if (xndPISAliq[i] != null) { for (int j = 0; j < xndPISAliq[i].ChildNodes.Count; j++) //Claudinei - sem - 20/01/2010 { populaDadosPisAliq(xndPISAliq[i].ChildNodes[j].LocalName, xndPISAliq[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.PISAliq.AddPISAliqRow(drPisAliq); drPisAliq = dsdanfe.PISAliq.NewPISAliqRow(); } } if (xndPISQtde.Count > 0) { for (int j = 0; j < xndPISQtde[i].ChildNodes.Count; j++) //Claudinei - sem - 20/01/2010 { populaDadosPisQtde(xndPISQtde[i].ChildNodes[j].LocalName, xndPISQtde[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.PISQtde.AddPISQtdeRow(drPisQtde); drPisQtde = dsdanfe.PISQtde.NewPISQtdeRow(); } if (xndPISNT.Count > 0) { if (xndPISNT[i] != null) { for (int j = 0; j < xndPISNT[i].ChildNodes.Count; j++) { populaDadosPisNT(xndPISNT[i].ChildNodes[j].LocalName, xndPISNT[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.PISNT.AddPISNTRow(drPisNT); drPisNT = dsdanfe.PISNT.NewPISNTRow(); } } if (xndPISOutr[i] != null) { if (xndPISOutr[i].ChildNodes.Count > 0) { for (int j = 0; j < xndPISOutr[i].ChildNodes.Count; j++) { populaDadosPisOut(xndPISOutr[i].ChildNodes[j].LocalName, xndPISOutr[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.PISOutr.AddPISOutrRow(drPisOutr); drPisOutr = dsdanfe.PISOutr.NewPISOutrRow(); } } if (xndPISST.Count > 0) { for (int j = 0; j < xndPISST[i].ChildNodes.Count; j++) { populaDadosPisST(xndPISST[i].ChildNodes[j].LocalName, xndPISST[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.PISST.AddPISSTRow(drPisST); drPisST = dsdanfe.PISST.NewPISSTRow(); } if (xndCOFINSaliq.Count > 0) { if (xndCOFINSaliq[i] != null) { for (int j = 0; j < xndCOFINSaliq[i].ChildNodes.Count; j++) { populaDadosCofinsAliq(xndCOFINSaliq[i].ChildNodes[j].LocalName, xndCOFINSaliq[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.COFINSAliq.AddCOFINSAliqRow(drCofinsAliq); drCofinsAliq = dsdanfe.COFINSAliq.NewCOFINSAliqRow(); } } if (xndCOFINSqtde.Count > 0) { for (int j = 0; j < xndCOFINSqtde[i].ChildNodes.Count; j++) { populaDadosCofinsQtde(xndCOFINSqtde[i].ChildNodes[j].LocalName, xndCOFINSqtde[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.COFINSQtde.AddCOFINSQtdeRow(drCofinsQtde); drCofinsQtde = dsdanfe.COFINSQtde.NewCOFINSQtdeRow(); } if (xndCOFINSnt.Count > 0) { if (xndCOFINSnt[i] != null) { for (int j = 0; j < xndCOFINSnt[i].ChildNodes.Count; j++) { populaDadosCofinsNT(xndCOFINSnt[i].ChildNodes[j].LocalName, xndCOFINSnt[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.COFINSNT.AddCOFINSNTRow(drCofinsNT); drCofinsNT = dsdanfe.COFINSNT.NewCOFINSNTRow(); } } if (xndCOFINSoutr[i] != null) { for (int j = 0; j < xndCOFINSoutr[i].ChildNodes.Count; j++) { populaDadosCofinsOutr(xndCOFINSoutr[i].ChildNodes[j].LocalName, xndCOFINSoutr[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.COFINSOutr.AddCOFINSOutrRow(drCofinsOutr); drCofinsOutr = dsdanfe.COFINSOutr.NewCOFINSOutrRow(); } if (xndCOFINSst.Count > 0) { for (int j = 0; j < xndCOFINSst[i].ChildNodes.Count; j++) { populaDadosCofinsST(xndCOFINSst[i].ChildNodes[j].LocalName, xndCOFINSst[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.COFINSST.AddCOFINSSTRow(drCofinsST); drCofinsST = dsdanfe.COFINSST.NewCOFINSSTRow(); } if (xndISSQN.Count > 0) { for (int j = 0; j < xndISSQN[i].ChildNodes.Count; j++) { populaDadosISSQN(xndISSQN[i].ChildNodes[j].LocalName, xndISSQN[i].ChildNodes[j].InnerText, (iPK_itens_notaAnterior).ToString()); } dsdanfe.ISSQN.AddISSQNRow(drISSQN); drISSQN = dsdanfe.ISSQN.NewISSQNRow(); } //comentar //Diego - o.s. sem - 09/02/2010 for (int x = 0; x < xNdDet[i].ChildNodes.Count; x++) { if (xNdDet[i].ChildNodes[x].Name.Equals("infAdProd")) { populaDadosInfAdProd(xNdDet[i].ChildNodes[x].InnerText, (iPK_itens_notaAnterior).ToString()); } } dsdanfe.infAdProd.AddinfAdProdRow(drInfAdProd); drInfAdProd = dsdanfe.infAdProd.NewinfAdProdRow(); } }
public void PopulaTagRetirada(dsDanfe dsdanfe, XmlDocument xml, string CodinfNfeId) { XmlNodeList xNdRetirada = xml.GetElementsByTagName("retirada"); if (xNdRetirada.Count > 0) { for (int i = 0; i < xNdRetirada.Count; i++) { int InfNFeId = i + 1; // qtde de nodes for (int j = 0; j < xNdRetirada[i].ChildNodes.Count; j++) { populaDadosRetirada(xNdRetirada[i].ChildNodes[j].LocalName, xNdRetirada[i].ChildNodes[j].InnerText, InfNFeId.ToString(), CodinfNfeId); } dsdanfe.retirada.AddretiradaRow(drRetira); drRetira = dsdanfe.retirada.NewretiradaRow(); } } }