示例#1
0
        public static List <TotalAmount> GetServicesPrice(int roomNumber)
        {
            List <TotalAmount> amounts = new List <TotalAmount>();

            using (SqlConnection connection = new SqlConnection(DBconnection.connect("LandLystDB")))
            {
                connection.Open();

                SqlCommand    cmd        = new SqlCommand($@"
                select HotelServices.Price from HotelServices
                join RoomServices
                on dbo.RoomServices.SerName = dbo.HotelServices.ServiceName
                where dbo.RoomServices.RoomNo = {roomNumber};", connection);
                SqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    int servicePrice = (int)dataReader["Price"];

                    TotalAmount totalAmount = new TotalAmount()
                    {
                        ServicePrice = servicePrice
                    };

                    amounts.Add(totalAmount);
                }
            }
            return(amounts);
        }
示例#2
0
        protected void ButtonSaveBooking_Click(object sender, EventArgs e)
        {
            #region SetGuests with variabler (OUT COMMENTE)
            //string fisteName = TextBoxFistName.Text;
            //string lastName = TextBoxLastName.Text;
            //string adderss = "JVej no. 8";
            //string mail = TextBoxMail.Text;
            //int telefonNo = Convert.ToInt32(TextBoxPhoneNo.Text);
            //int zipCode = 4800;
            //HotelManager.SetGuests(fisteName, lastName, adderss, mail, telefonNo, zipCode);
            #endregion


            DateTime ArrivalDate = DateTime.Parse(TextBoxArrivalDate.Text);
            DateTime levingDate  = DateTime.Parse(TextBoxLevingDate.Text);

            int usrRoomChoose = int.Parse(TextBoxRoompicking.Text);



            #region SetBooking
            DalManager.SetBookings(ArrivalDate, levingDate, int.Parse(TextBoxGuestsId.Text), usrRoomChoose); // manglier noget til vælge brugene
            #endregion

            #region TotalAmount
            TotalAmount totalAmount = new TotalAmount();
            LabelPrice.Text = totalAmount.Percentage(ArrivalDate, levingDate, usrRoomChoose).ToString();
            #endregion
        }
示例#3
0
        public static List <TotalAmount> GetRoomPrice(int roomNumber)
        {
            List <TotalAmount> amounts = new List <TotalAmount>();

            using (SqlConnection connection = new SqlConnection(DBconnection.connect("LandLystDB")))
            {
                connection.Open();
                SqlCommand cmd = new SqlCommand($@"select Room.Price from Room
                where RoomNo = {roomNumber}", connection);

                SqlDataReader dataReader = cmd.ExecuteReader();

                while (dataReader.Read())
                {
                    int roomPrice = (int)dataReader["Price"];

                    TotalAmount totalAmount = new TotalAmount()
                    {
                        RoomPrice = roomPrice
                    };

                    amounts.Add(totalAmount);
                }
            }
            return(amounts);
        }