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; }
private void detach_Reservations(Reservation entity) { this.SendPropertyChanging(); entity.Book = null; }
private void attach_Reservations(Reservation entity) { this.SendPropertyChanging(); entity.Book = this; }
partial void DeleteReservation(Reservation instance);
partial void UpdateReservation(Reservation instance);
partial void InsertReservation(Reservation instance);