Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using System.Xml;
- using System.Xml.Linq;
- namespace PostcodeTest
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnGenerateXML_Click(object sender, EventArgs e)
- {
- XmlDocument xD = new XmlDocument();
- using (CRMDEVEntities context = new CRMDEVEntities())
- {
- XDocument doc = new XDocument();
- XElement Root = new XElement("Root");
- doc.Add(Root);
- var OpportunitiesWithLatAndLong = from o in context.vListOpportunities
- join p in context.outcodepostcodes
- on o.oppo_secu_postcode.Substring(0, 4) equals p.outcode
- where o.oppo_casenumber.StartsWith("15")
- select new { o, p };
- foreach (var OpportunityWithLatAndLong in OpportunitiesWithLatAndLong)
- {
- XElement Header = new XElement("Casenumber" + OpportunityWithLatAndLong.o.oppo_casenumber,
- new XElement("Lat", OpportunityWithLatAndLong.p.lat),
- new XElement("Long", OpportunityWithLatAndLong.p.lng)
- );
- Root.Add(Header);
- }
- txtXMLOutput.Text = doc.ToString();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement