public void BookingRoomAdd(RoomClass roomClass, RoomTypex roomType) { BookingRoom bookingRoom = new BookingRoom() { RoomClass = roomClass, RoomType = roomType, Book = Booking }; Customer customer1 = new Customer() { Type = CustomerType.Adult, BookingRooms = new List <BookingRoom>(), }; customer1.BookingRooms.Add(bookingRoom); Customer customer2 = new Customer() { Type = CustomerType.Adult, BookingRooms = new List <BookingRoom>(), }; customer2.BookingRooms.Add(bookingRoom); bookingRoom.Customers.Add(customer1); bookingRoom.Customers.Add(customer2); BookingViewBLL.CustomerSaveOrUpdate(customer1); BookingViewBLL.CustomerSaveOrUpdate(customer2); BookingViewBLL.BookingRoomSaveOrUpdate(bookingRoom); }
public async Task <IActionResult> PutBookingRoom(int id, BookingRoom bookingRoom) { if (id != bookingRoom.BookingId) { return(BadRequest()); } _context.Entry(bookingRoom).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingRoomExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult EditBookingRoom(BookingRoom item) { bookingsrooms.Update(item); bookingsrooms.Commit(); return(RedirectToAction("BookingSummary")); }
/// <summary> /// /// </summary> /// <returns></returns> public CheckRateRQ toCheckRateRQ() { try { CheckRateRQ checkRateRQ = new CheckRateRQ(); checkRateRQ.rooms = new List <hotel_api_model.auto.model.BookingRoom>(); for (int i = 0; i < this.rooms.Count; i++) { BookingRoom bookingRoom = new BookingRoom(); bookingRoom.rateKey = rooms[i].rateKey; bookingRoom.paxes = new List <Pax>(); Pax[] paxes = new Pax[this.rooms[i].details.Count]; for (int d = 0; d < this.rooms[i].details.Count; d++) { Pax pax = new Pax(); pax.type = rooms[i].details[d].getType() == RoomDetail.GuestType.ADULT ? SimpleTypes.HotelbedsCustomerType.AD : SimpleTypes.HotelbedsCustomerType.CH; pax.age = rooms[i].details[d].getAge(); pax.name = rooms[i].details[d].getName(); pax.surname = rooms[i].details[d].getSurname(); paxes[d] = pax; } bookingRoom.paxes.AddRange(paxes); checkRateRQ.rooms.Add(bookingRoom); } checkRateRQ.Validate(); return(checkRateRQ); } catch (HotelSDKException e) { throw e; } }
public async Task <IActionResult> Edit(int id, [Bind("BookingID,RoomID,GuestID")] BookingRoom bookingRoom) { if (id != bookingRoom.BookingID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookingRoom); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingRoomExists(bookingRoom.BookingID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BookingID"] = new SelectList(_context.Booking, "BookingID", "BookingID", bookingRoom.BookingID); ViewData["GuestID"] = new SelectList(_context.Guest, "GuestID", "GuestTitle", bookingRoom.GuestID); ViewData["RoomID"] = new SelectList(_context.Room, "RoomID", "RoomID", bookingRoom.RoomID); return(View(bookingRoom)); }
public int CustomerGetNumberOfCustomersInMonth(int month, int year, User user) { var firstDateOfMonth = new DateTime(year, month, 1); var lastDateOfMonth = firstDateOfMonth.AddMonths(1).AddDays(-1); var query = _session.QueryOver <Customer>(); query = query.Where(x => x.Type == CustomerType.Adult || x.Type == CustomerType.Children); BookingRoom bookingRoomAlias = null; query = query.JoinAlias(x => x.BookingRooms, () => bookingRoomAlias); Booking bookingAlias = null; query = query.JoinAlias(() => bookingRoomAlias.Book, () => bookingAlias); BookingSale bookingSalesAlias = null; query = query.JoinAlias(() => bookingAlias.BookingSale, () => bookingSalesAlias); if (user != null) { query = query.Where(() => bookingSalesAlias.Sale == user); } query = query.Where(() => bookingAlias.Deleted == false); query = query.Where(() => bookingAlias.StartDate >= firstDateOfMonth && bookingAlias.StartDate <= lastDateOfMonth); query = query.Where(() => bookingAlias.Status == StatusType.Approved); query = query.Select(Projections.RowCount()); return(query.FutureValue <int>().Value); }
public void Post([FromBody] BookingRoom p_oBookingRoom) { bool bIsSuccess = false; using (var oTrans = db.Database.BeginTransaction()) { try { BookingRoom oBookingRoomAdd = new BookingRoom(); oBookingRoomAdd.BookingCode = p_oBookingRoom.BookingCode; oBookingRoomAdd.ClientId = p_oBookingRoom.ClientId; oBookingRoomAdd.RoomId = p_oBookingRoom.RoomId; oBookingRoomAdd.CheckInDate = p_oBookingRoom.CheckInDate; oBookingRoomAdd.CheckOutDate = p_oBookingRoom.CheckOutDate; oBookingRoomAdd.UniqueCode = p_oBookingRoom.UniqueCode; db.BookingRoom.Add(oBookingRoomAdd); db.SaveChanges(); bIsSuccess = true; } catch (Exception Ex) { oTrans.Rollback(); } finally { if (bIsSuccess) { oTrans.Commit(); } } } }
public ActionResult BookRoomChose(Room room) { using (var db = new QLKSWEBEntities()) { int bookingid = (int)Session["BookingID"]; Room choseroom = ManageRoomBLL.Instance.GetRoomByID(room.RoomID); choseroom.RoomStatus = "BOOKING"; db.Entry(choseroom).State = EntityState.Modified; if (db.SaveChanges() > 0) { Booking bookingvoucher = BookingRoomBLL.Instance.GetBookingbyID(bookingid); bookingvoucher.BookingStatus = "BOOKING"; db.Entry(bookingvoucher).State = EntityState.Modified; if (db.SaveChanges() > 0) { BookingRoom booking = new BookingRoom() { RoomID = room.RoomID, BookingID = bookingid, IsBooking = 1 }; db.BookingRooms.Add(booking); if (db.SaveChanges() > 0) { TempData["ChoseRoomStatus"] = "BOOKSUCCES"; return(RedirectToAction("Manage-35")); } } } TempData["ChoseRoomStatus"] = "BOOKFAIL"; return(RedirectToAction("Manage-35")); } }
public async Task <IActionResult> Edit(int id, [Bind("BookingRoomId,BookingCode,ClientId,RoomId,CheckInDate,CheckOutDate,UniqueCode")] BookingRoom bookingRoom) { if (id != bookingRoom.BookingRoomId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(bookingRoom); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BookingRoomExists(bookingRoom.BookingRoomId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["RoomId"] = new SelectList(_context.Set <Room>(), "RoomId", "RoomName", bookingRoom.RoomId); return(View(bookingRoom)); }
public void Delete(int id) { bool bIsSuccess = false; using (var oTrans = db.Database.BeginTransaction()) { try { BookingRoom oBookingRoomDeleted = db.BookingRoom.Find(id); db.BookingRoom.Remove(oBookingRoomDeleted); db.SaveChanges(); bIsSuccess = true; } catch (Exception Ex) { oTrans.Rollback(); } finally { if (bIsSuccess) { oTrans.Commit(); } } } }
public void Put(int id, [FromBody] BookingRoom p_oBookingRoom) { bool bIsSuccess = false; using (var oTrans = db.Database.BeginTransaction()) { try { BookingRoom oBookingRoomUpdate = db.BookingRoom.Find(id); oBookingRoomUpdate.BookingCode = p_oBookingRoom.BookingCode; oBookingRoomUpdate.ClientId = p_oBookingRoom.ClientId; oBookingRoomUpdate.RoomId = p_oBookingRoom.RoomId; oBookingRoomUpdate.CheckInDate = p_oBookingRoom.CheckInDate; oBookingRoomUpdate.CheckOutDate = p_oBookingRoom.CheckOutDate; oBookingRoomUpdate.UniqueCode = p_oBookingRoom.UniqueCode; db.Update(oBookingRoomUpdate); bIsSuccess = db.SaveChanges() > 0 ? true : false; } catch (Exception Ex) { oTrans.Rollback(); } finally { if (bIsSuccess) { oTrans.Commit(); } } } }
// GET: Bookings/Create public IActionResult Create() { Bookings myBooking = new Bookings { AmenitiesList = new List <Amenities> { new Amenities { AmenityId = 0, AmenityName = "TV", IsSelected = false, AmenityPrice = 20.0 }, new Amenities { AmenityId = 1, AmenityName = "Shower", IsSelected = false, AmenityPrice = 10.0 }, new Amenities { AmenityId = 2, AmenityName = "HairDryer", IsSelected = false, AmenityPrice = 15.0 }, new Amenities { AmenityId = 2, AmenityName = "DrinkCabinet", IsSelected = false, AmenityPrice = 25.0 } }, }; BookingRoom bookingRoom = new BookingRoom { booking = myBooking }; return(View(bookingRoom)); }
public IHttpActionResult PutBookingRoom(int id, BookingRoom bookingRoom) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != bookingRoom.ID) { return(BadRequest()); } bookingRoom.UserID = User.Identity.GetUserId(); db.Entry(bookingRoom).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BookingRoomExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public JsonResult BookingRoom(int ID) { BookingRoom br = new BookingRoom(); br.XuLyDatPhong(ID, Session["taikhoan"].ToString()); return(Json("", JsonRequestBehavior.AllowGet)); }
public int getUserIDOffer(int IDRoom) { QuanLyPhongTroDBContext db = new QuanLyPhongTroDBContext(); BookingRoom bk = db.BookingRooms.SingleOrDefault(x => x.idRoom == IDRoom && x.Status == 4); return(bk.idCus); }
public static BookingRoomData ToData(this BookingRoom bookingRoom, IEnumerable <Service> services) { return(new BookingRoomData { BookingRoom = bookingRoom, Services = new ObservableCollection <Service>(services) }); }
public void UpdateStatusDeclineCustomer(int CusID, int RoomID) { QuanLyPhongTroDBContext db = new QuanLyPhongTroDBContext(); BookingRoom br = db.BookingRooms.SingleOrDefault(x => x.idCus == CusID && x.idRoom == RoomID); br.Status = 3; db.SaveChanges(); }
public void UpdateStatus(int IDRoom, int IDStatusIn, int IDStatusOut) { QuanLyPhongTroDBContext db = new QuanLyPhongTroDBContext(); BookingRoom bk = db.BookingRooms.SingleOrDefault(x => x.idRoom == IDRoom && x.Status == IDStatusIn); bk.Status = IDStatusOut; db.SaveChanges(); }
public void RemoveBookingRoom(BookingRoom bookingRoom) { using (var unitOfWork = new UnitOfWork(new HotelContext())) { bookingRoom.Deleted = true; unitOfWork.Complete(); } }
public void AddBookingRoom(BookingRoom bookingRoom) { using (var unitOfWork = new UnitOfWork(new HotelContext())) { unitOfWork.BookingRooms.Add(bookingRoom); unitOfWork.Complete(); } }
public void UpdateBookingRoom(BookingRoom bookingRoom) { using (var unitOfWork = new UnitOfWork(new HotelContext())) { var result = unitOfWork.BookingRooms.Get(bookingRoom.Id); result = bookingRoom; unitOfWork.Complete(); } }
private double _total; // Luu tong gia tri hoa don khi item databound #endregion #region --- PAGE EVENT --- protected void Page_Load(object sender, EventArgs e) { Page.Title = @"Quản lý phiếu xuất"; if (!string.IsNullOrEmpty(Request.QueryString["ExportId"]) && Request.QueryString["ExportId"] != "0") { _currentExport = Module.GetById <IvExport>(Convert.ToInt32(Request.QueryString["ExportId"])); } else { _currentExport = new IvExport(); } if (!string.IsNullOrEmpty(Request.QueryString["bookingRoomId"])) { _bookingRoom = Module.GetById <BookingRoom>(Convert.ToInt32(Request.QueryString["bookingRoomId"])); phInfoRoom.Visible = true; //var info = _bookingRoom.Room.Name + Environment.NewLine; //foreach (Customer customer in _bookingRoom.Customers) //{ // info += customer.Fullname + Environment.NewLine; //} litRoom.Text = _bookingRoom.Room.Name; } string argCode = string.Format("document.getElementById({0}).value", "arg"); // string storageId = string.Format("document.getElementById('{0}').value", ddlStorage.ClientID); string storageId = string.Format("document.getElementById('{0}').value", 0); // Tạo đoạn code đăng ký phương thức callback, trong đó txtCode là tham số truyền vào call back, ValidateProductCode là phương thức xử lý dữ liệu callback string cbReference = Page.ClientScript.GetCallbackEventReference(this, argCode + "+" + "'|'" + "+" + storageId, "LoadProduct", "context", "LoadProduct", true); // Đăng ký phương thức vừa tạo string cbScript = "function UseCallback(arg,context)" + "{" + cbReference + ";" + "}"; Page.ClientScript.RegisterClientScriptBlock(GetType(), "UseCallback", cbScript, true); _ivUnits = Module.IvUnitGetAll(null); if (!IsPostBack) { LoadStorage(); int count = Module.CountExportByDateTime(Request.QueryString, UserIdentity, DateTime.Today) + 1; txtCode.Text = string.Format("PX{0}-{1}", DateTime.Today.ToString("ddMMyyyy"), count); txtName.Text = string.Format("Phiếu xuất ngày {0}-{1}", DateTime.Today.ToString("dd/MM/yyyy"), count); txtExportedDate.Text = DateTime.Today.ToString("dd/MM/yyyy"); LoadInfoExport(); if (_currentExport.Id > 0) { BindrptProductList(); } } if (!UserIdentity.HasPermission(AccessLevel.Administrator)) { btnSaveProductExport.Visible = false; } }
public static BookingRoom MapBookingRoomModelToBookingRoom(BookingRoomModel brmodel) { var bookingroom = new BookingRoom { RoomId = brmodel.RoomId, BookingId = brmodel.BookingId, }; return(bookingroom); }
public ActionResult DeleteFromBooking(int id) { BookingRoom bookingRoom = bookingService.GetBookingRoomById(id); if (bookingRoom == null) { return(HttpNotFound()); } return(View(bookingRoom)); }
protected virtual void Page_Load(object sender, EventArgs e) { var tripId = Request["tripId"]; if (!string.IsNullOrWhiteSpace(tripId)) { _numberOfDay = Module.TripGetById(Convert.ToInt32(tripId)).NumberOfDay; } var roomId = Request["roomId"]; if (!string.IsNullOrWhiteSpace(roomId)) { _room = Module.RoomGetById(Convert.ToInt32(roomId)); } var bookingRoomId = Request["bookingRoomId"]; if (!string.IsNullOrWhiteSpace(bookingRoomId)) { _bookingRoom = Module.BookingRoomGetById(Convert.ToInt32(bookingRoomId)); } var bookingId = Request["bookingId"]; if (!string.IsNullOrWhiteSpace(bookingId)) { _booking = Module.BookingGetById(Convert.ToInt32(bookingId)); _numberOfDay = _booking.Trip.NumberOfDay; _currentCruise = _booking.Cruise; } else { _currentCruise = _cruises.FirstOrDefault(); } if (!IsPostBack) { _currentDate = _booking.StartDate; _nextDate = _currentDate.AddDays(1); if (_currentCruise != null && _currentCruise.Id > 0) { _roomCruises = Module.RoomGetAll2(_currentCruise); _currentDayBookings = Module.GetBookingByDate(_currentDate, _currentCruise); _nextDayBookings = Module.GetBookingByDate(_nextDate, _currentCruise); _allBooking = _currentDayBookings.Concat(_nextDayBookings).ToList(); ShowEmptyRoomDay(_currentDate, litCurrentRooms, true); ShowEmptyRoomDay(_nextDate, litNextRooms, false); for (int i = 1; i <= _currentCruise.NumberOfFloors; i++) { _floors.Add(i); } rptFloors.DataSource = _floors; rptFloors.DataBind(); } } }
public ActionResult EditBookingRoom(int id = 0) { BookingRoom item = bookingService.GetBookingRoom(this.HttpContext, id); var prdlst = rooms.GetAll(); var query = from p in prdlst select p.RoomID; ViewBag.pl = query.ToList(); return(View(item)); }
public BookingRQ toBookingRQ() { BookingRQ bookingRQ = new BookingRQ(); bookingRQ.holder = this.holder; bookingRQ.clientReference = this.clientReference; bookingRQ.remark = this.remark; if (!String.IsNullOrEmpty(cardType) && !String.IsNullOrEmpty(cardNumber) && !String.IsNullOrEmpty(cardHolderName) && !String.IsNullOrEmpty(expiryDate) && cardCVC != null || !String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(phoneNumber)) { PaymentData paymentData = new PaymentData(); if (!String.IsNullOrEmpty(cardType) && !String.IsNullOrEmpty(cardNumber) && !String.IsNullOrEmpty(cardHolderName) && !String.IsNullOrEmpty(expiryDate) && !String.IsNullOrEmpty(cardCVC)) { paymentData.paymentCard = new PaymentCard() { cardType = cardType, cardNumber = cardNumber, cardHolderName = cardHolderName, expiryDate = expiryDate, cardCVC = cardCVC } } ; if (!String.IsNullOrEmpty(email) && !String.IsNullOrEmpty(phoneNumber)) { paymentData.contactData = new PaymentContactData() { email = email, phoneNumber = phoneNumber } } ; bookingRQ.paymentData = paymentData; } for (int i = 0; i < rooms.Count; i++) { BookingRoom room = new BookingRoom(); room.rateKey = rooms[i].rateKey; room.paxes = new List <Pax>(); for (int p = 0; p < rooms[i].details.Count; p++) { Pax pax = new Pax(); pax.type = (rooms[i].details[p].getType() == RoomDetail.GuestType.ADULT) ? SimpleTypes.HotelbedsCustomerType.AD : SimpleTypes.HotelbedsCustomerType.CH; pax.age = rooms[i].details[p].getAge(); pax.name = rooms[i].details[p].getName(); pax.surname = rooms[i].details[p].getSurname(); pax.roomId = rooms[i].details[p].getRoomId(); room.paxes.Add(pax); } bookingRQ.rooms.Add(room); } bookingRQ.Validate(); return(bookingRQ); }
private void LoadInfoExport() { if (_currentExport.Id > 0) { txtName.Text = _currentExport.Name; txtCode.Text = _currentExport.Code; int count = Module.CountExportByDateTime(Request.QueryString, UserIdentity, DateTime.Today) + 1; if (string.IsNullOrWhiteSpace(_currentExport.Code)) { txtCode.Text = string.Format("PX{0}-{1}", DateTime.Today.ToString("ddMMyyyy"), count); } if (string.IsNullOrWhiteSpace(_currentExport.Name)) { txtName.Text = string.Format("Phiếu xuất ngày {0}-{1}", DateTime.Today.ToString("dd/MM/yyyy"), count); } txtExportedDate.Text = _currentExport.ExportDate.ToString("dd/MM/yyyy"); txtTotal.Text = _currentExport.Total.ToString(); txtPay.Text = _currentExport.Pay.ToString(); txtDetail.Text = _currentExport.Detail; txtExportBy.Text = _currentExport.ExportedBy; if (string.IsNullOrWhiteSpace(_currentExport.ExportedBy)) { txtExportBy.Text = UserIdentity.UserName; } txtCustomerName.Text = _currentExport.CustomerName; chkIsDebt.Checked = _currentExport.IsDebt; txtAgency.Text = _currentExport.Agency; if (string.IsNullOrWhiteSpace(_currentExport.CustomerName)) { var info = ""; if (!string.IsNullOrEmpty(Request.QueryString["bookingRoomId"])) { _bookingRoom = Module.GetById <BookingRoom>(Convert.ToInt32(Request.QueryString["bookingRoomId"])); } if (_currentExport.BookingRoom != null) { _bookingRoom = _currentExport.BookingRoom; foreach (Customer customer in _bookingRoom.Customers) { if (!string.IsNullOrWhiteSpace(customer.Fullname)) { info += customer.Fullname + "; "; } } } txtCustomerName.Text = info; } // if (_currentExport.Storage != null) ddlStorage.SelectedValue = _currentExport.Storage.Id.ToString(); } }
public void InsertOGhep(int IDRoom, int IDcus) { QuanLyPhongTroDBContext db = new QuanLyPhongTroDBContext(); BookingRoom bk = new BookingRoom(); bk.idBook = GetNextID(); bk.idCus = IDcus; bk.idRoom = IDRoom; bk.Status = 4; db.BookingRooms.Add(bk); db.SaveChanges(); }
public void InsertDB(int idCus, int idRoom) { QuanLyPhongTroDBContext db = new QuanLyPhongTroDBContext(); BookingRoom bR = new BookingRoom(); bR.idBook = GetNextID(); bR.idCus = idCus; bR.idRoom = idRoom; bR.Status = 1; db.BookingRooms.Add(bR); db.SaveChanges(); }