public AccomodationManagementViewModel()
        {
            _accomodationRepository = DataManagementService.Instance.MainRepository.AccomodationRepository;
            _locationRepository     = DataManagementService.Instance.MainRepository.LocationRepository;

            _accomodationFactory  = new AccomodationFactory();
            _accomodation         = _accomodationFactory.BuildAccomodation(_acomodationType);
            _selectedAccomodation = _accomodationFactory.BuildAccomodation(_acomodationType);

            _roomFactory  = new RoomFactory();
            _room         = _roomFactory.BuildRoom(_roomType);
            _selectedRoom = _roomFactory.BuildRoom(_roomType);

            _addAccomodationCommand    = new AddAccomodationCommand(this);
            _deleteAccomodationCommand = new DeleteAccomodationCommand(this);
            _editAccomodationCommand   = new EditAccomodationCommand(this);
            _saveAccomodationCommand   = new SaveAccomodationCommand(this);
            _addRoomCommand            = new AddRoomCommand(this);
            _editRoomCommand           = new EditRoomCommand(this);
            _saveRoomCommand           = new SaveRoomCommand(this);
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            string defFilePath = args[0];

            if (IsPathValid(defFilePath))
            {
                try
                {
                    string[] lines = File.ReadAllLines(defFilePath);

                    BoardFactory brdFactory = new BoardFactory();
                    Board        board      = brdFactory.BuildBoard(lines[0]);

                    RoomFactory rmFactory = new RoomFactory();
                    for (int w = 0; w <= board.Width - 1; w++)
                    {
                        for (int h = 0; h <= board.Height - 1; h++)
                        {
                            Room rm = rmFactory.BuildRoom(w, h);
                            board.Rooms.Add(rm);
                        }
                    }

                    MirrorFactory mrFactory = new MirrorFactory();
                    int           i         = 2;
                    string        line      = lines[i];
                    while (line != "-1")
                    {
                        Mirror mirror = mrFactory.BuildMirror(line);
                        i++;
                        line = lines[i];
                        board.AddMirror(mirror);
                    }

                    LaserFactory laserFactory = new LaserFactory();
                    Laser        laser        = laserFactory.BuildLaser(lines[lines.Count() - 2]);

                    board.SetLaserDirection(laser);
                    string exitConditions = board.FindExit(laser);

                    Console.WriteLine($" Dimensions of Board: {board.Width}, {board.Height}\n Laser Starting Position {laser.XLoc}, {laser.YLoc}\n Laser Exit is at {exitConditions}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine($"Error Occurred! Exception: {ex.Message} \nStackTrace\n: {ex.StackTrace}");
                }
            }
            else
            {
                Console.WriteLine("File is not found or is invalid. Please select a new file.");
            }
        }
Esempio n. 3
0
        public BookingViewModel()
        {
            _accomodationList      = DataManagementService.Instance.MainRepository.AccomodationRepository.AccomodationList;
            _locationList          = DataManagementService.Instance.MainRepository.LocationRepository.LocationList;
            _reservationRepository = DataManagementService.Instance.MainRepository.ReservationRepository;

            _reservation      = new Reservation();
            _selectedLocation = new Location();
            _selectedOption   = new Option();
            _availableOptions = new ObservableCollection <Option>();

            _roomsToReserve = new ObservableCollection <IRoom>();
            _roomFactory    = new RoomFactory();
            _selectedRoom   = _roomFactory.BuildRoom(_roomType);

            _checkAvailabilityCommand    = new CheckAvailabilityCommand(this);
            _showBookingVoucherCommand   = new ShowBookingVoucherCommand(this);
            _getCustomerInfoCommand      = new GetCustomerInfoCommand(this);
            _newCustomerCommand          = new EmptyCustomerFieldsCommand(this);
            _addRoomToReservationCommand = new AddRoomToReservationCommand(this);
        }
 public void ClearRoomFields()
 {
     Room = _roomFactory.BuildRoom(_roomType);
 }