WPF generate xml file for list view data to save in database.

   /**********Generatating XML**********/
            string strEmploymentInfoListObject = "";
            System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(ticket.ListOfTicket.GetType());
            MemoryStream memoryStream = new MemoryStream();
            XmlTextWriter xmlWriter;
            xmlWriter = new XmlTextWriter(memoryStream, Encoding.UTF8);
            xmlWriter.Namespaces = true;
            x.Serialize(xmlWriter, ticket.ListOfTicket);
            xmlWriter.Close();
            memoryStream.Close();
            string xml;
            xml = Encoding.UTF8.GetString(memoryStream.GetBuffer());
            xml = xml.Substring(xml.IndexOf(Convert.ToChar(60)));
            xml = xml.Substring(0, (xml.LastIndexOf(Convert.ToChar(62)) + 1));
            strEmploymentInfoListObject = xml;
            


            /****** Checking The XML Data is Generate or not ********/
           
            MessageBox.Show(strEmploymentInfoListObject);
            ticketManager.SaveAllGenerateTicketInfo(xml);

Popular posts from this blog

WPF Crystal Report Viewer Using SAP

mvc razor textboxfor change event change another textboxfor value

ASP.NET MVC razor SAP Crystal report