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 List<Appointment> getAppointmentList() { List<Appointment> AppointmentList = new List<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 " + "inner join UserInformation as RoomAccount on RoomInformation.UserID = RoomAccount.User_ID " + "where Appointment.RoomID = @RoomID and Appointment.UserID = @UserID", conn); cmd.Parameters.AddWithValue("@UserID", this._appointment.UserID); cmd.Parameters.AddWithValue("@RoomID", this._appointment.RoomID); SqlCeDataAdapter adapter = new SqlCeDataAdapter(); adapter.SelectCommand = cmd; DataSet setdata = new DataSet(); adapter.Fill(setdata, "Appointment"); for (int i = 0; i < setdata.Tables[0].Rows.Count; i++) { Appointment model = new Appointment(); model.AppointmentID = Int64.Parse(setdata.Tables[0].Rows[i].ItemArray[0].ToString()); model.RoomID = Int64.Parse(setdata.Tables[0].Rows[i].ItemArray[1].ToString()); model.UserID = Int64.Parse(setdata.Tables[0].Rows[i].ItemArray[2].ToString()); model.AppointmentDate = DateTime.Parse(setdata.Tables[0].Rows[i].ItemArray[3].ToString()); model.Status = setdata.Tables[0].Rows[i].ItemArray[4].ToString(); model.Respond = setdata.Tables[0].Rows[i].ItemArray[5].ToString(); model.RoomAcc.RoomID = Int64.Parse(setdata.Tables[0].Rows[i].ItemArray[1].ToString()); model.RoomAcc.ApartmentName = setdata.Tables[0].Rows[i].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.Appointee = setdata.Tables[0].Rows[i].ItemArray[49].ToString(); model.RoomAcc.Username = setdata.Tables[0].Rows[i].ItemArray[62].ToString(); AppointmentList.Add(model); } return AppointmentList; }
public ActionResult RoomAppointmentReq(Int64 AppointmentID) { Appointment _AppointmentModel = new Appointment(); _AppointmentModel.AppointmentID = AppointmentID; AppointmentRepository _AppointmentRepository = new AppointmentRepository(_AppointmentModel); return View(_AppointmentRepository.getAppointment()); }
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 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 AppointmentRepository(Appointment _appointment) { this._appointment = _appointment; }
public ActionResult UpdateAppointment(Appointment model) { AppointmentRepository _appointmentRepository = new AppointmentRepository(model); _appointmentRepository.updateAppointment(); return RedirectToAction("AppointmentRequest"); }
public ActionResult AppointmentResult(Appointment model) { return View(model); }
public ActionResult ReallyMakeAppointment(Appointment model) { model.AppointmentDate = DateTime.Parse(model.Date + " " + model.Time); model.Status = "Not Visited"; model.Respond = "Not Confirmed"; AppointmentRepository _appointmentRepository = new AppointmentRepository(model); _appointmentRepository.insertAppointment(); return RedirectToAction("AppointmentResult", "Room", model); }