public Appointment getAppointment() { Appointment model = new Appointment(); SqlCeCommand cmd = new SqlCeCommand("Select * from Appointment " + "inner join RoomInformation on Appointment.RoomID = RoomInformation.RoomID " + "inner join UserInformation on Appointment.UserID = UserInformation.User_ID where Appointment.AppointmentID = @AppointmentID", conn); cmd.Parameters.AddWithValue("@AppointmentID", this._appointment.AppointmentID); SqlCeDataAdapter adapter = new SqlCeDataAdapter(); adapter.SelectCommand = cmd; DataSet setdata = new DataSet(); adapter.Fill(setdata, "Appointment"); model.AppointmentID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[0].ToString()); model.RoomID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[1].ToString()); model.UserID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[2].ToString()); model.AppointmentDate = DateTime.Parse(setdata.Tables[0].Rows[0].ItemArray[3].ToString()); model.Status = setdata.Tables[0].Rows[0].ItemArray[4].ToString(); model.Respond = setdata.Tables[0].Rows[0].ItemArray[5].ToString(); model.RoomAcc.RoomID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[1].ToString()); model.RoomAcc.ApartmentName = setdata.Tables[0].Rows[0].ItemArray[7].ToString(); model.RoomAcc.RoomForSale = bool.Parse (setdata.Tables[0].Rows[0].ItemArray[8].ToString()); model.RoomAcc.RoomForRent = bool.Parse (setdata.Tables[0].Rows[0].ItemArray[9].ToString()); model.RoomAcc.RoomPrice = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[12].ToString()); model.RoomAcc.Username = setdata.Tables[0].Rows[0].ItemArray [49].ToString (); Account AccountModel = new Account(); AccountModel.ID = model.UserID; AccountRepository _accountRepository = new AccountRepository(AccountModel); model.Appointee = _accountRepository.getDataByID().username; return model; }
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 ActionResult AccountList() { Account model = new Account(); List<Account> modelList = new List<Account>(); AccountRepository _accountRepository = new AccountRepository(model); modelList = _accountRepository.getList(); return View(modelList); }
public ActionResult myReqList() { Account _accountModel = new Account(); _accountModel.username = User.Identity.Name; AccountRepository _accountRepository = new AccountRepository(_accountModel); Appointment _appointmentModel = new Appointment(); _appointmentModel.UserID = _accountRepository.getData().ID; AppointmentRepository _appointmentRepository = new AppointmentRepository(_appointmentModel); return View(_appointmentRepository.getAppointmentListByID()); }
public ActionResult RoomlistOwner() { Room model = new Room(); Account AccountModel = new Account(); AccountModel.username = User.Identity.Name; AccountRepository _accountRepository = new AccountRepository(AccountModel); model.UserID = _accountRepository.getData().ID; List<Room> modelList = new List<Room>(); RoomRepository _RoomAccountRepository = new RoomRepository(model); return View(_RoomAccountRepository.getRoomListByID()); }
public ActionResult insertComment(Comment model) { Account AccountModel = new Account(); AccountModel.username = User.Identity.Name; AccountRepository _accountRepository = new AccountRepository(AccountModel); model.UserID = _accountRepository.getData().ID; model.CommentDateTime = DateTime.Now; CommentRepository _commentRepository = new CommentRepository(model); _commentRepository.insertComment(); return RedirectToAction("SearchResultDetail", "Room", new { id = model.RoomID }); }
public ActionResult AppointmentList(Int64 RoomID) { Room model = new Room(); model.RoomID = RoomID; Appointment _AppointmentModel = new Appointment(); Account AccountModel = new Account(); AccountModel.username = User.Identity.Name; AccountRepository _accountRepository = new AccountRepository(AccountModel); _AppointmentModel.UserID = _accountRepository.getData().ID; _AppointmentModel.RoomID = RoomID; AppointmentRepository _appointmentRepository = new AppointmentRepository(_AppointmentModel); return View(_appointmentRepository.getAppointmentList()); }
public ActionResult login(Account model) { ViewData["MSGLOGIN"] = "******"; AccountRepository _accountRepository = new AccountRepository(model); if (_accountRepository.checkUserLogin() == true) { FormsAuthentication.SetAuthCookie(model.username, false); return RedirectToAction("Search1", "Room"); } else { return View(); } }
public ActionResult Register(Account model) { ViewData["MSGREG"] = "Username Already Taken"; AccountRepository _accountRepository = new AccountRepository(model); if (_accountRepository.checkUsername() == false) { _accountRepository.insertData(); return RedirectToAction("Login"); } else { return View(); } }
public ActionResult InsertData(Account model) { AccountRepository _accountRepository = new AccountRepository(model); _accountRepository.insertData(); return RedirectToAction("AccountList"); }
public ActionResult UpdateDataProcess(Account model) { AccountRepository _AccountRepository = new AccountRepository(model); _AccountRepository.updateData(); return RedirectToAction("AccountList"); }
public ActionResult InsertRoomData(Room model) { //if (model.ApartmentName != "" || model.RoomType != "" || model.RoomSize != "" || model.RoomPrice != 0 || model.District != "" || model.FullAddress != "" || model.ElecPerUnit != 0 || model.WaterPerUnit != 0 || model.RoomStatus != "") //{ Account AccountModel = new Account(); AccountModel.username = User.Identity.Name; AccountRepository _accountRepository = new AccountRepository(AccountModel); model.UserID = _accountRepository.getData().ID; RoomRepository _RoomRepository = new RoomRepository(model); _RoomRepository.InsertRoomData(); return RedirectToAction("RoomlistOwner","MY"); //} //else //{ // ViewData["MSGREGISTER"] = "Please Input All The Data!!!"; // return View(); //} }
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); }