public static List <Room> GetRooms(string ServiceYesOrNo, string service, DateTime usrADate, DateTime usrLDate)
        {
            List <Room>    rooms    = new List <Room>();
            List <Booking> bookings = DalManager.GetRoomInUse(ServiceYesOrNo, usrADate, usrLDate);

            string contentsFromRoomUse = "";

            foreach (Booking item in bookings)
            {
                contentsFromRoomUse = contentsFromRoomUse + "Room.RoomNo <> " + item.RoomNo;
            }

            using (SqlConnection connection = new SqlConnection(DBconnection.connect("LandLystDB")))
            {
                SqlCommand cmd;
                connection.Open();
                if (ServiceYesOrNo == "ja")
                {
                    cmd = new SqlCommand($@"
                    select dbo.RoomServices.RoomNo, dbo.Room.Price from dbo.Room
                    join dbo.RoomServices
                    on dbo.Room.RoomNo = dbo.RoomServices.RoomNo
                    where dbo.RoomServices.SerName = '{service}' and dbo.Room.Cleaned = 'true' and {contentsFromRoomUse};", connection);
                }
                else
                {
                    cmd = new SqlCommand($@"
                    select RoomNo, Price from dbo.Room
                    where dbo.Room.Cleaned = 'true' and {contentsFromRoomUse};", connection);
                }

                SqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    // RoomNo, Price
                    int roomNo = (int)dataReader["RoomNo"];
                    int price  = (int)dataReader["Price"];

                    Room room = new Room()
                    {
                        RoomNo = roomNo, Price = price
                    };

                    rooms.Add(room);
                }
            }
            return(rooms);
        }
Example #2
0
 public static void SetBookings(DateTime checkIn, DateTime checkOut, int guestsId, int roomNo)
 {
     DalManager.SetBookings(checkIn, checkOut, guestsId, roomNo);
 }
Example #3
0
 public static void SetGuests(string foreName, string lastName, string address, string email, int telephoneNo, int zipCode)
 {
     DalManager.SetGuests(foreName, lastName, address, email, telephoneNo, zipCode);
 }
Example #4
0
 public static List <TotalAmount> GetServicePrice(int roomNo)
 {
     return(DalManager.GetServicesPrice(roomNo));
 }
Example #5
0
 public static List <Room> GetRooms(string ServiceYesOrNo, string service, DateTime usrADate, DateTime usrLDate)
 {
     return(DalManager.GetRooms(ServiceYesOrNo, service, usrADate, usrLDate));
 }
Example #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("// START");
            Console.WriteLine("Hvad er din forenavn");
            string fisteName = Console.ReadLine();

            Console.WriteLine("Hvad er din efternavn");
            string lastName = Console.ReadLine();

            Console.WriteLine("Hvad er din Addrese");
            string adderss = Console.ReadLine();

            Console.WriteLine("Hvad er din e-mail");
            string mail = Console.ReadLine();

            Console.WriteLine("Hvad er din telefonNo");
            int telefonNo = int.Parse(Console.ReadLine());

            Console.WriteLine("Hvad er din postnr");
            int zipCode = int.Parse(Console.ReadLine());

            HotelManager.SetGuests(fisteName, lastName, adderss, mail, telefonNo, zipCode);

            Console.WriteLine("vil du have en særlid service : ja|nej");
            string usrServiceYesOrNo = Console.ReadLine();
            string usrService        = "";

            if (usrServiceYesOrNo == "ja")
            {
                Console.WriteLine("hvilken service vil du have: ");
                usrService = Console.ReadLine();
            }

            Console.WriteLine("hvilken dato for ankomst :");
            DateTime usrADate = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("hvilken hjem dato :");
            DateTime usrLDate = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("hvilken kunde numer :");
            int usrCustomerNo = Int32.Parse(Console.ReadLine());

            List <Room> rooms = HotelManager.GetRooms(usrServiceYesOrNo, usrService, usrADate, usrLDate);

            Console.WriteLine("Room No | Price");
            foreach (Room item in rooms)
            {
                Console.WriteLine("  " + item.RoomNo + "       " + item.Price);
            }

            Console.WriteLine("hvilken vælget værlse :");
            int usrRoomNo = Int32.Parse(Console.ReadLine());

            DalManager.SetBookings(usrADate, usrLDate, usrCustomerNo, usrRoomNo);


            Console.WriteLine("den samlet pris er : ");
            TotalAmount totalAmount = new TotalAmount();

            Console.WriteLine(totalAmount.Percentage(usrADate, usrLDate, usrRoomNo));

            Console.WriteLine("// S**T");
            Console.ReadKey();
        }