Beispiel #1
0
        public ElevatorDbContext()
        {
            if (this.Elevators.Count() == 0)
            {
                Elevator elevator1 = new Elevator {
                    ID = 1, CurrentFloor = 10, Location = "NE", SerialNumber = "12345"
                };
                Elevator elevator2 = new Elevator {
                    ID = 2, CurrentFloor = 2, Location = "NW", SerialNumber = "67890"
                };
                Elevator elevator3 = new Elevator {
                    ID = 3, CurrentFloor = 3, Location = "E", SerialNumber = "02468"
                };
                this.Elevators.Add(elevator1);
                this.Elevators.Add(elevator2);
                this.Elevators.Add(elevator3);

                FloorCall call1 = new FloorCall {
                    ID = 1, Floor = 9, Up = true
                };
                FloorCall call2 = new FloorCall {
                    ID = 1, Floor = 3, Up = true, Down = true
                };
                this.FloorCalls.Add(call1);
                this.FloorCalls.Add(call2);

                ElevatorControlSystem system = new ElevatorControlSystem();
                system.UpQueue = new List <Elevator>();
                system.UpQueue.Add(elevator2);
                system.DownQueue = new List <Elevator>();
                system.DownQueue.Add(elevator1);
                system.FloorCalls = new List <FloorCall>();
                system.FloorCalls.Add(call1);
                system.FloorCalls.Add(call2);
                this.ElevatorControlSystems.Add(system);

                this.SaveChanges();
            }
        }
Beispiel #2
0
        public ElevatorDbContext()
        {
            if (this.Elevators.Count() == 0)
            {
                Elevator elevator1 = new Elevator { ID = 1, CurrentFloor = 10, Location = "NE", SerialNumber = "12345" };
                Elevator elevator2 = new Elevator { ID = 2, CurrentFloor = 2, Location = "NW", SerialNumber = "67890" };
                Elevator elevator3 = new Elevator { ID = 3, CurrentFloor = 3, Location = "E", SerialNumber = "02468" };
                this.Elevators.Add(elevator1);
                this.Elevators.Add(elevator2);
                this.Elevators.Add(elevator3);

                FloorCall call1 = new FloorCall { ID = 1, Floor = 9, Up = true };
                FloorCall call2 = new FloorCall { ID = 1, Floor = 3, Up = true, Down = true };
                this.FloorCalls.Add(call1);
                this.FloorCalls.Add(call2);

                ElevatorControlSystem system = new ElevatorControlSystem();
                system.UpQueue = new List<Elevator>();
                system.UpQueue.Add(elevator2);
                system.DownQueue = new List<Elevator>();
                system.DownQueue.Add(elevator1);
                system.FloorCalls = new List<FloorCall>();
                system.FloorCalls.Add(call1);
                system.FloorCalls.Add(call2);
                this.ElevatorControlSystems.Add(system);

                this.SaveChanges();
            }
        }