/// <summary> /// Retorna tabla con informacion de cliente /// </summary> /// <param name="xdoc"></param> /// <returns>datatable</returns> public DataTable getInfoClientes(XmlDocument xdoc) { DtInfo dtinfo = new DtInfo(); DataTable dtCliente = dtinfo.Tables["Cliente"]; XmlNodeList xnodeList = xdoc.SelectNodes("/Clientes/Cliente"); foreach (XmlNode nodeRow in xnodeList) { XmlNode id = nodeRow.SelectSingleNode("Id"); XmlNode Nombre = nodeRow.SelectSingleNode("Nombre"); XmlNode Descripcion = nodeRow.SelectSingleNode("Descripcion"); DtInfo.ClienteRow row = dtinfo.Cliente.NewClienteRow(); row.Id = id.InnerText; row.Nombre = Nombre.InnerText; row.Descripcion = Descripcion.InnerText; //Adiciona fila dtCliente.Rows.Add(row); } return(dtCliente); }
/// <summary> /// Retorna la informacion completa para el visor /// </summary> /// <param name="errors"></param> /// <param name="rutaArchivoXmlFuente">Ruta del xml fuente</param> /// <returns></returns> public DataTable GetAllDataBurns(List <String> errors, string rutaArchivoXmlFuente) { Boolean errorLoad = false; XmlDocument xdoc = this.LoadXml(errorLoad, rutaArchivoXmlFuente); if (errorLoad) { errors.Add("[Error] No existe o la ruta XML fuente no es accesible"); return(null); } DtInfo dtinfo = new DtInfo(); DataTable DtInfogrid = dtinfo.Tables["DtInfogrid"]; XmlNodeList xNodesBurns = xdoc.SelectNodes("/*[local-name() = 'SampleData']/*[local-name() = 'Burns'][*[local-name() = 'IsAvg']='True']"); int contador = 0; #region Recorre todos los nodos AVG = True; foreach (XmlNode nodeRow in xNodesBurns) { contador++; var date = nodeRow.SelectSingleNode("*[local-name() = 'Date']"); var Time = nodeRow.SelectSingleNode("*[local-name() = 'Time']"); var NombreCliente = nodeRow.SelectSingleNode("*[local-name() = 'HeaderName']"); var Lote = nodeRow.SelectSingleNode("*[local-name() = 'Label_Value']"); ///Elementos #region Mapeo de los elementos var Pb = nodeRow.SelectSingleNode("*[local-name() = 'CH12L1']"); var Cu = nodeRow.SelectSingleNode("*[local-name() = 'CH13L12']"); var Sn = nodeRow.SelectSingleNode("*[local-name() = 'CH11L12']"); var Ag = nodeRow.SelectSingleNode("*[local-name() = 'CH14L12']"); var Ca = nodeRow.SelectSingleNode("*[local-name() = 'CH17L12']"); var Al = nodeRow.SelectSingleNode("*[local-name() = 'CH18L12']"); var Ni = nodeRow.SelectSingleNode("*[local-name() = 'CH15L12']"); var Fe = nodeRow.SelectSingleNode("*[local-name() = 'CH16L12']"); var Bi = nodeRow.SelectSingleNode("*[local-name() = 'CH10L12']"); var Se = nodeRow.SelectSingleNode("*[local-name() = 'CH03L12']"); var Zn = nodeRow.SelectSingleNode("*[local-name() = 'CH04L12']"); var Cd = nodeRow.SelectSingleNode("*[local-name() = 'CH05L12']"); var Sb = nodeRow.SelectSingleNode("*[local-name() = 'CH06L12']"); var Sb_2 = nodeRow.SelectSingleNode("*[local-name() = 'CH09L12']"); // Utilizado para el segundo archivo var As = nodeRow.SelectSingleNode("*[local-name() = 'CH07L12']"); #endregion DtInfo.DtInfogridRow row = dtinfo.DtInfogrid.NewDtInfogridRow(); #region Fecha if (date != null) { row.Fecha = date.InnerText; } else { row.Fecha = ""; } #endregion #region Hora // Hora if (Time != null) { row.Hora = Time.InnerText; } else { row.Hora = ""; } #endregion #region Nombre de cliente if (NombreCliente != null) { row.NombreCliente = NombreCliente.InnerText; } else { row.NombreCliente = ""; } #endregion #region Lote if (Lote != null) { row.Lote = Lote.InnerText; } else { row.Lote = ""; } #endregion #region Elementos row.Pb = (Pb != null ? Pb.InnerText : "0.000"); row.Cu = (Cu != null ? Cu.InnerText : "0.000"); row.Sn = (Sn != null ? Sn.InnerText : "0.000"); row.Ag = (Ag != null ? Ag.InnerText : "0.000"); row.Ca = (Ca != null ? Ca.InnerText : "0.000"); row.Al = (Al != null ? Al.InnerText : "0.000"); row.Ni = (Ni != null ? Ni.InnerText : "0.000"); row.Fe = (Fe != null ? Fe.InnerText : "0.000"); row.Bi = (Bi != null ? Bi.InnerText : "0.000"); row.Se = (Se != null ? Se.InnerText : "0.000"); row.Zn = (Zn != null ? Zn.InnerText : "0.000"); row.Cd = (Cd != null ? Cd.InnerText : "0.000"); if (Sb != null && Sb.InnerText.Trim().Length > 0) { row.Sb = Sb.InnerText.Trim(); } else if (Sb_2 != null && Sb_2.InnerText.Trim().Length > 0) { row.Sb = Sb_2.InnerText.Trim(); // Solo aplica por que no existe en archivo de Aleacion pura } //row.Sb = (Sb != null ? Sb.InnerText : "0.000"); row.As = (As != null ? As.InnerText : "0.000"); #endregion //Adicion de fila DtInfogrid.Rows.Add(row); } #endregion if (DtInfogrid.Rows.Count > 0) { return(DtInfogrid); } return(null); }