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"; }
private void syncFFM() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("FFM.txt", AppDomain.CurrentDomain.BaseDirectory + "FFM.txt"); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<FFM> buginFFM = new List<FFM>(); Broker b = new Broker(); String CsOG = ""; buginFFM = b.FillListBoxFFM(b.LoadOccupation("FFM")); foreach (var item in buginFFM) { //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 = 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.DayOfOperation.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.Pieces, 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", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.DayOfOperation.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", item.Pieces, new XAttribute("propertyName", "sogp_cargo_count_arrival")), new XElement(am + "Update", Math.Round(Convert.ToDouble(item.Weight)), new XAttribute("propertyName", "SOP Cargo Weight Arrival")), new XElement(am + "TableValueUpdate", new XAttribute("propertyName", "AA_AWB1")) ) ) ) ); for (int i = 1; i < item.FieldArray + 1; i++) { XElement track = new XElement(ad + "Row", new XElement(ad + "Value", item.PiecesArr[i], new XAttribute("propertyName", "Oryn")), new XElement(ad + "Value", item.WeightArr[i], new XAttribute("propertyName", "Weight")), new XElement(ad + "Value", item.AirlineAWBIdentificationArr[i] + "-" + item.AwbSerialNumberArr[i], new XAttribute("propertyName", "AWB_Numbers")), new XElement(ad + "Value", item.VolumeCodeArr[i], new XAttribute("propertyName", "Measument_TYPE")), new XElement(ad + "Value", item.VolumeArr[i], new XAttribute("propertyName", "Mea_Values")), new XElement(ad + "Value", item.AwbOriginArr[i], new XAttribute("propertyName", "Origin_IATA")), new XElement(ad + "Value", item.AwbDestinationArr[i], new XAttribute("propertyName", "Destination_IATA")), new XElement(ad + "Value", item.ShipmentDescriptionCodeArr[i], new XAttribute("propertyName", "AWB Types")), new XElement(ad + "Value", item.GoodsArr[i], new XAttribute("propertyName", "Remarks")) ); root.Element(am + "Content").Element(am + "FlightUpdateRequest").Element(am + "FlightUpdates").Element(am + "TableValueUpdate").Add(track); } } 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 FFM Flight: " + CsOG); b.CloseReader(); this.timerKezegi = "PTM"; }
private void syncLDM() { try { FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword); ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt"); } catch (IOException copyError) { eventLog1.WriteEntry(copyError.Message); return; } List<LDM> buginLDM = new List<LDM>(); Broker b = new Broker(); String CsOG = ""; buginLDM = b.FillListBoxLDM(b.LoadOccupation("LDM")); foreach (var item in buginLDM) { 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.DayOfOperation.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.PassengerAdults, new XAttribute("propertyName", "local_vzr_econom")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "local_rb_econom")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Departure")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Departure")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "local_vb_econom")) ) ) ) ); } 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", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.DayOfOperation.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.PassengerAdults, new XAttribute("propertyName", "sop adults arrival")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "sop_arr_child")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Arrival")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Arrival")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "weight+lug_arr")) ) ) ) ); } 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.WriteMonitoring(item.FlightIdentifier + " " + (item.MessageIdentifier == "Arrival" ? b.LDMDiffDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd") + " Arrival" : b.LDMDayOfDepartureDate(item.DayOfOperation.ToString(), item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)).ToString("yyyy-MM-dd") + " Departure")); } b.WriteMyLOG("Update LDM Flight: " + CsOG); b.CloseReader(); this.timerKezegi = "FFM"; }
private void button10_Click(object sender, EventArgs e) { try { if (checkBox1.Checked) { System.IO.File.Delete("LDM.txt"); System.IO.File.Copy(@"\\192.168.1.173\exported\LDM.txt", "LDM.txt"); } } catch (Exception) { throw; } Broker b = new Broker(); String CsOG = ""; buginLDM = b.FillListBoxLDM(b.LoadOccupation("LDM")); listBox1.DataSource = null; foreach (var item in buginLDM) { listBox1.Items.Add("LDM " + item.FlightIdentifier); //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 = 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.DayOfOperation.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.PassengerAdults, new XAttribute("propertyName", "local_vzr_econom")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "local_rb_econom")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Departure")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Departure")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "local_vb_econom")) ) ) ) ); } 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", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)), new XElement(ad + "ScheduledDate", b.LDMDiffDate(item.DayOfOperation.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.PassengerAdults, new XAttribute("propertyName", "sop adults arrival")), new XElement(am + "Update", item.PassengerChild, new XAttribute("propertyName", "sop_arr_child")), new XElement(am + "Update", item.Mail, new XAttribute("propertyName", "SOP Mail Arrival")), new XElement(am + "Update", item.Freight, new XAttribute("propertyName", "SOP Cargo Weight Arrival")), new XElement(am + "Update", item.Baggage, new XAttribute("propertyName", "weight+lug_arr")) ) ) ) ); } 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()); listBox2.Items.Add(root.ToString()); CsOG = CsOG + " " + root.ToString(); } b.WriteMyLOG("Update LDM Flight: " + CsOG); b.CloseReader(); toolStripStatusLabel1.Text = "Last Update LDM Arrivals " + DateTime.Now.ToString(); }