Exemplo n.º 1
0
        private void addEdge(Queue <AddDistance> queue, int src, int dst, int weight)
        {
            AddDistance a = new AddDistance(), b = new AddDistance();

            a.stationone = b.stationtwo = src;
            a.stationtwo = b.stationone = dst;
            a.distance   = b.distance = weight;
            queue.Enqueue(a);
            queue.Enqueue(b);
        }
Exemplo n.º 2
0
        private void Add_Click(object sender, EventArgs e)
        {
            AddDistance a = new AddDistance();

            a.stationone = Convert.ToInt32(loc1.SelectedValue);
            a.stationtwo = Convert.ToInt32(Loc2.SelectedValue);
            a.distance   = Convert.ToInt32(Text_distance.Text);
            addDes.Enqueue(a);
            Text_distance.Text = "";
        }
Exemplo n.º 3
0
        private void Add_All_Click(object sender, EventArgs e)
        {
            while (addDes.Count > 0)
            {
                AddDistance a = new AddDistance();
                a = addDes.Dequeue();
                Tbdistances stationDistance = new Tbdistances();
                stationDistance.station1id = a.stationone;
                stationDistance.station2id = a.stationtwo;
                stationDistance.distance   = a.distance;

                db.stationDistances.Add(stationDistance);
                db.SaveChanges();
            }
        }
Exemplo n.º 4
0
        private void Add_All_Click(object sender, EventArgs e)
        {
            while (addDes.Count > 0)
            {
                AddDistance a = new AddDistance();
                a = addDes.Dequeue();
                StationDistance stationDistance = new StationDistance();
                stationDistance.Distance1 = a.stationone;
                stationDistance.Distance2 = a.stationtwo;
                stationDistance.Distance  = a.distance;

                db.stationDistances.Add(stationDistance);
                db.SaveChanges();
            }
            updateStatus();
        }