private void Form1_Load(object sender, EventArgs e) { XmlDocument document = new XmlDocument(); try { GeneraXML g = new GeneraXML(); string x = g.xmlToString("50011", "ART", "SP_Cat_FormatoPedido"); Uni = consumo.LModelo("TOTAL"); ////***** lineas para recibir la cadena XML directo sql***********// //document = consumo.xml("XML"); //XmlReader rd = new XmlNodeReader(document); //DataSet dt = new DataSet(); //dt.ReadXml(rd); //Uni = dt.Tables[0]; ////***** lineas para recibir la cadena XML desde service***********// //document = consumo.xml_Response(); //XmlReader rd = new XmlNodeReader(document); //DataSet dt = new DataSet(); //dt.ReadXml(rd); //Uni = dt.Tables[0]; ////***********lineas para recibir por acces **************// //Uni = consumo.DatosAcces(); var LM = (from r in Uni.AsEnumerable() select r["Modelo"]).Distinct().ToList(); listModelo = LM.Select(s => (string)s).ToList(); } catch (Exception ee) { MessageBox.Show("" + ee.Message); } }
public XmlDocument xml_Response() { String dt = ""; XmlDocument document = new XmlDocument(); GeneraXML xml = new GeneraXML(); try { WebRef.Service sr = new WebRef.Service(); string pass = ConfigurationManager.AppSettings["PassServ"]; string SolXml = xml.xmlToString("50011", "ART", "SP_Cat_FormatoPedido"); document.LoadXml(sr.Solicitud(500, "1", CrypterPass.Crypt.Desencriptar(pass), 5002, SolXml)); } catch (Exception e) { if (e.Source != null) { throw new System.Exception(e.Message + ". error en xml."); } } return(document); }