public belPis xmlBuscaDetPis(XmlDocument Xdoc) { belPis objPis = new belPis(); try { XmlDocument xPisN = new XmlDocument(); switch (Xdoc.GetElementsByTagName("PIS")[0].FirstChild.Name) { case "PISAliq": { belPisaliq objPisAliq = new belPisaliq(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISAliq")[0].OuterXml); objPisAliq.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPisAliq.Vbc = Convert.ToDecimal(xPisN.GetElementsByTagName("vBC")[0].InnerText); objPisAliq.Ppis = Convert.ToDecimal(xPisN.GetElementsByTagName("pPIS")[0].InnerText); objPisAliq.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("vPIS")[0].InnerText); objPis.belPisaliq = objPisAliq; break; } case "PISQtde": { belPisqtde objPisQtde = new belPisqtde(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISQtde")[0].OuterXml); objPisQtde.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPisQtde.Qbcprod = Convert.ToDecimal(xPisN.GetElementsByTagName("qBCProd")[0].InnerText); objPisQtde.Valiqprod = Convert.ToDecimal(xPisN.GetElementsByTagName("vAliqProd")[0].InnerText); objPisQtde.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("vPIS")[0].InnerText); objPis.belPisqtde = objPisQtde; break; } case "PISNT": { belPisnt objPisNT = new belPisnt(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISNT")[0].OuterXml); objPisNT.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPis.belPisnt = objPisNT; break; } case "PISOutr": { belPisoutr objPisOutr = new belPisoutr(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISOutr")[0].OuterXml); objPisOutr.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPisOutr.Vbc = Convert.ToDecimal(xPisN.GetElementsByTagName("")[0].InnerText); objPisOutr.Ppis = Convert.ToDecimal(xPisN.GetElementsByTagName("pPIS")[0].InnerText); objPisOutr.Qbcprod = Convert.ToDecimal(xPisN.GetElementsByTagName("qBCProd")[0].InnerText); objPisOutr.Valiqprod = Convert.ToDecimal(xPisN.GetElementsByTagName("")[0].InnerText); objPisOutr.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("")[0].InnerText); objPis.belPisoutr = objPisOutr; break; } case "PISST": { belPisst objPisST = new belPisst(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISST")[0].OuterXml); objPisST.Vbc = Convert.ToDecimal(xPisN.GetElementsByTagName("vBC")[0].InnerText); objPisST.Ppis = Convert.ToDecimal(xPisN.GetElementsByTagName("pPIS")[0].InnerText); objPisST.Qbcprod = Convert.ToDecimal(xPisN.GetElementsByTagName("qBCProd")[0].InnerText); objPisST.Valiqprod = Convert.ToDecimal(xPisN.GetElementsByTagName("vAliqProd")[0].InnerText); objPisST.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("vPIS")[0].InnerText); objPis.belPisst = objPisST; break; } } } catch (Exception ex) { throw new Exception(string.Format("Erro buscando PIS.: {0}", ex.Message)); } return objPis; }
public belPis xmlBuscaDetPis(XmlDocument Xdoc) { belPis objPis = new belPis(); try { XmlDocument xPisN = new XmlDocument(); switch (Xdoc.GetElementsByTagName("PIS")[0].FirstChild.Name) { case "PISAliq": { belPisaliq objPisAliq = new belPisaliq(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISAliq")[0].OuterXml); objPisAliq.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPisAliq.Vbc = Convert.ToDecimal(xPisN.GetElementsByTagName("vBC")[0].InnerText); objPisAliq.Ppis = Convert.ToDecimal(xPisN.GetElementsByTagName("pPIS")[0].InnerText); objPisAliq.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("vPIS")[0].InnerText); objPis.belPisaliq = objPisAliq; break; } case "PISQtde": { belPisqtde objPisQtde = new belPisqtde(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISQtde")[0].OuterXml); objPisQtde.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPisQtde.Qbcprod = Convert.ToDecimal(xPisN.GetElementsByTagName("qBCProd")[0].InnerText); objPisQtde.Valiqprod = Convert.ToDecimal(xPisN.GetElementsByTagName("vAliqProd")[0].InnerText); objPisQtde.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("vPIS")[0].InnerText); objPis.belPisqtde = objPisQtde; break; } case "PISNT": { belPisnt objPisNT = new belPisnt(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISNT")[0].OuterXml); objPisNT.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPis.belPisnt = objPisNT; break; } case "PISOutr": { belPisoutr objPisOutr = new belPisoutr(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISOutr")[0].OuterXml); objPisOutr.Cst = xPisN.GetElementsByTagName("CST")[0].InnerText; objPisOutr.Vbc = Convert.ToDecimal(xPisN.GetElementsByTagName("")[0].InnerText); objPisOutr.Ppis = Convert.ToDecimal(xPisN.GetElementsByTagName("pPIS")[0].InnerText); objPisOutr.Qbcprod = Convert.ToDecimal(xPisN.GetElementsByTagName("qBCProd")[0].InnerText); objPisOutr.Valiqprod = Convert.ToDecimal(xPisN.GetElementsByTagName("")[0].InnerText); objPisOutr.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("")[0].InnerText); objPis.belPisoutr = objPisOutr; break; } case "PISST": { belPisst objPisST = new belPisst(); xPisN.LoadXml(Xdoc.GetElementsByTagName("PISST")[0].OuterXml); objPisST.Vbc = Convert.ToDecimal(xPisN.GetElementsByTagName("vBC")[0].InnerText); objPisST.Ppis = Convert.ToDecimal(xPisN.GetElementsByTagName("pPIS")[0].InnerText); objPisST.Qbcprod = Convert.ToDecimal(xPisN.GetElementsByTagName("qBCProd")[0].InnerText); objPisST.Valiqprod = Convert.ToDecimal(xPisN.GetElementsByTagName("vAliqProd")[0].InnerText); objPisST.Vpis = Convert.ToDecimal(xPisN.GetElementsByTagName("vPIS")[0].InnerText); objPis.belPisst = objPisST; break; } } } catch (Exception ex) { throw new Exception(string.Format("Erro buscando PIS.: {0}", ex.Message)); } return(objPis); }