public void LoadSchedule(DTO.Booking b) { BookingBUS bBus = new BookingBUS(); GuestBUS gBUS = new GuestBUS(); RoomBUS rBUS = new RoomBUS(); string id = b.BookingID.ToString(); Guest g = gBUS.getGuestByID(b.GuestID); Room r = rBUS.getRoomByID(b.RoomID); RoomType rt = rBUS.getRoomTypeByID(r.RoomType); schedulerControl1.ActiveViewType = DevExpress.XtraScheduler.SchedulerViewType.Month; schedulerControl1.OptionsCustomization.AllowInplaceEditor = DevExpress.XtraScheduler.UsedAppointmentType.None; String roomID = b.RoomID; String name = g.FullName.Trim(); DateTime checkin = b.CheckIn; DateTime checkout = b.CheckOut; Appointment app = schedulerStorage1.CreateAppointment(AppointmentType.Normal); DateTime start = checkin; DateTime end = checkout; app.Start = start; app.End = end; app.AllDay = false; app.LabelKey = 3; app.StatusKey = 1; app.Subject = "Room " + roomID + " - " + name; app.SetId(id); schedulerStorage1.Appointments.Add(app); }
void LoadRoomFooter(DTO.Booking book) { TimeSpan date = book.CheckIn - book.CheckOut; String type = book.BookingTypeID; roomIcon icon = new roomIcon(); icon.occupiedLabel.Text = date.Days.ToString(); icon.bookTypeLabel.Text = type; }
private void button1_Click(object sender, EventArgs e) { string name = guestNameTextBox.Text; string nal = nationTB.Text; Guest g = new Guest(null, name, nal, DateTime.Now); GuestBUS gBUS = new GuestBUS(); g = gBUS.insertGuest(g); if (g != null) { MessageBox.Show(g.FullName + " " + g.Nationality); } else { return; } BookingBUS bBUS = new BookingBUS(); string roomType = roomTypeComboBox.Text; string roomID = roomComboBox.Text; string bookingType = bookingTypeCombobox.Text; DateTime dateIn = dateCheckin.DateTime; DateTime dateout = dateCheckout.DateTime; if (bBUS.checkAvaiable(roomID, dateIn, dateout) == false) { MessageBox.Show("ADD BOOKING SUCCESS FAILED!! ROOM BOOKED", "CONFIRMATION", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } bool breakfast = false; if (breakfastCheckbox.Checked == true) { breakfast = true; } string type = "003"; if (bookingType == "AGODA") { type = "001"; } else if (bookingType == "Booking.com") { type = "002"; } else { } DTO.Booking b = new DTO.Booking(0, roomID, g.InfoID, type, nv.NhanVienID, DateTime.Now, dateIn, dateout, breakfast); if (bBUS.InsertBooking(b)) { MessageBox.Show("ADD BOOKING SUCCESS FULL", "CONFIRMATION", MessageBoxButtons.OK); } else { MessageBox.Show("ADD BOOKING SUCCESS FAILED", "CONFIRMATION", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void loadInfo(DTO.Booking b) { Appointment app = schedulerStorage1.CreateAppointment(AppointmentType.Normal); BookingBUS bBus = new BookingBUS(); GuestBUS gBUS = new GuestBUS(); RoomBUS rBUS = new RoomBUS(); string id = b.BookingID.ToString(); Guest g = gBUS.getGuestByID(b.GuestID); Room r = rBUS.getRoomByID(b.RoomID); RoomType rt = rBUS.getRoomTypeByID(r.RoomType); String roomID = b.RoomID; String name = g.FullName.Trim(); int bookID = b.BookingID; string typeID = r.RoomType; //Console.WriteLine(g.FullName); string guestID = b.GuestID; int status = r.Status; string bookType = b.BookingTypeID.Trim(); DateTime checkIn = app.Start; DateTime checkOut = b.CheckOut; int price = rt.Price; editGuestInfo edit = new editGuestInfo(); edit = editGuestInfo1; edit.guestNameTextBox.Text = name; edit.guestIdTextBox.Text = guestID; edit.dateOfBirth.Text = g.DOB.ToString(); edit.nationTextBox.Text = g.Nationality; BookingInformation bookInfo = new BookingInformation(); bookInfo = bookingInformation1; bookInfo.daysLabel.Text = bookInfo.getDays(checkIn, checkOut); bookInfo.bookID.Text = bookID.ToString(); bookInfo.nationTB.Text = g.Nationality; bookInfo.roomTypeComboBox.Text = typeID; bookInfo.guestNameLabel.Text = name; bookInfo.roomIdLabel.Text = "Room" + roomID; if (bookType.Equals("001")) { bookInfo.bookingTypeCombobox.Text = "AGODA"; } else if (bookType.Equals("002")) { bookInfo.bookingTypeCombobox.Text = "BOOKING"; } else { bookInfo.bookingTypeCombobox.Text = "FREE"; } //bookInfo.bookingTypeCombobox.Text switch (status) { case 1: bookInfo.statusComboBox.Text = "Reserved"; break; case 2: bookInfo.statusComboBox.Text = "Occupied"; break; case 3: bookInfo.statusComboBox.Text = "Checked-out"; break; default: bookInfo.statusComboBox.Text = "Available"; break; } bookInfo.fromDateLabel.Text = checkIn.ToString("dd.MM.yyyy"); bookInfo.toDayLabel.Text = checkOut.ToString("dd.MM.yyyy"); bookInfo.priceLabel.Text = price.ToString(); }
private void gridControl1_Click(object sender, EventArgs e) { bookingInformation1.Visible = true; newBooking1.Visible = false; if (gridView1.GetFocusedRowCellValue("bookingID") != null) { string id = gridView1.GetFocusedRowCellValue("bookingID").ToString(); string typeid = gridView1.GetFocusedRowCellValue("bookingTypeID").ToString(); BookingBUS bBus = new BookingBUS(); GuestBUS gBUS = new GuestBUS(); RoomBUS rBUS = new RoomBUS(); DTO.Booking b = bBus.getBookingByID(id, typeid); Guest g = gBUS.getGuestByID(b.GuestID); Room r = rBUS.getRoomByID(b.RoomID); RoomType rt = rBUS.getRoomTypeByID(r.RoomType); int bookID = b.BookingID; string guestID = b.GuestID; string typeID = r.RoomType; String guestName = g.FullName.Trim(); String roomID = b.RoomID; int status = r.Status; string bookType = b.BookingTypeID.Trim(); DateTime checkIn = b.CheckIn; DateTime checkOut = b.CheckOut; int price = rt.Price; string roomType = r.RoomType; editGuestInfo edit = new editGuestInfo(); edit = editGuestInfo1; edit.guestNameTextBox.Text = guestName; edit.guestIdTextBox.Text = guestID; edit.dateOfBirth.Text = g.DOB.ToString(); edit.nationTextBox.Text = g.Nationality; BookingInformation bookInfo = new BookingInformation(); bookInfo = bookingInformation1; bookInfo.daysLabel.Text = bookInfo.getDays(checkIn, checkOut); bookInfo.bookID.Text = bookID.ToString(); bookInfo.nationTB.Text = g.Nationality; bookInfo.roomTypeComboBox.Text = typeID; bookInfo.guestNameLabel.Text = guestName; bookInfo.roomIdLabel.Text = "Room" + roomID; if (bookType.Equals("001")) { bookInfo.bookingTypeCombobox.Text = "AGODA"; } else if (bookType.Equals("002")) { bookInfo.bookingTypeCombobox.Text = "BOOKING"; } else { bookInfo.bookingTypeCombobox.Text = "FREE"; } //bookInfo.bookingTypeCombobox.Text switch (status) { case 1: bookInfo.statusComboBox.Text = "Reserved"; break; case 2: bookInfo.statusComboBox.Text = "Occupied"; break; case 3: bookInfo.statusComboBox.Text = "Checked-out"; break; default: bookInfo.statusComboBox.Text = "Available"; break; } bookInfo.fromDateLabel.Text = checkIn.ToString("dd.MM.yyyy"); bookInfo.toDayLabel.Text = checkOut.ToString("dd.MM.yyyy"); PayBUS pBUS = new PayBUS(); bookInfo.priceLabel.Text = pBUS.getTotalPrice(b).ToString(); } }