Exemple #1
0
 private void maingrid_CurrentCellChanged(object sender, EventArgs e)
 {
     try
     {
         MyTrain clicktonumber = maingrid.CurrentRow.DataBoundItem as MyTrain;
         textbox_clicknumber.Text = clicktonumber.trainname.ToString();
     }
     catch (Exception)
     {
     }
 }
Exemple #2
0
        public static void Find(string box1, string box2)
        {
            Search.Clear();


            try
            {
                string   trainOutput   = File.ReadAllText(@"./Trains.xml");
                XElement trainXElement = XElement.Parse(trainOutput);
                foreach (var item in trainXElement.Descendants("train"))
                {
                    int    temptrainnumber = int.Parse(item.Element("trainnumber").Value);
                    string temptrainname   = item.Element("trainname").Value;
                    string tempstartroute  = item.Element("startroute").Value;
                    string tempendroute    = item.Element("endroute").Value;
                    string tempstarttime   = item.Element("starttime").Value;
                    string tempendtime     = item.Element("endtime").Value;
                    int    temppay         = int.Parse(item.Element("pay").Value);



                    if (tempstartroute == box1 && tempendroute == box2)
                    {
                        MyTrain search = new MyTrain()
                        {
                            trainnumber = temptrainnumber,
                            trainname   = temptrainname,
                            startroute  = tempstartroute,
                            endroute    = tempendroute,
                            starttime   = tempstarttime,
                            endtime     = tempendtime,
                            pay         = temppay
                        };

                        Search.Add(search);
                    }
                }
            }
            catch (Exception excp)
            {
            }
        }
Exemple #3
0
        public static void Load()
        {
            try
            {
                string   trainOutput   = File.ReadAllText(@"./Trains.xml");
                XElement trainXElement = XElement.Parse(trainOutput);
                foreach (var item in trainXElement.Descendants("train"))
                {
                    int    temptrainnumber = int.Parse(item.Element("trainnumber").Value);
                    string temptrainname   = item.Element("trainname").Value;
                    string tempstartroute  = item.Element("startroute").Value;
                    string tempendroute    = item.Element("endroute").Value;
                    string tempstarttime   = item.Element("starttime").Value;
                    string tempendtime     = item.Element("endtime").Value;
                    int    temppay         = int.Parse(item.Element("pay").Value);



                    MyTrain tempTrain = new MyTrain()
                    {
                        trainnumber = temptrainnumber,
                        trainname   = temptrainname,
                        startroute  = tempstartroute,
                        endroute    = tempendroute,
                        starttime   = tempstarttime,
                        endtime     = tempendtime,
                        pay         = temppay
                    };

                    Trains.Add(tempTrain);
                }
            }
            catch (Exception excp)
            {
            }
        }