示例#1
0
文件: Glades.cs 项目: Bushin/Poezd
        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);
        }
示例#2
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);
                }
            }
        }