Example #1
0
        public static List <Passanger> PoiskVsexPasagirov(string nomer)
        {
            Passanger        pas; Bilet bil;
            XmlDocument      Doc = new XmlDocument();
            List <Passanger> passangers_for_current_train = new List <Passanger>();

            Doc.Load("Passanger.xml");
            XmlElement Root = Doc.DocumentElement;
            string     n = "", s = "", nomer_poezda = "", nomer_vagona = "", mesto_nomer = "", mesto_bukva = "";

            foreach (XmlNode node in Root)
            {
                foreach (XmlNode childnode in node.ChildNodes)
                {
                    if (childnode.Name == "info")
                    {
                        string[] info = childnode.InnerText.Split(' ');
                        n = info[1]; s = info[0]; nomer_poezda = info[2]; nomer_vagona = info[3]; mesto_nomer = info[4]; mesto_bukva = info[5];
                    }
                }
                if (nomer == nomer_poezda)
                {
                    bil = new Bilet(nomer_poezda, nomer_vagona, mesto_nomer, mesto_bukva);
                    bilets.Add(bil);
                    pas = new Passanger(n, s, nomer_poezda, bilets);
                    passangers_for_current_train.Add(pas);
                }
            }
            return(passangers_for_current_train);
        }
Example #2
0
        public static List<Passanger> PoiskVsexPasagirov(string nomer)
        {
            Passanger pas; Bilet bil;
            XmlDocument Doc = new XmlDocument();
            List<Passanger> passangers_for_current_train = new List<Passanger>();
            Doc.Load("Passanger.xml");
            XmlElement Root = Doc.DocumentElement;
            string n = "", s = "", nomer_poezda = "", nomer_vagona = "", mesto_nomer = "", mesto_bukva = "";
            foreach (XmlNode node in Root)
            {
                foreach (XmlNode childnode in node.ChildNodes)
                {
                    if (childnode.Name == "info")
                    {
                        string[] info = childnode.InnerText.Split(' ');
                        n = info[1]; s = info[0]; nomer_poezda = info[2]; nomer_vagona = info[3]; mesto_nomer = info[4]; mesto_bukva = info[5];
                    }
                }
                if (nomer == nomer_poezda)
                {
                    bil = new Bilet(nomer_poezda, nomer_vagona, mesto_nomer, mesto_bukva);
                    bilets.Add(bil);
                    pas = new Passanger(n, s, nomer_poezda, bilets);
                    passangers_for_current_train.Add(pas);

                }

            }
            return passangers_for_current_train;
        }
Example #3
0
 void Add_passanger()
 {
     Bilet bil; Passanger pas;
     string surname = textBox5.Text, name = textBox6.Text, nomer = comboBox5.Text, vagon = comboBox6.Text, n_mesta = comboBox7.Text, b_mesta = comboBox8.Text;
     bil = new Bilet(nomer, vagon, n_mesta, b_mesta);
     Glades.bilets.Add(bil);
     pas = new Passanger(name, surname, nomer, Glades.bilets);
     for (int i = 0; i < Glades.trains.Count; i++)
     {
         if (nomer == Glades.trains[i].Nomer)
             Glades.trains[i].passanger.Add(pas);
     }
 }
Example #4
0
        void Add_passanger()
        {
            Bilet  bil; Passanger pas;
            string surname = textBox5.Text, name = textBox6.Text, nomer = comboBox5.Text, vagon = comboBox6.Text, n_mesta = comboBox7.Text, b_mesta = comboBox8.Text;

            bil = new Bilet(nomer, vagon, n_mesta, b_mesta);
            Glades.bilets.Add(bil);
            pas = new Passanger(name, surname, nomer, Glades.bilets);
            for (int i = 0; i < Glades.trains.Count; i++)
            {
                if (nomer == Glades.trains[i].Nomer)
                {
                    Glades.trains[i].passanger.Add(pas);
                }
            }
        }
Example #5
0
 private void Receive_data2_Click(object sender, EventArgs e)
 {
     Passanger passanger = new Passanger();
     string str1 = textBox1.Text;
     string str2 = textBox6.Text;
     string str3 = textBox5.Text;
     List<string> collection = new List<string>();
     bool flag = true;
     if ((str1 == "") && (str2 == ""))
     {
         flag = false;
         collection = Passanger.PoiskVsexPasagirov();
         for (int i = 0; i < collection.Count; i++)
         {
             Vivod_data.Items.Add(collection[i]);
         }
     }
     if (flag == true)
     {
         string str_ob = str1 + " " + str2;
         collection = Passanger.PoiskPasagirov(str_ob);
         if (collection[0].Contains("null"))
         {
             MessageBox.Show("Таких пассажиров нет");
             Vivod_data.Items.Add("Таких пассажиров нет");
         }
         else
         {
             for (int i = 0; i < collection.Count; i++)
             {
                 Vivod_data.Items.Add(collection[i]);
             }
         }
     }
     MMT.Visible = true;
     Vivod_data.Visible = true;
 }