示例#1
0
        //Changes the start or end date of a reservation
        public int ChangeReservation(int reservationNumber, DateTime startDate, DateTime endDate)
        {
            e errCode = e.success;

            if (Validation.invalidRes(reservationNumber))
            {
                errCode = e.invalidRes;
            }
            else if (Validation.activeRes(reservationNumber))
            {
                errCode = e.activeRes;
            }
            else if (Validation.sBeforeToday(startDate))
            {
                errCode = e.sBeforeToday;
            }
            else if (Validation.sAfterEnd(startDate, endDate))
            {
                errCode = e.sAfterEnd;
            }
            else
            {
                ReservationDB resDB = new ReservationDB();
                if (!resDB.Update(reservationNumber, startDate, endDate))
                {
                    errCode = e.updateFail;
                }
            }

            return(Convert.ToInt16(errCode));
        }