예제 #1
0
        public int makeReservation(int uID, int catNum, string pri)
        {
            var result = from re in db.Reservations
                                      where re.userID == uID && re.catalogueID == catNum && re.state != RS_CLOSE
                                      select re;
            if (result.Count() > 0)
            {
                ErrorMessage = "The book is already reserved.";
                return -1;
            }

            Reservation reservation = new Reservation
            {
                userID = uID,
                catalogueID = catNum,
                reserveDate = DateTime.Today,
                state = RS_WAIT,
                priority = pri
            };

            try
            {
                db.Reservations.InsertOnSubmit(reservation);
                db.SubmitChanges(); //submit the action to customer table
            }
            catch (Exception ex)
            {
                ErrorMessage = "Make reservation error:/n" + ex.Message;
                return -1;
            }

            int reserveNum = reservation.ReserveID;
            return reserveNum;
        }
예제 #2
0
		private void detach_Reservations(Reservation entity)
		{
			this.SendPropertyChanging();
			entity.Book = null;
		}
예제 #3
0
		private void attach_Reservations(Reservation entity)
		{
			this.SendPropertyChanging();
			entity.Book = this;
		}
예제 #4
0
 partial void DeleteReservation(Reservation instance);
예제 #5
0
 partial void UpdateReservation(Reservation instance);
예제 #6
0
 partial void InsertReservation(Reservation instance);