コード例 #1
0
        /// <summary>
        /// Returns as object for BookingID class type, and serializes it to URL format.
        /// </summary>
        public static object SerializeURLformatWithBookID(int bookingid, string firstname, string lastname, int totalprice, bool depositpaid, Bookingdates bookingdates)
        {
            string checkindate  = bookingdates.checkin.Year.ToString() + "-" + ((bookingdates.checkin.Month.ToString().Length > 1) ? bookingdates.checkin.Month.ToString() : "0" + bookingdates.checkin.Month.ToString()) + "-" + ((bookingdates.checkin.Day.ToString().Length > 1) ? bookingdates.checkin.Day.ToString() : "0" + bookingdates.checkin.Day.ToString());
            string checkoutdate = bookingdates.checkout.Year.ToString() + "-" + ((bookingdates.checkin.Month.ToString().Length > 1) ? bookingdates.checkin.Month.ToString() : "0" + bookingdates.checkin.Month.ToString()) + "-" + ((bookingdates.checkout.Day.ToString().Length > 1) ? bookingdates.checkout.Day.ToString() : "0" + bookingdates.checkout.Day.ToString());

            return($"bookingid=" + bookingid.ToString() + "&booking%5Bfirstname%5D=" + firstname + "&booking%5Blastname%5D=" + lastname + "&booking%5Btotalprice%5D=" + totalprice.ToString() + "&booking%5Bdepositpaid%5D=" + depositpaid.ToString().ToLowerInvariant() + "&booking%5Bbookingdates%5D%5Bcheckin%5D=" + checkindate + "&booking%5Bbookingdates%5D%5Bcheckout%5D=" + checkoutdate);
        }
コード例 #2
0
 /// <summary>
 /// Create Booking data.
 /// </summary>
 /// <param name="firstName">First name.</param>
 /// <param name="lastName">Last name.</param>
 /// <param name="price">Price.</param>
 /// <param name="paid">Paid.</param>
 /// <param name="bookingDates">Booking dates.</param>
 /// <param name="notes">Additional notes.</param>
 /// <returns>Booking object.</returns>
 protected Booking CreateBookingData(string firstName, string lastName, int price, bool paid, Bookingdates bookingDates, string notes)
 {
     return(new Booking()
     {
         firstname = firstName, lastname = lastName, totalprice = price, depositpaid = paid, bookingdates = bookingDates, additionalneeds = notes
     });
 }