Example #1
0
        /// <summary>
        ///     Books the suite.
        /// </summary>
        /// <param name="tempSuite">The temporary suite.</param>
        /// <param name="checkInDate">The check in date.</param>
        /// <param name="daysToStay">The days to stay.</param>
        /// <param name="fullName">The full name.</param>
        /// <param name="gender">The gender.</param>
        /// <param name="telephone">The telephone.</param>
        /// <param name="email">The email.</param>
        /// <param name="adress">The adress.</param>
        /// <param name="city">The city.</param>
        /// <param name="state">The state.</param>
        /// <param name="zipcode">The zipcode.</param>
        /// <param name="breakfast">if set to <c>true</c> [breakfast].</param>
        /// <returns><c>True</c> if sucess.</returns>
        public static bool BookSuite(Suite tempSuite, string checkInDate, string daysToStay, string fullName, string gender,
                                     string telephone, string email, string adress, string city, string state, string zipcode,
                                     bool breakfast)
        {
            var db = new HotelDataDataContext();

            DateTime checkIn;
            DateTime.TryParse(checkInDate, out checkIn);

            DateTime checkOut = checkIn.AddDays(Convert.ToInt32(daysToStay));

            try
            {
                var booking = new Booking
                              {
                                  SuiteNumber = tempSuite.SuiteNumber,
                                  StartDate = checkIn,
                                  EndDate = checkOut,
                                  Name = fullName,
                                  Telephone = telephone,
                                  Email = email,
                                  Adress = adress,
                                  City = city,
                                  State = state,
                                  ZipCode = zipcode,
                                  Breakfast = breakfast
                              };

                db.Bookings.InsertOnSubmit(booking);
                db.SubmitChanges();
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
Example #2
0
 partial void UpdateBooking(Booking instance);
Example #3
0
 partial void DeleteBooking(Booking instance);
Example #4
0
 partial void InsertBooking(Booking instance);