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); }
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 = ""; }
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(); } }
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(); }