public List<Booking> GetOccupants(string userInput, DateTime todaysDate)
        {
            List<Booking> listCurrentOccupants = null;

            //RoomType roomType = null;
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@UserInput", userInput),
                new SqlParameter("@TodaysDate", todaysDate)
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetCurrentOccupants", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    listCurrentOccupants = new List<Booking>();
                    foreach (DataRow row in table.Rows)
                    {
                        Booking booking = new Booking();
                        booking.BookingID = Convert.ToInt32(row["BookingID"]);
                        booking.ArriveDate = Convert.ToDateTime(row["ArriveDate"]);
                        booking.DepartDate = Convert.ToDateTime(row["DepartDate"]);
                        booking.FullName = Convert.ToString(row["FullName"]);
                        booking.RoomsBooked = Convert.ToString(row["RoomsBooked"]);
                        booking.MemberID = Convert.ToInt32(row["MemberID"]);

                        listCurrentOccupants.Add(booking);
                    }
                }
            }
            return listCurrentOccupants;
        }
        public IHttpActionResult PostBooking(Booking booking)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            repository.AddBooking(booking);

            return CreatedAtRoute("DefaultApi", new { id = booking.Id }, booking);
        }
        public bool UpdateProofOfPayment(Booking booking)
        {
            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@BookingID", booking.BookingID),
                new SqlParameter("@ProofOfPayment", booking.ProofOfPayment)
            };

            return DBHelper.ExecuteNonQuery("sp_UpdateProofOfPayment", CommandType.StoredProcedure, parameters);
        }
        public List<Booking> GetBookingHistory(int memberID)
        {
            List<Booking> bookingHistory = null;

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@MemberID", memberID)
            };

            using (DataTable table = DBHelper.ExecuteParamerizedSelectCommand("sp_GetBookingHistory", CommandType.StoredProcedure, parameters))
            {
                if (table.Rows.Count > 0)
                {
                    bookingHistory = new List<Booking>();
                    foreach (DataRow row in table.Rows)
                    {
                        Booking booking = new Booking();
                        booking.BookingID = Convert.ToInt32(row["BookingID"]);
                        booking.ArriveDate = Convert.ToDateTime(row["ArriveDate"]);
                        booking.DepartDate = Convert.ToDateTime(row["DepartDate"]);
                        booking.ProofOfPayment = row["ProofOfPayment"].ToString();
                        booking.Status = row["Status"].ToString();
                        bookingHistory.Add(booking);
                    }
                }
            }
            return bookingHistory;
        }
Example #5
0
 public Booking()
 {
     d_Booking = new DAL.Booking();
 }