private void syncPTM() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("PTM.txt", AppDomain.CurrentDomain.BaseDirectory + "PTM.txt"); //File.Copy(@"\\192.168.1.173\exported\LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt",true); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<PTM> buginPTM = new List<PTM>(); Broker b = new Broker(); String CsOG = ""; buginPTM = b.FillListBoxPTM(b.LoadOccupation("PTM")); foreach (var item in buginPTM) { //listBox1.Items.Add("ptm " + item.ToString()); XNamespace am = "http://www.sita.aero/ams6-xml-api-messages"; XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes"; XElement root = null; if (item.MessageIdentifier == "Departure") { 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", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDayOfDepartureDate(item.FlightDate.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).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", item.Bags, new XAttribute("propertyName", "sogp_cargo_count_departure")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "SOP Cargo Weight Departure")) ) ) ) ); } else if (item.MessageIdentifier == "Arrival") { 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", item.MessageIdentifier), new XElement(ad + "AirlineDesignator", item.FlightIdentifier.Substring(0, 2), new XAttribute("codeContext", "IATA")), new XElement(ad + "FlightNumber", Convert.ToInt32(item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2))), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.FlightDate.Substring(0, 2), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd")), new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA")) ), new XElement(am + "FlightUpdates", new XElement(am + "Update", item.Passenger, new XAttribute("propertyName", "ARR_TRANS_PASS")), //Darkhan new XElement(am + "Update", item.TranzitDomesticPAX, new XAttribute("propertyName", "TranzitDomesticPax")), new XElement(am + "Update", item.TranzitInternationalPAX, new XAttribute("propertyName", "TranzitInternationalPax")), new XElement(am + "Update", item.Bags, new XAttribute("propertyName", "ARR_TRANS_BAGS")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "ARR_TRANS_BAG_WEIGHT")) ) ) ) ); } //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 PTM Flight: " + CsOG); b.CloseReader(); this.timerKezegi = "FFMS"; }