public Account getData()
 {
     Account _account = new Account();
     SqlCeCommand cmd = new SqlCeCommand("select * from UserInformation where Username=@username", conn);
     SqlCeDataAdapter adapter = new SqlCeDataAdapter();
     cmd.Parameters.AddWithValue("@username", this._userinformation.username);
     adapter.SelectCommand = cmd;
     DataSet setdata = new DataSet();
     adapter.Fill(setdata,"UserInformation");
     for (int i = 0; i < setdata.Tables[0].Rows.Count; i++)
     {
         _account.ID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[12].ToString());
         _account.Fname = setdata.Tables[0].Rows[0].ItemArray[0].ToString();
         _account.Lname = setdata.Tables[0].Rows[0].ItemArray[1].ToString();
         _account.email = setdata.Tables[0].Rows[0].ItemArray[2].ToString();
         _account.PermanentAdd = setdata.Tables[0].Rows[0].ItemArray[3].ToString();
         _account.nationality = setdata.Tables[0].Rows[0].ItemArray[4].ToString();
         _account.ppno = setdata.Tables[0].Rows[0].ItemArray[5].ToString();
         _account.UserRole = setdata.Tables[0].Rows[0].ItemArray[6].ToString();
         _account.username = setdata.Tables[0].Rows[0].ItemArray[7].ToString();
         _account.password = setdata.Tables[0].Rows[0].ItemArray[8].ToString();
         _account.againpassword = setdata.Tables[0].Rows[0].ItemArray[9].ToString();
         _account.Sex = setdata.Tables[0].Rows[0].ItemArray[10].ToString();
         _account.phoneNum = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[11].ToString());
     }
     return _account;
 }
        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);
 }
Exemplo n.º 5
0
 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());
 }
Exemplo n.º 6
0
 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 });
 }
Exemplo n.º 7
0
 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());
 }
Exemplo n.º 8
0
        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();
            }
        }
Exemplo n.º 10
0
 public RoomRepository(Account _userinformation)
 {
     this._userinformation = _userinformation;
 }
Exemplo n.º 11
0
 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 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");
 }
Exemplo n.º 14
0
 public List<Account> getList()
 {
     List<Account> AccountList = new List<Account>();
     conn.Open();
     DataSet setdata = new DataSet();
     SqlCeCommand cmd = new SqlCeCommand("select * from UserInformation", conn);
     SqlCeDataAdapter adapter = new SqlCeDataAdapter();
     adapter.SelectCommand = cmd;
     adapter.Fill(setdata);
     Account _account = new Account();
     for (int i = 0; i < setdata.Tables[0].Rows.Count; i++)
     {
         _account = new Account();
         _account.ID = Int64.Parse(setdata.Tables[0].Rows[i].ItemArray[12].ToString());
         _account.Fname = setdata.Tables[0].Rows[i].ItemArray[0].ToString();
         _account.Lname = setdata.Tables[0].Rows[i].ItemArray[1].ToString();
         _account.email = setdata.Tables[0].Rows[i].ItemArray[2].ToString();
         _account.PermanentAdd = setdata.Tables[0].Rows[i].ItemArray[3].ToString();
         _account.nationality = setdata.Tables[0].Rows[i].ItemArray[4].ToString();
         _account.ppno = setdata.Tables[0].Rows[i].ItemArray[5].ToString();
         _account.UserRole = setdata.Tables[0].Rows[i].ItemArray[6].ToString();
         _account.username = setdata.Tables[0].Rows[i].ItemArray[7].ToString();
         _account.password = setdata.Tables[0].Rows[i].ItemArray[8].ToString();
         _account.againpassword = setdata.Tables[0].Rows[i].ItemArray[9].ToString();
         _account.Sex = setdata.Tables[0].Rows[i].ItemArray[10].ToString();
         _account.phoneNum = Int64.Parse(setdata.Tables[0].Rows[i].ItemArray[11].ToString());
         AccountList.Add(_account);
     }
     conn.Close();
     return AccountList;
 }
 public ActionResult UpdateDataProcess(Account model)
 {
     AccountRepository _AccountRepository = new AccountRepository(model);
     _AccountRepository.updateData();
     return RedirectToAction("AccountList");
 }
Exemplo n.º 16
0
 public AccountRepository(Account userinformation)
 {
     this._userinformation = userinformation;
 }
Exemplo n.º 17
0
 public Account getItem()
 {
     conn.Open();
     DataSet setdata = new DataSet();
     SqlCeCommand cmd = new SqlCeCommand("select * from UserInformation where User_ID=" + this._userinformation.ID.ToString(), conn);
     SqlCeDataAdapter adapter = new SqlCeDataAdapter();
     adapter.SelectCommand = cmd;
     adapter.Fill(setdata);
     Account _account = new Account();
     _account.ID = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[12].ToString());
     _account.Fname = setdata.Tables[0].Rows[0].ItemArray[0].ToString();
     _account.Lname = setdata.Tables[0].Rows[0].ItemArray[1].ToString();
     _account.email = setdata.Tables[0].Rows[0].ItemArray[2].ToString();
     _account.PermanentAdd = setdata.Tables[0].Rows[0].ItemArray[3].ToString();
     _account.nationality = setdata.Tables[0].Rows[0].ItemArray[4].ToString();
     _account.ppno = setdata.Tables[0].Rows[0].ItemArray[5].ToString();
     _account.UserRole = setdata.Tables[0].Rows[0].ItemArray[6].ToString();
     _account.username = setdata.Tables[0].Rows[0].ItemArray[7].ToString();
     _account.password = setdata.Tables[0].Rows[0].ItemArray[8].ToString();
     _account.againpassword = setdata.Tables[0].Rows[0].ItemArray[9].ToString();
     _account.Sex = setdata.Tables[0].Rows[0].ItemArray[10].ToString();
     _account.phoneNum = Int64.Parse(setdata.Tables[0].Rows[0].ItemArray[11].ToString());
     conn.Close();
     return _account;
 }
 public ActionResult UpdateData(Account _model)
 {
     return View(_model);
 }
Exemplo n.º 19
0
        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);
        }