コード例 #1
0
        public bool Add(LibraryBookBLL item, out string serverSideError)
        {
            if (item.IsValid)
            {
                using (ProtoLibEntities context = new ProtoLibEntities())
                {
                    if (DatabaseDependantValidation(item, context, out serverSideError))
                    {
                        LibraryBook newLibBook = new LibraryBook();
                        CrossLayerEntityConverter.LibraryBookBllToDal(context, item, newLibBook);
                        context.LibraryBooks.AddObject(newLibBook);

                        context.SaveChanges();

                        return true;
                    }
                }

                return false;
            }
            else
            {
                serverSideError = "The LibraryBook object is invalid";
                return false;
            }
        }
コード例 #2
0
        public static void LibraryBookDalToBll(ProtoLibEntities context, LibraryBookBLL bllLibBook, LibraryBook dalLibBook)
        {
            bllLibBook.ItemID = dalLibBook.BookID;

            bllLibBook.Price = dalLibBook.Price;
            bllLibBook.ObtainedFrom = dalLibBook.ObtainedFrom;
            bllLibBook.BookDetailsId = dalLibBook.BookInfoID;
            bllLibBook.Status = (BookStatusBLL)(dalLibBook.StatusID);
        }
コード例 #3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the LibraryBooks EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToLibraryBooks(LibraryBook libraryBook)
 {
     base.AddObject("LibraryBooks", libraryBook);
 }
コード例 #4
0
        public static void LibraryBookBllToDal(ProtoLibEntities context, LibraryBookBLL bllLibBook, LibraryBook dalLibBook)
        {
            dalLibBook.Price = bllLibBook.Price;
            dalLibBook.ObtainedFrom = bllLibBook.ObtainedFrom;
            dalLibBook.BookDetails = (from book in context.BookDetailsSet where book.BookDetailsID == bllLibBook.BookDetailsId select book).SingleOrDefault();
            dalLibBook.BookStatus = (from st in context.BookStatus1 where st.StatusID == (int)bllLibBook.Status select st).Single();

            //TODO: Implement branch stuff
            dalLibBook.Branch = (from br in context.Branches where br.BranchID == 100 select br).First();
        }
コード例 #5
0
 /// <summary>
 /// Create a new LibraryBook object.
 /// </summary>
 /// <param name="bookID">Initial value of the BookID property.</param>
 /// <param name="bookInfoID">Initial value of the BookInfoID property.</param>
 /// <param name="statusID">Initial value of the StatusID property.</param>
 /// <param name="branchID">Initial value of the BranchID property.</param>
 public static LibraryBook CreateLibraryBook(global::System.Int32 bookID, global::System.Int32 bookInfoID, global::System.Int32 statusID, global::System.Int32 branchID)
 {
     LibraryBook libraryBook = new LibraryBook();
     libraryBook.BookID = bookID;
     libraryBook.BookInfoID = bookInfoID;
     libraryBook.StatusID = statusID;
     libraryBook.BranchID = branchID;
     return libraryBook;
 }