コード例 #1
0
        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";
        }
コード例 #2
0
        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";
        }
コード例 #3
0
        private void SendFSU()
        {
            List<SelectedFlights> flightList = new List<SelectedFlights>();
            Broker b = new Broker();
            flightList = b.FillListBoxSelectedFlightsFFMfromAMS("FSU14", 1);
            int sou = 0;
            String CsOG = "";
            foreach (var selF in flightList)
            {
                List<FFM> ffmList = new List<FFM>();
                ffmList = b.FillListBoxFFMfromAMS(selF);

                //Толтырамыз
                string text1 = "";
                sou = 0;
                string textFFM, copyEmail, emailCC = "";
                foreach (var item in ffmList) //555-92050641SVOTSE/T5K38MC0.53/COURIER CARGO/ XPS
                {
                    textFFM = "";

                    sou++;
                    text1 = "";
                    text1 = b.LoadFFMBlank("fsu_blank");
                    text1 = text1.Replace("TSEAPXH", selF.TypeBADDRESS);

                    //text1 = text1.Replace("[EMAIL]", selF.EmailCargo);
                    text1 = text1.Replace("PS102", selF.FlightIdentifier);
                    text1 = text1.Replace("27MAY", selF.FlightSDO.ToString("ddMMM").ToUpper());
                    text1 = text1.Replace("[DESTINATION]", selF.Destination);
                    text1 = text1.Replace("[CARGOCOUNT]", item.Pieces.ToString());
                    text1 = text1.Replace("[CARGOWEIGHT]", item.Weight.ToString());
                    text1 = text1.Replace("[FSA89]", selF.TypeTimeIndicator.ToString());
                    text1 = text1.Replace("[TIME_DEP]", selF.DepTime.ToString());
                    text1 = text1.Replace("[TIME_ARR]", selF.ArrTime.ToString());
                    text1 = text1.Replace("[FSA72]", selF.DayChangeIndicator.ToString());
                    textFFM = textFFM + Environment.NewLine + item.AwbSerialNumber + item.Origin + item.Destination + "/T" + item.Pieces + "K" + item.Weight;
                    text1 = text1.Replace("[FSUAWB]", textFFM);
                    //Cақтаймыз
                    SaveFFM(text1, "FSU14-" + Convert.ToString(sou));

                    if (selF.EmailCargo.Length > 0)
                    {
                        b.WriteMyLOG("SEND Flight FSU: Start send email");
                        //Жібереміз Почтамен
                        emailCC = "";
                        copyEmail = "";
                        string[] split;
                        if (selF.EmailCargo.Contains(","))
                        {

                            split = selF.EmailCargo.Split(',');
                            for (int i = 1; i < split.Length; i++)
                            {
                                emailCC = emailCC + "," + split[i];
                            }
                            copyEmail = split[0];
                            emailCC = emailCC.Substring(1, emailCC.Length - 1); //Үтірді өшіру
                        }
                        else if (selF.EmailCargo.Equals("")) continue;
                        else copyEmail = selF.EmailCargo;
                        b.WriteMyLOG("SEND Flight FSU: copyEmail:" + copyEmail + " emailCC:" + emailCC);
                        try
                        {
                            SendMail(_SmtpServer, _SysMail, _SysMailPassword, copyEmail, emailCC, "FSU TSE", text1.Substring(text1.IndexOf("FSU/14"), text1.Length - text1.IndexOf("FSU/14")));
                        }
                        catch (Exception e)
                        {
                            b.WriteMyLOG("SEND Flight FSU:" + e);
                        }
                    }

                }

                //Жібереміз
                try
                {
                    FTPClient ftp = new FTPClient(_RemoteHostFids, _RemoteLoginFids, _RemotePasswordFids);
                    // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt");
                    string[] array1 = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.SND");
                    foreach (string name in array1)
                    {
                        Console.WriteLine(name);
                        byte pervyi = 1;
                        while (true)
                        {
                            try
                            {
                                ftp.UploadFile(name);
                                break;
                            }
                            catch (Exception e)
                            {
                                if (pervyi == 1)
                                {
                                    eventLog1.WriteEntry("Работа остановилась связи копированием " + e.ToString());
                                    pervyi = 2;
                                }
                                Thread.Sleep(10000);
                            }
                        }
                        if (pervyi == 2)
                            eventLog1.WriteEntry("Работа возобновилась");
                        File.Delete(name);
                    }

                }
                catch (IOException copyError)
                {
                    eventLog1.WriteEntry(copyError.Message);
                    throw;
                }

                XNamespace am = "http://www.sita.aero/ams6-xml-api-messages";
                XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes";
                XElement root = null;
                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", "Departure"),
                                    new XElement(ad + "AirlineDesignator", selF.CIata, new XAttribute("codeContext", "IATA")),
                                    new XElement(ad + "FlightNumber", selF.FlightNumber),
                                    new XElement(ad + "ScheduledDate", selF.FlightSDO.ToString("yyyy-MM-dd")),
                                    new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA"))
                                    ),
                                new XElement(am + "FlightUpdates",
                                    new XElement(am + "Update", "True", new XAttribute("propertyName", "FSU"))
                                )
                            )
                        ));

                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("SEND Flight FSU14 count(" + Convert.ToString(sou) +")" + CsOG);
            b.CloseReader();
            this.timerKezegi = "LDM";
        }
コード例 #4
0
        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";
        }
コード例 #5
0
        private void SendFFM()
        {
            List<SelectedFlights> flightList = new List<SelectedFlights>();
            Broker b = new Broker();
            flightList = b.FillListBoxSelectedFlightsFFMfromAMS("FFM", 1);

            String CsOG = "";
            foreach (var item in flightList)
            {
                List<FFM> ffmList = new List<FFM>();
                ffmList = b.FillListBoxFFMfromAMS(item);

                //Толтырамыз
                string text1;
                text1 = b.LoadFFMBlank("ffm_blank");
                text1 = text1.Replace("TSEAPXH", item.TypeBADDRESS);
                text1 = text1.Replace("PS102", item.FlightIdentifier);
                text1 = text1.Replace("27MAY", item.FlightSDO.ToString("ddMMM").ToUpper());
                text1 = text1.Replace("1930", item.FlightSTO.ToString("HHmm"));
                text1 = text1.Replace("URGAU", item.Registration);
                text1 = text1.Replace("[DESTINATION]", item.Destination);

                string textFFM = "";
                foreach (var itemf in ffmList) //555-92050641SVOTSE/T5K38MC0.53/COURIER CARGO/ XPS
                {
                    textFFM = textFFM + itemf.AwbSerialNumber + itemf.Origin + itemf.Destination+ "/T" + itemf.Pieces + "K" + itemf.Weight + "MC" + itemf.Volume + "/" + itemf.Goods + Environment.NewLine;
                    if (itemf.ShipmentDescriptionCode.Trim().Length > 0)
                    {
                        textFFM = textFFM + itemf.ShipmentDescriptionCode + Environment.NewLine;
                    }
                }

                text1 = text1.Replace("[text]", textFFM);
                text1 = text1 + "LAST";
                //Cақтаймыз
                SaveFFM(text1, "FFM2");

                //Жібереміз
                try
                {
                    FTPClient ftp = new FTPClient(_RemoteHostFids, _RemoteLoginFids, _RemotePasswordFids);
                    // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt");
                    string[] array1 = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.SND");
                    foreach (string name in array1)
                    {
                        Console.WriteLine(name);
                        byte pervyi = 1;
                        while (true)
                        {
                            try
                            {
                                ftp.UploadFile(name);
                                break;
                            }
                            catch (Exception e)
                            {
                                if (pervyi == 1)
                                {
                                    eventLog1.WriteEntry("Работа остановилась связи копированием " + e.ToString());
                                    pervyi = 2;
                                }
                                Thread.Sleep(10000);
                            }
                        }
                        if (pervyi == 2)
                            eventLog1.WriteEntry("Работа возобновилась");
                        File.Delete(name);
                    }

                }
                catch (IOException copyError)
                {
                    eventLog1.WriteEntry(copyError.Message);
                    throw;
                }

                XNamespace am = "http://www.sita.aero/ams6-xml-api-messages";
                XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes";
                XElement root = null;
                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", "Departure"),
                                    new XElement(ad + "AirlineDesignator", item.CIata, new XAttribute("codeContext", "IATA")),
                                    new XElement(ad + "FlightNumber", item.FlightNumber),
                                    new XElement(ad + "ScheduledDate", item.FlightSDO.ToString("yyyy-MM-dd")),
                                    new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA"))
                                    ),
                                new XElement(am + "FlightUpdates",
                                    new XElement(am + "Update", "True", new XAttribute("propertyName", "ffm_is_send"))
                                )
                            )
                        ));

                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("SEND Flight FFM: " + CsOG);
            b.CloseReader();
            this.timerKezegi = "FSULITE";
            // eventLog1.WriteEntry("SUCCESS Updated Send FFM");
        }
コード例 #6
0
        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");
        }
コード例 #7
0
        private void button1_Click(object sender, EventArgs e)
        {
            string _RemoteHost = "ftp://10.10.10.2/out/";
            string _RemoteLogin = "******";
            string _RemotePassword = "******";
            try
            {
                FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword);
                // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt");
                string[] array1 = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory,"*.SND");
                foreach (string name in array1)
                {
                    Console.WriteLine(name);
                    ftp.UploadFile(name);
                    File.Delete(name);
                }

            }
            catch (IOException copyError)
            {
                throw;
            }
        }
コード例 #8
0
        private void button6_Click(object sender, EventArgs e)
        {
            string _RemoteHost = "ftp://10.10.10.2/out/";
            string _RemoteLogin = "******";
            string _RemotePassword = "******";

            List<SelectedFlights> flightList = new List<SelectedFlights>();
            Broker b = new Broker();
            flightList = b.FillListBoxSelectedFlightsFFMfromAMS("FSULITE", 1);

            String CsOG = "";
            foreach (var item in flightList)
            {
                List<FFM> ffmList = new List<FFM>();
                ffmList = b.FillListBoxFFMfromAMS(item);

                //Толтырамыз
                string text1 = "=PRIORITY\nQU\n=DESTINATION TYPE B\nSTX,TSEAPXH\n=ORIGIN\nTSEDBXH\n= TEXT\nFFM/8\n1/PS102/27MAY1930/KBP/URGAU\nTSE\nLAST";
                text1 = text1.Replace("TSEAPXH", item.TypeBADDRESS);
                text1 = text1.Replace("PS102", item.FlightIdentifier);
                text1 = text1.Replace("27MAY", item.FlightSDO.ToString("ddMMM"));
                text1 = text1.Replace("1930", item.FlightSTO.ToString("HHmm"));
                text1 = text1.Replace("KBP", item.Destination);
                text1 = text1.Replace("KBP", item.Destination);
                text1 = text1.Replace("URGAU", item.Registration);

                string textFFM = "";
                foreach (var itemf in ffmList) //555-92050641SVOTSE/T5K38MC0.53/COURIER CARGO/ XPS
                {
                    textFFM = textFFM + itemf.AwbSerialNumber + item.Destination + "TSE/T" + itemf.Pieces + "K" + itemf.Weight + "MC" + itemf.Volume + "/" + itemf.Goods + "/" + itemf.ShipmentDescriptionCode + "\n";
                }

                text1 = text1.Insert(text1.IndexOf("TSE\n") + 4, textFFM);

                //Cақтаймыз
                SaveFFM(text1, "FFM2");

                //Жібереміз
                try
                {
                    FTPClient ftp = new FTPClient(_RemoteHost, _RemoteLogin, _RemotePassword);
                    // ftp.Download("LDM.txt", AppDomain.CurrentDomain.BaseDirectory + "LDM.txt");
                    string[] array1 = Directory.GetFiles(AppDomain.CurrentDomain.BaseDirectory, "*.SND");
                    foreach (string name in array1)
                    {
                        Console.WriteLine(name);
                        ftp.UploadFile(name);
                        File.Delete(name);
                    }

                }
                catch (IOException copyError)
                {
                    throw;
                }

                XNamespace am = "http://www.sita.aero/ams6-xml-api-messages";
                XNamespace ad = "http://www.sita.aero/ams6-xml-api-datatypes";
                XElement root = null;
                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", "Departure"),
                                    new XElement(ad + "AirlineDesignator", item.CIata, new XAttribute("codeContext", "IATA")),
                                    new XElement(ad + "FlightNumber", item.FlightIdentifier.Substring(2, item.FlightIdentifier.Length - 2)),
                                    new XElement(ad + "ScheduledDate", item.FlightSDO.ToString("yyyy-MM-dd")),
                                    new XElement(ad + "AirportCode", "TSE", new XAttribute("codeContext", "IATA"))
                                    ),
                                new XElement(am + "FlightUpdates",
                                    new XElement(am + "Update", "True", new XAttribute("propertyName", "ffm_is_send"))
                                )
                            )
                        ));

                //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("SEND Flight FFM: " + CsOG);
            b.CloseReader();
        }
コード例 #9
0
 private void button1_Click(object sender, EventArgs e)
 {
     FTPClient ftp = new FTPClient("ftp://192.168.2.213/", "loadxml", "asd123");
     ftp.Download("MVT.txt", AppDomain.CurrentDomain.BaseDirectory + "MVT.txt");
     Broker b = new Broker();
     listBox1.DataSource = b.FillListBox(textBox1.Text);
 }