private string generarXMLServiciosGarantia()
        {
            asignacionResumen(ref objresumen);
            DataTable   res     = new DataTable();
            XmlDocument doc     = new XmlDocument();
            XmlNode     docNode = doc.CreateXmlDeclaration("1.0", null, null); //doc.CreateXmlDeclaration("1.0", "UTF-8", null);

            doc.AppendChild(docNode);
            XmlNode ValoresNode = doc.CreateElement("Valores");

            doc.AppendChild(ValoresNode);
            XmlNode RespNode;
            XmlNode root = doc.DocumentElement;

            RespNode = doc.CreateElement("Val");

            for (int i = 0; i <= tbServiciosGarantia1.Rows.Count - 1; i++)
            {
                XmlNode RespNodeCkb;
                RespNodeCkb = doc.CreateElement("Ckb");

                XmlNode nodo = doc.CreateElement("ID");
                nodo.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode(tbServiciosGarantia1.Rows[i].Cells[0].Text)));
                RespNodeCkb.AppendChild(nodo);

                XmlNode nodo1 = doc.CreateElement("Descripcion");
                nodo1.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode(tbServiciosGarantia1.Rows[i].Cells[1].Text)));
                RespNodeCkb.AppendChild(nodo1);

                XmlNode nodoG = doc.CreateElement("IdGarantia");
                nodoG.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode(tbServiciosGarantia1.Rows[i].Cells[2].Text)));
                RespNodeCkb.AppendChild(nodoG);


                for (int j = 0; j <= gridFiscalia.Rows.Count - 1; j++)
                {
                    if (System.Web.HttpUtility.HtmlDecode(gridFiscalia.Rows[j].Cells[1].Text) == (System.Web.HttpUtility.HtmlDecode(tbServiciosGarantia1.Rows[i].Cells[1].Text)))
                    {
                        XmlNode nodoC = doc.CreateElement("Costo");
                        nodoC.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode((gridFiscalia.Rows[j].FindControl("txtValor") as TextBox).Text)));
                        RespNodeCkb.AppendChild(nodoC);
                        break;
                    }
                }
                RespNode.AppendChild(RespNodeCkb);
            }
            ValoresNode.AppendChild(RespNode);
            return(doc.OuterXml);
        }
Beispiel #2
0
        private string generarXMLServiciosGarantia()
        {
            asignacionResumen(ref objresumen);
            vlidacion = true;
            DataTable   res     = new DataTable();
            XmlDocument doc     = new XmlDocument();
            XmlNode     docNode = doc.CreateXmlDeclaration("1.0", null, null); //doc.CreateXmlDeclaration("1.0", "UTF-8", null);

            doc.AppendChild(docNode);
            XmlNode ValoresNode = doc.CreateElement("Valores");

            doc.AppendChild(ValoresNode);
            XmlNode RespNode;
            XmlNode root = doc.DocumentElement;

            RespNode = doc.CreateElement("Val");

            for (int i = 0; i <= tbServiciosGarantias1.Rows.Count - 1; i++)
            {
                XmlNode RespNodeCkb;
                RespNodeCkb = doc.CreateElement("Ckb");

                XmlNode nodo = doc.CreateElement("ID");
                nodo.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode(tbServiciosGarantias1.Rows[i].Cells[1].Text)));
                RespNodeCkb.AppendChild(nodo);

                XmlNode nodo1 = doc.CreateElement("Descripcion");
                nodo1.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode(tbServiciosGarantias1.Rows[i].Cells[2].Text)));
                RespNodeCkb.AppendChild(nodo1);

                XmlNode nodoG = doc.CreateElement("IdGarantia");
                nodoG.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode(tbServiciosGarantias1.Rows[i].Cells[4].Text)));
                RespNodeCkb.AppendChild(nodoG);

                XmlNode nodoC = doc.CreateElement("Estado");
                nodoC.AppendChild(doc.CreateTextNode(System.Web.HttpUtility.HtmlDecode((tbServiciosGarantias1.Rows[i].FindControl("ckbServiciosEmpresa") as CheckBox).Checked.ToString())));
                RespNodeCkb.AppendChild(nodoC);

                if (!(tbServiciosGarantias1.Rows[i].FindControl("ckbServiciosEmpresa") as CheckBox).Checked)
                {
                    vlidacion = false;
                }

                RespNode.AppendChild(RespNodeCkb);
            }
            ValoresNode.AppendChild(RespNode);
            return(doc.OuterXml);
        }