public OrderSchemeClass GetOrderSchemeByStation(Stantion station) { if (this.Station1.Id == station.Id) { return(orderScheme1); } if (this.Station2.Id == station.Id) { return(orderScheme2); } throw new Exception("No this station in this pair!"); }
public void AddStation(Stantion station) { if (Station1 == null) { Station1 = station; this.orderScheme1.УникальныйИдентификаторСтанции = station.Id; } else { Station2 = station; this.orderScheme2.УникальныйИдентификаторСтанции = station.Id; } }
private OrderSchemeClass GetOrderSheme() { var stantion = new Stantion(); var freePair = this.OrderSchemePairs.FirstOrDefault(s => s.IsFree); if (freePair == null) { var wave1 = GetRandomWave(0); var wave2 = GetRandomWave(wave1); var privateName1 = GetRandomPrivateName(0); var privateName2 = GetRandomPrivateName(privateName1); freePair = new OrderSchemePair(wave1, wave2, CircularName, CircularPrivateName, privateName1, privateName2); this.OrderSchemePairs.Add(freePair); } freePair.AddStation(stantion); return(freePair.GetOrderSchemeByStation(stantion)); }