public Reservation getReservation() { Reservation model = new Reservation(); SqlCeCommand cmd = new SqlCeCommand("Select * from Reservation " + "inner join RoomInformation on Reservation.RoomID = RoomInformation.RoomID " + "inner join UserInformation on Reservation.UserID = UserInformation.User_ID where Reservation.ReservationID = @ReservationID", conn); cmd.Parameters.AddWithValue("@ReservationID", this._reservation.ReservationID); SqlCeDataAdapter adapter = new SqlCeDataAdapter(); adapter.SelectCommand = cmd; DataSet setdata = new DataSet(); adapter.Fill(setdata, "Reservation"); model.AppointmentID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[0].ToString()); model.UserID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[1].ToString()); model.RoomID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[2].ToString()); model.ReservationDate = DateTime.Parse(setdata.Tables[0].Rows[0].ItemArray[3].ToString()); model.ReservationAmount = setdata.Tables[0].Rows[0].ItemArray[4].ToString(); model.ValidTill = DateTime.Parse(setdata.Tables[0].Rows[0].ItemArray[5].ToString()); model.ReservationType = setdata.Tables[0].Rows[0].ItemArray[6].ToString(); model.RoomAccount.RoomID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[2].ToString()); model.RoomAccount.ApartmentName = setdata.Tables[0].Rows[0].ItemArray[8].ToString(); model.RoomAccount .FullAddress= setdata.Tables[0].Rows[0].ItemArray[19].ToString(); model.RoomAccount.RoomType = setdata.Tables[0].Rows[0].ItemArray[12].ToString(); model.RoomAccount.RoomForRent = bool.Parse(setdata.Tables[0].Rows[0].ItemArray[11].ToString()); model.RoomAccount.RoomForSale = bool.Parse(setdata.Tables[0].Rows[0].ItemArray[10].ToString()); model.RoomAccount.RoomPrice = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[14].ToString()); model.RoomAccount .RoomStatus= setdata.Tables[0].Rows[0].ItemArray[23].ToString(); model.RoomAccount.Username = setdata.Tables[0].Rows[0].ItemArray[51].ToString(); Account AccountModel = new Account(); AccountModel.ID = model.UserID; AccountRepository _accountRepository = new AccountRepository(AccountModel); model.Reserver = _accountRepository.getDataByID().username; return model; }
public ReservationRepository(Reservation reservation) { this._reservation = reservation; }
public ActionResult ReallyMakeReservation(Reservation model) { DateTime ReservationDate = DateTime.Now; DateTime ValidTill = ReservationDate.AddMonths(1); model.ReservationDate = ReservationDate; model.ValidTill= ValidTill; ReservationRepository _reservationRepository = new ReservationRepository(model); _reservationRepository.insertReservation(); return RedirectToAction("ReservationResult", "Room", model); }
public ActionResult ReservationResult(Reservation model) { model.Reserver = User.Identity.Name; //model.RoomAccount.RoomStatus = "Reserved"; return View(model); }
public ActionResult MakeReservations(Int64 RoomID) { Room model = new Room(); model.RoomID = RoomID; RoomRepository _roomRepository = new RoomRepository(model); Reservation _ReservationtModel = new Reservation(); _ReservationtModel.RoomID = _roomRepository.getdata().RoomID; _ReservationtModel.RoomAccount = _roomRepository.getdata(); Account AccountModel = new Account(); AccountModel.username = User.Identity.Name; AccountRepository _accountRepository = new AccountRepository(AccountModel); _ReservationtModel.UserID = _accountRepository.getData().ID; return View(_ReservationtModel); }