private void scanMVT() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("MVT.txt", AppDomain.CurrentDomain.BaseDirectory + "MVT.txt"); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<MVTDeparture> buginDeparture = new List<MVTDeparture>(); // eventLog1.WriteEntry("Created buginDeparture"); Broker b = new Broker(); // eventLog1.WriteEntry("Created Broker"); String CsOG = ""; buginDeparture = b.FillListBox(b.LoadOccupation("MVT")); foreach (var item in buginDeparture) { XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Arrival"), new XElement(ad + "AirlineDesignator", item.FlightNumber.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightNumber.Substring(2, item.FlightNumber.Length - 2)), new XElement(ad + "ScheduledDate", b.FilterDate(Convert.ToDateTime(item.EstimatedTimeOfArrival), "start").ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", Convert.ToDateTime(item.EstimatedTimeOfArrival).ToString(), new XAttribute("propertyName", "arrival_estimated")), new XElement(am + "Update", b.FilterDate(Convert.ToDateTime(item.AirborneTime), "time").ToString("HHmm"), new XAttribute("propertyName", "R1_ATD")) ) ) ) ); messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; if (emulationMode == "Real") messageQueue1.Send(testMgs); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update Flight MVT: " + CsOG); b.CloseReader(); this.timerKezegi = "LDM"; // eventLog1.WriteEntry("SUCCESS Updated"); }
private void button8_Click(object sender, EventArgs e) { try { if (checkBox1.Checked) { // FTPClient ftp = new FTPClient("192.168.2.213", "sitatex", "asd123"); // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "MVT.txt"); //System.IO.File.Delete("MVT.txt"); //System.IO.File.Copy(@"\\192.168.1.173\exported\MVT.txt", "MVT.txt"); } } catch (Exception) { throw; } Broker b = new Broker(); String CsOG = ""; buginDeparture = b.FillListBox(b.LoadOccupation("MVT")); listBox1.DataSource = null; foreach (var item in buginDeparture) { listBox1.Items.Add(item.FlightNumber); //comboBox1.DataSource = b.Updater(item, item, 1); XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = new XElement(am + "Envelope", new XAttribute(XNamespace.Xmlns + "amsx-messages", "http://www.sita.aero/ams6-xml-api-messages"), new XAttribute("apiVersion", "1.2"), new XAttribute(XNamespace.Xmlns + "amsx-datatypes", "http://www.sita.aero/ams6-xml-api-datatypes"), new XElement(am + "Content", new XElement(am + "FlightUpdateRequest", new XElement(am + "FlightId", new XElement(ad + "FlightKind", "Arrival"), new XElement(ad + "AirlineDesignator", item.FlightNumber.Substring(0,2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightNumber.Substring(2,item.FlightNumber.Length - 2 )), new XElement(ad + "ScheduledDate", b.FilterDate(Convert.ToDateTime(item.EstimatedTimeOfArrival), "start").ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", //new XElement(am + "Update", "2015-11-13T12:25:00", new XAttribute("propertyName", "ScheduledTime")), //new XElement(am + "Update", "FRU", new XAttribute("propertyName", "Route"), new XAttribute("codeContext", "IATA")), //new XElement(am + "Update", "", new XAttribute("propertyName", "Arr_Codeshares"), new XAttribute("codeContext", "IATA")), new XElement(am + "Update", Convert.ToDateTime(item.EstimatedTimeOfArrival).ToString(), new XAttribute("propertyName", "arrival_estimated")), new XElement(am + "Update", b.FilterDate(Convert.ToDateTime(item.AirborneTime), "time").ToString("HHmm"), new XAttribute("propertyName", "R1_ATD")) ) ) ) ); string queuePath = textBox3.Text; messageQueue1.Path = queuePath; System.Messaging.Message testMgs = new System.Messaging.Message(); testMgs.Body = root; messageQueue1.Send(testMgs); comboBox2.Items.Add(root.ToString()); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update Flight MVT: " + CsOG); b.CloseReader(); toolStripStatusLabel2.Text = "Last Update MVT Arrivals " + DateTime.Now.ToString(); }