当前位置: 首页>>代码示例>>C#>>正文


C# Booking类代码示例

本文整理汇总了C#中Booking的典型用法代码示例。如果您正苦于以下问题:C# Booking类的具体用法?C# Booking怎么用?C# Booking使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Booking类属于命名空间,在下文中一共展示了Booking类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddEditBooking_Load

        private void AddEditBooking_Load(object sender, EventArgs e)
        {
            var unitOfWork = new UnitOfWork();

            cbType.DataSource = unitOfWork.BookingClassificationRepository.Get().ToList();
            cbType.DisplayMember = "ClassificationName";
            cbType.ValueMember = "Id";
            var startDate = DateTime.Today;
            startDate.AddSeconds(-startDate.Second);
            startDate.AddMinutes(-startDate.Minute);
            dtpBookingTime.Value = startDate;

            if (currentBookingID != null)
            {
                currentBooking = unitOfWork.BookingRepository.Get(null, null, "Employee,BookingClasification,BookingNotes").Where(x => x.Id == currentBookingID).FirstOrDefault();
                btnSave.Text = "Save Changes";
                dtpBookingTime.Value = currentBooking.BookingDate;
                tbName.Text = currentBooking.Name;
                tbContactNumber.Text = currentBooking.ContactNumber;
                tbEmail.Text = currentBooking.Email;

                cbType.SelectedValue = currentBooking.BookingClasification.Id;
                newbookingNotes = currentBooking.BookingNotes.Where(x => x.DateInactive == null).ToList();
            }
            RebindNotes();
        }
开发者ID:tsunamisukoto,项目名称:Book-A-Majig2,代码行数:26,代码来源:AddEditBooking.cs

示例2: AddBooking

        public Booking AddBooking(Booking booking)
        {
            Bookings.Add(booking);
            SaveChanges();

            return booking;
        }
开发者ID:stefanidi,项目名称:NineITBookingAppByRomanStefanidi,代码行数:7,代码来源:BookingContext.cs

示例3: setup

		private async void setup()
		{
			Functions functions = new Functions();
			JsonValue list = await functions.getBookings (this.Student.StudentID.ToString());
			JsonValue results = list ["Results"];
			tableItems = new List<Booking>();
			if (list ["IsSuccess"]) {
				for (int i = 0; i < results.Count; i++) {
					if (DateTime.Parse (results [i] ["ending"]) < DateTime.Now) {
						Booking b = new Booking (results [i]);
						if (b.BookingArchived == null) {
							tableItems.Add (b);
						}
					}
				}
				tableItems.Sort((x, y) => DateTime.Compare(x.StartDate, y.StartDate));
				this.TableView.ReloadData ();
			} else {
				createAlert ("Timeout expired", "Please reload view");
			}
			if (tableItems.Count == 0) {
				createAlert ("No Bookings", "You do not have any past bookings");

			}
		}
开发者ID:SDP2015Group7,项目名称:HELPSMobile,代码行数:25,代码来源:HistoryTableViewController.cs

示例4: Book

        public IView Book(int roomId, DateTime startDate, DateTime endDate, string comments)
        {
            this.Authorize(Roles.User, Roles.VenueAdmin);
            var room = this.Data.RepositoryWithRooms.Get(roomId);
            if (room == null)
            {
                return this.NotFound(string.Format("The room with ID {0} does not exist.", roomId));
            }

            if (startDate > endDate)
            {
                throw new ArgumentException("The date range is invalid.");
            }

            var availablePeriod = room.AvailableDates.FirstOrDefault(d => d.StartDate <= startDate || d.EndDate >= endDate);
            if (availablePeriod == null)
            {
                throw new ArgumentException(string.Format("The room is not available to book in the period {0:dd.MM.yyyy} - {1:dd.MM.yyyy}.", startDate, endDate));
            }

            decimal totalPrice = (endDate - startDate).Days * room.PricePerDay;
            var booking = new Booking(this.CurrentUser, startDate, endDate, totalPrice, comments);

            room.Bookings.Add(booking);
            this.CurrentUser.Bookings.Add(booking);
            this.UpdateRoomAvailability(startDate, endDate, room, availablePeriod);

            return this.View(booking);
        }
开发者ID:exploitx3,项目名称:HighQualityCode,代码行数:29,代码来源:RoomsController.cs

示例5: Invoice

 public Invoice(int invoice_id, int entity_id, int invoice_type_id, int booking_id, int payer_organisation_id, int payer_patient_id, int non_booking_invoice_organisation_id, string healthcare_claim_number, int reject_letter_id, string message,
                int staff_id, int site_id, DateTime invoice_date_added, decimal total, decimal gst, decimal receipts_total, decimal vouchers_total, decimal credit_notes_total, decimal refunds_total,
                bool is_paid, bool is_refund, bool is_batched, int reversed_by, DateTime reversed_date, DateTime last_date_emailed)
 {
     this.invoice_id              = invoice_id;
     this.entity_id               = entity_id;
     this.invoice_type            = new IDandDescr(invoice_type_id);
     this.booking                 = booking_id            == -1 ? null : new Booking(booking_id);
     this.payer_organisation      = payer_organisation_id ==  0 ? null : new Organisation(payer_organisation_id);
     this.payer_patient           = payer_patient_id      == -1 ? null : new Patient(payer_patient_id);
     this.non_booking_invoice_organisation = non_booking_invoice_organisation_id == -1 ? null : new Organisation(non_booking_invoice_organisation_id);
     this.healthcare_claim_number = healthcare_claim_number;
     this.reject_letter           = reject_letter_id      == -1 ? null : new Letter(reject_letter_id);
     this.message                 = message;
     this.staff                   = new Staff(staff_id);
     this.site                    = site_id               == -1 ? null : new Site(site_id);
     this.invoice_date_added      = invoice_date_added;
     this.total                   = total;
     this.gst                     = gst;
     this.receipts_total          = receipts_total;
     this.vouchers_total          = vouchers_total;
     this.credit_notes_total      = credit_notes_total;
     this.refunds_total           = refunds_total;
     this.is_paid                 = is_paid;
     this.is_refund               = is_refund;
     this.is_batched              = is_batched;
     this.reversed_by             = reversed_by == -1 ? null : new Staff(reversed_by);
     this.reversed_date           = reversed_date;
     this.last_date_emailed       = last_date_emailed;
 }
开发者ID:nblaurenciana-md,项目名称:Websites,代码行数:30,代码来源:Invoice.cs

示例6: Update

        /// <summary>
        /// Update an existing Booking entry.
        /// </summary>
        /// <param name="p_booking">Bookingobject with an ID.</param>
        /// <returns>Updated Bookingobject.</returns>
        public Booking Update(Booking p_booking)
        {
            using (var context = new FhdwHotelContext())
            {

                using (var transaction = context.Database.BeginTransaction())
                {
                    try
                    {
                        p_booking.Hotel = context.Hotel.SingleOrDefault(h => h.ID == p_booking.Hotel.ID);

                        context.Booking.Add(p_booking);
                        context.SaveChanges();

                        transaction.Commit();
                        return p_booking;
                    }
                    catch (Exception ex)
                    {
                        System.Diagnostics.Debug.WriteLine(ex.Message);
                        transaction.Rollback();
                        return null;
                    }
                }
            }
        }
开发者ID:Benzolitz,项目名称:FHDW.Hotel,代码行数:31,代码来源:BookingRepository.cs

示例7: btnBook_Click

    protected void btnBook_Click(object sender, EventArgs e)
    {
        Booking booking = new Booking();

        booking.BookingDate = DateTime.Now;
        booking.BookingNo = BookingDB.CreateBookingNum(Session["CustId"].ToString(), ddlPackage.SelectedItem.Value.ToString());
        booking.TravelerCount = Int32.Parse(ddlTravelCount.SelectedItem.Value);
        booking.CustomerId = Int32.Parse(Session["CustId"].ToString());
        booking.TripTypeId = ddlTripType.SelectedItem.Value.ToString();
        booking.PackageId = Int32.Parse(ddlPackage.SelectedItem.Value);

        //lblMessage.Text = "booking = " + booking.BookingDate + " " + booking.BookingNo + " " + booking.TravelerCount + " " +
        //    booking.CustomerId + " " + booking.TripTypeId + " " + booking.PackageId;

        if (BookingDB.InsertBooking(booking))
        {
            lblMessage.ForeColor = System.Drawing.Color.Green;
            lblMessage.Text = "Booking succeeded! Thank you for Booking with Travel Experts.";
            // TODO: reset fields
        }
        else
        {
            lblMessage.ForeColor = System.Drawing.Color.Red;
            lblMessage.Text = "Booking failed!. Please contact Travel Experts";
        }
        //Response.Redirect("UserHome.aspx");
    }
开发者ID:marpoff,项目名称:TravelExpertsASPWebForms,代码行数:27,代码来源:Bookings.aspx.cs

示例8: PutBooking

        public IHttpActionResult PutBooking(int id, Booking booking)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            if (id != booking.Booking_id)
            {
                return BadRequest();
            }

            db.Entry(booking).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!BookingExists(id))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return StatusCode(HttpStatusCode.NoContent);
        }
开发者ID:Bang0123,项目名称:SWC2sem,代码行数:32,代码来源:BookingsController.cs

示例9: update

 public void update(Booking booking)
 {
     bookingNameLabel.Text = booking.Topic;
     dateLabel.Text = booking.StartDate.ToShortDateString();
     dayLabel.Text = booking.StartDate.DayOfWeek.ToString ();
     timeLabel.Text = booking.StartDate.ToShortTimeString() + " - " + booking.EndDate.ToShortTimeString();
 }
开发者ID:SDP2015Group7,项目名称:HELPSMobile,代码行数:7,代码来源:BookingCell.cs

示例10: CreateOrUpdateBooking

        /// <summary>Creates or updates a booking.</summary>
        /// <param name="booking">The booking to create/update.</param>
        /// <param name="wasAChange">If the call changed a booking instead of creating a new one, this will be true.</param>
        /// <returns>The result of the method call.</returns>
        public static RequestResult CreateOrUpdateBooking(Booking booking, out bool wasAChange)
        {
            wasAChange = false;
            Booking[] bookings;

            var result = ServiceClients.BookingManager.GetBookingsByDate(out bookings, booking.StartTime.Date);

            if (result != RequestStatus.Success) return RequestResult.InvalidInput;

            var temp = bookings.FirstOrDefault(b => BookingsOverlap(b, booking));

            RequestStatus rs;
            if (temp == null) rs = ServiceClients.BookingManager.CreateBooking(PersonModel.loggedInUser.Token, ref booking);
            else
            {
                temp.StartTime = booking.StartTime;
                temp.EndTime = booking.EndTime;
                rs = ServiceClients.BookingManager.ChangeTimeOfBooking(PersonModel.loggedInUser.Token, ref temp);
                wasAChange = true;
            }

            switch (rs)
            {
                case RequestStatus.Success: return RequestResult.Success;
                case RequestStatus.AccessDenied: return RequestResult.AccessDenied;
                case RequestStatus.InvalidInput: return RequestResult.InvalidInput;
                default: return RequestResult.Error;
            }
        }
开发者ID:esfdk,项目名称:itubs,代码行数:33,代码来源:BookingModel.cs

示例11: AddNewBookingToDB

        //add a new booking passing roombooking means extra unneeded data is being shunted around.
        //public  void AddNewBookingToDB(int RoomIdfk, DateTime BookingFrom, DateTime BookingTo, Decimal Roomcost) {
        public void AddNewBookingToDB(RoomBooking myRB)
        {
            using (var context = new Sunshine_HotelEntities1())
            {
                // CREATE a new booking
                var newbooking = new Booking();
                newbooking.RoomIDFK = myRB.RoomIdfk;
                newbooking.BookingFrom = myRB.BookingFrom.Date;
                newbooking.BookingTo = myRB.BookingTo.Date;

                //add in the cost of the room extracted from the dictionary
                newbooking.RoomCost = myRB.roomCost;
                //   RoomCost =  (decimal) newbooking.RoomCost;
                //update db
                context.Bookings.Add(newbooking);
                context.SaveChanges();

                var BookedConfirmationMessage = Environment.NewLine + "You have booked Room " +
                                                myRB.RoomIdfk + Environment.NewLine + "From " +
                                                myRB.BookingFrom + " To " + Environment.NewLine +
                                                myRB.BookingTo + Environment.NewLine + " For " +
                                                (string.Format("{0:C}", myRB.roomCost));

                //show a confirmation message
                MessageBox.Show(BookedConfirmationMessage);
            }
        }
开发者ID:Netchicken,项目名称:Hotel,代码行数:29,代码来源:ModelCalls.cs

示例12: AddBooking

 public void AddBooking(String username, int referenceNumber)
 {
     var booking = new Booking();
     booking.reference_number = referenceNumber;
     booking.creator = username;
     db.Bookings.InsertOnSubmit(booking);
     db.SubmitChanges();
 }
开发者ID:thebinarysearchtree,项目名称:infs3204,代码行数:8,代码来源:BookingRepository.cs

示例13: CreateBooking

 public void CreateBooking(Booking booking)
 {
     this.bookings.Add(booking);
     this.hotelRooms
         .GetById(booking.HotelRoomsId)
         .Booked = true;
     this.bookings.SaveChanges();
 }
开发者ID:iwelina-popova,项目名称:HotelSystem,代码行数:8,代码来源:BookingsService.cs

示例14: TimetableModel

 public TimetableModel(List<Room> Rooms, List<TimeSlot> Times, Booking[,] Bookings, DateTime Day)
 {
     this.Rooms = Rooms;
     this.Times = Times;
     this.Bookings = Bookings;
     this.Day = Day;
     ValidTimetable = true;
 }
开发者ID:hnefatl,项目名称:Prototype1,代码行数:8,代码来源:TimetableModel.cs

示例15: Event

        /// <summary>
        /// Constructor that prefills the fields.
        /// </summary>
        /// <param name="pk"></param>
        /// <param name="start"></param>
        /// <param name="end"></param>
        /// <param name="name"></param>
        public Event(Booking aBooking)
        {
            this.booking = aBooking;

            this.Start = aBooking.Startdatetime;
            this.End = aBooking.Enddatetime;
            this.PK = aBooking.Bookingid;
        }
开发者ID:andersruberg,项目名称:RehabWeb,代码行数:15,代码来源:Event.cs


注:本文中的Booking类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。