public List<Reservation> ViewUpcomingUserRes(string usrID)
 {
     DBWrapper wrap = new DBWrapper("localhost", "finalproject", "devon", "devon");
     wrap.Connect();
     List<Reservation> usrRes = wrap.GetUpcomingUserRes(usrID);
     wrap.Disconnect();
     return usrRes;
 }
        public List<Reservation> ViewReservationsByRoom(string date, string rm)
        {
            DBWrapper wrap = new DBWrapper("localhost", "finalproject", "devon", "devon");
            wrap.Connect();
            List<Reservation> rmRes = wrap.GetReservationsByRoom(date, rm);

            wrap.Disconnect();

            return rmRes;
        }
        public List<Reservation> ViewReservations(string date)
        {
            DBWrapper wrap = new DBWrapper("localhost", "finalproject", "devon", "devon");
            wrap.Connect();
            List<Reservation> dayRes = wrap.GetReservationsByDay(date);

            wrap.Disconnect();

            return dayRes;
        }
Example #4
0
        public bool Cancel()
        {
            DateTime time = DateTime.Now;
            string timeFormat = "HH:mm:ss";

            string today = time.ToString("yyyy-MM-dd");

            //check for possible time-based errors before submitting the cancellation to DB
            if (string.Compare(resDate, today) < 0)
            {
                cancelMsg = "Unable to cancel reservation: date has already passed.";
                return false;
            }
            else if (resDate == today)
            {
                if (string.Compare(resStartTime, time.ToString(timeFormat)) < 0)
                {
                    cancelMsg = "Unable to cancel reservation: reserved time has already passed.";
                    return false;
                }
            }

            //check for possible user-based errors before submitting the cancellation to DB
            // 12/5/12 May not need to anymore

            //connect to DB for cancellation
            DBWrapper wrap = new DBWrapper("localhost", "finalproject", "devon", "devon");
            wrap.Connect();
            wrap.CancelReservation(resID);
            wrap.Disconnect();

            cancelMsg = "Cancellation successful.";
            NotifyCancelByEmail();
            return true;
        }
Example #5
0
        private string SubmitToDB()
        {
            //dbwrapper will check for errors for this method

            string reservationID;

            DBWrapper wrap = new DBWrapper("localhost", "finalproject", "devon", "devon");
            wrap.Connect();
            reservationID = wrap.MakeReservation(resDate, resStartTime, resEndTime, resRoom, resUserID);

            wrap.Disconnect();

            if (reservationID == null)
            {
                makeResMsg = "Error in making reservation. Data not submitted to DB.";
            }
            else
                makeResMsg = "Successfully made reservation: submitted to DB.";

            return reservationID;
        }
Example #6
0
        public bool Change(string newDate, string newStartTime, string newEndTime)
        {
            DateTime time = DateTime.Now;
            string timeFormat = "HH:mm:ss";

            string today = time.ToString("yyyy-MM-dd");

            //check for possible errors before submitting the change to DB
            if (string.Compare(resDate, today) < 0)
            {
                changeMsg = "Unable to change reservation: date has already passed.";
                return false;
            }
            else if (resDate == today)
            {
                if (string.Compare(resStartTime, time.ToString(timeFormat)) < 0)
                {
                    changeMsg = "Unable to change reservation: reserved time has already passed.";
                    return false;
                }
            }

            //check for possible user-based errors before submitting the cancellation to DB

            //connect to DB for change
            DBWrapper wrap = new DBWrapper("localhost", "finalproject", "devon", "devon");
            wrap.Connect();
            wrap.ChangeReservation(resID, resDate, resStartTime, resEndTime, resRoom, resUserID);
            wrap.Disconnect();

            cancelMsg = "Change successful.";
            return true;
        }