private void cmbCR_SelectedIndexChanged(object sender, EventArgs e)
        {
            using (TibcoGPEntities model = new TibcoGPEntities())
            {
                model.Database.CommandTimeout = 200;

                var xml = model.Compte_rendu.Where(x => x.cr_id == ((V_Compte_Rendu)cmbCR.SelectedValue).cr_id).Select(x => x.cr_rapport).FirstOrDefault();
                if (!string.IsNullOrEmpty(xml))
                {
                    System.Xml.Linq.XDocument xDocument = System.Xml.Linq.XDocument.Parse(xml);
                    txtXML.Text = xDocument.ToString();

                    System.Xml.Linq.XDocument xXslt = System.Xml.Linq.XDocument.Parse(Properties.Resources.Defaultss);

                    System.Xml.Xsl.XslCompiledTransform xTrans = new System.Xml.Xsl.XslCompiledTransform();
                    xTrans.Load(xXslt.CreateReader());
                    ms = new System.IO.MemoryStream();
                    xTrans.Transform(xDocument.CreateReader(), null, ms);
                    ms.Position = 0;
                    webBrowserXML.DocumentStream = ms;
                }
                else
                {
                    txtXML.Clear();
                    txtXML.Text = "VIDE";
                    webBrowserXML.DocumentText = string.Empty;
                }
            }
        }
Esempio n. 2
0
        public override XmlReader GetXmlReader(string input)
        {
            if (null == input)
            {
                throw new ArgumentNullException("input");
            }
            if (String.IsNullOrWhiteSpace(input))
            {
                throw new ArgumentException("The parameter cannot be empty or just contain whitespace", "input");
            }
            this.Logs.Log
            (
                Logging.LogCategory.UtilisationInformation,
                "Validating string source"
            );
            XmlReaderSettings settings = this.GetXmlReaderSettings();

            using (StringReader stringReader = new StringReader(input))
            {
                using (XmlReader r = XmlReader.Create(stringReader, settings))
                {
                    System.Xml.Linq.XDocument doc = System.Xml.Linq.XDocument.Load
                                                    (
                        r,
                        System.Xml.Linq.LoadOptions.SetLineInfo
                                                    );
                    return(doc.CreateReader());
                }
            }
        }
Esempio n. 3
0
        public static void Load(System.Xml.Linq.XDocument doc)
        {
            XmlSerializer serializer = new XmlSerializer(typeof(ScreenType));
            XmlReader     reader     = doc.CreateReader();

            reader.MoveToContent();

            ScreenType item = null;

            try
            {
                item = (ScreenType)serializer.Deserialize(reader);
            }
            catch (Exception ex)
            {
                throw new ApplicationException(String.Format("Error occurred while processing {0}", doc.Root.FirstNode.ToString()), ex);
            }

            Configuration.GetInstance().ScreenTypes.Add(item);
        }