//
        // GET: /MyReservations/
        public ActionResult MyReservations()
        {
            MY_RESERVATIONS myReserve = new MY_RESERVATIONS();

            myReserve.CUST_ID = SessionHandler.CurrentUser.UserID;
            return(View(myReserve.MyReservations()));
        }
Пример #2
0
        public IEnumerable <MY_RESERVATIONS> MyReservations(Guid custID)
        {
            SqlConnection con     = new SqlConnection(ConnectionString);
            string        command = "[dbo].[MY_RESRVATIONS_Details]";
            SqlCommand    cmd     = new SqlCommand(command, con);

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@CustID", SqlDbType.UniqueIdentifier).Value = custID;
            SqlDataReader reader;

            List <MY_RESERVATIONS> myreservationsList = new List <MY_RESERVATIONS>();

            try
            {
                con.Open();
                reader = cmd.ExecuteReader();

                while (reader.Read())
                {
                    MY_RESERVATIONS myreservations = new MY_RESERVATIONS();

                    myreservations.ARRIVAL_DATE   = Convert.ToDateTime(reader["ARRIVAL_DATE"].ToString());
                    myreservations.DEPARTURE_DATE = Convert.ToDateTime(reader["DEPARTURE_DATE"].ToString());
                    myreservations.ROOM_ID        = reader["ROOM_ID"].ToString();
                    myreservations.ROOM_TYPE      = reader["ROOM_TYPE"].ToString();
                    myreservations.DESCRIPTION    = reader["DESCRIPTION"].ToString();
                    myreservations.ROOM_PRICE     = Convert.ToDecimal(reader["ROOM_PRICE"]);
                    myreservations.MAX_GUEST      = Convert.ToDecimal(reader["MAX_GUEST"]);
                    myreservations.DISCOUNT       = Convert.ToDecimal(reader["DISCOUNT"]);
                    myreservations.ADVANCE        = Convert.ToDecimal(reader["ADVANCE"]);


                    myreservationsList.Add(myreservations);
                }
            }
            catch { throw; }

            reader.Close();
            con.Close();
            return(myreservationsList);
        }