protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BooksLogic  bl = new BooksLogic();
                List <Book> notBorrowedBooks = bl.GetNotBorrowedBooks();

                if (notBorrowedBooks.Count == 0)
                {
                    CannotAddBorrowing.Visible = true;
                    CanAddBorrowing.Visible    = false;
                }
                else
                {
                    CanAddBorrowing.Visible    = true;
                    CannotAddBorrowing.Visible = false;

                    var db = new BookLibraryContext();
                    FillInMemberControl(db);
                    FillInBookControl(db);
                    FromDate.Text = DateTime.Now.ToString("MM/dd/yyyy");
                }

                ViewState["ReferrerUrl"] = Request.UrlReferrer.ToString();
            }
        }
Ejemplo n.º 2
0
        public void TestInitialization()
        {
            _bookLogic = new BooksLogic(_mockMapper.Object, _mockBookRepo.Object);
            _bookVM    = Builder <Book> .CreateNew().Build();

            _bookDM = Builder <DataModel.Book> .CreateNew().Build();
        }
Ejemplo n.º 3
0
 protected override void OnClosed()
 {
     base.OnClosed();
     UsersLogic.Dispose();
     BooksLogic.Dispose();
     OrdersLogic.Dispose();
 }
Ejemplo n.º 4
0
        private void OnOrderEditViewModelClosed(object sender, EventArgs e)
        {
            var orderEditViewModel = sender as OrderEditViewModel;

            if (orderEditViewModel != null && orderEditViewModel.ModalResult)
            {
                BooksLogic.Dispose();
                BooksLogic = ServiceLocator.GetInstance <IBooksLogic>();
                Search();
            }
        }
        protected void DeleteBookButton_Click(Object sender, EventArgs e)
        {
            Button     btn          = (Button)sender;
            string     bookID       = btn.CommandArgument.ToString();
            BooksLogic bl           = new BooksLogic();
            bool       savedChanges = bl.DeleteBook(Convert.ToInt32(bookID));

            if (savedChanges)
            {
                Response.Redirect("AdminBooks");
            }
        }
Ejemplo n.º 6
0
        private void Search()
        {
            using (StartOperation())
            {
                if (ISBN.IsNullOrEmpty() && SearchString.IsNullOrEmpty())
                {
                    Amounts = new BookAmount[] { };
                    return;
                }

                Amounts = BooksLogic.SearchBooks(Employee.BranchId, ISBN, SearchString);
            }
        }
        protected void SaveBookButton_Click(object sender, EventArgs e)
        {
            BooksLogic bl          = new BooksLogic();
            bool       saveSuccess = bl.AddBook(ISBN.Text, BookTitle.Text, Category.SelectedValue, Author.SelectedValue, Publisher.Text, PublicationYear.Text, Price.Text);

            if (saveSuccess)
            {
                ReturnToSender();
            }
            else
            {
                FailureText.Text     = "Unable to add a new book to database.";
                ErrorMessage.Visible = true;
            }
        }
        protected void UpdateBookButton_Click(object sender, EventArgs e)
        {
            BooksLogic bl          = new BooksLogic();
            bool       saveSuccess = bl.UpdateBook(Convert.ToInt32(Request["id"]), ISBN.Text, BookTitle.Text, Category.SelectedValue, Author.SelectedValue, Publisher.Text, PublicationYear.Text, Price.Text);

            if (saveSuccess)
            {
                ReturnToSender();
            }
            else
            {
                FailureText.Text     = "Unable to update the book.";
                ErrorMessage.Visible = true;
            }
        }
Ejemplo n.º 9
0
        public IHttpActionResult UploadPic(int bookId)
        {
            string imageName   = "picBook" + bookId + ".jpg";
            var    httpRequest = HttpContext.Current.Request;

            if (httpRequest.Files.Count > 0)
            {
                foreach (string file in httpRequest.Files)
                {
                    var postedFile = httpRequest.Files[file];

                    var filePath = HttpContext.Current.Server.MapPath("~/Images/" + imageName);
                    postedFile.SaveAs(filePath);
                }
            }
            BooksLogic.saveImageName(bookId, imageName);
            return(Ok(1));
        }
        protected void FillInBookControl(BookLibraryContext db)
        {
            if (Request.Params.AllKeys.Contains("bookID"))
            {
                int  bookID = Convert.ToInt32(Request["bookID"]);
                Book book   = db.Books.Single(b => b.BookID == bookID);
                BookTextBox.Text = book.ISBN + " " + book.Title;

                BookListLabel.Visible    = false;
                BookList.Visible         = false;
                BookTextBoxLabel.Visible = true;
                BookTextBox.Visible      = true;
            }
            else
            {
                BookList.DataValueField = "BookID";
                BookList.DataTextField  = "DisplayName";

                BooksLogic  bl = new BooksLogic();
                List <Book> notBorrowedBooks = bl.GetNotBorrowedBooks();

                /*
                 * foreach (Book b in notBorrowedBooks)
                 * {
                 *  b.DisplayName = b.ISBN + " " + b.Title;
                 * }
                 */
                BookList.DataSource = notBorrowedBooks;
                BookList.DataBind();

                BookListLabel.Visible    = true;
                BookList.Visible         = true;
                BookTextBoxLabel.Visible = false;
                BookTextBox.Visible      = false;
            }
        }
Ejemplo n.º 11
0
 public void editBook(Books b)
 {
     BooksLogic.editBook(b);
     return;
 }
Ejemplo n.º 12
0
 public List <BookToList> Serch(string name, int?categoryIdSearch, string autherToSerch, string publishingToSerch, int?cityCode)
 {
     return(BooksLogic.Serch(name, categoryIdSearch, autherToSerch, publishingToSerch, cityCode));
 }
Ejemplo n.º 13
0
 public List <Books> getAllUsersBooksByIDU(int idu)
 {
     return(BooksLogic.getAllUsersBooksByIDU(idu));
 }
Ejemplo n.º 14
0
 public void deleteBookFromMyBuskate(int idB, int idU)
 {
     BooksLogic.deleteBookFromMyBuskate(idB, idU);
 }
Ejemplo n.º 15
0
 public void addBookToMybasket(MyBasketOfBooksModels obj)
 {
     BooksLogic.addBookToMybasket(obj);
     return;
 }
Ejemplo n.º 16
0
 public List <Books> getAllMyBasket(int idU)
 {
     return(BooksLogic.getAllMyBasket(idU));
 }
Ejemplo n.º 17
0
 public void PromoteNumberOfViewers(int idBook)
 {
     BooksLogic.PromoteNumberOfViewers(idBook);
     return;
 }
Ejemplo n.º 18
0
 public int InsertBook(Books newBook)
 {
     return(BooksLogic.InsertBook(newBook));
 }
Ejemplo n.º 19
0
 internal ConsoleUI()
 {
     this.bl = new BooksLogic();
 }
Ejemplo n.º 20
0
 public List <BookToList> GetAllBook()
 {
     return(BooksLogic.GetAllBook());
 }
Ejemplo n.º 21
0
 private void ReloadBooks()
 {
     AvailableBooks = BooksLogic.SearchBooks(_employee.BranchId, ISBN.TrimSafe(), onHandOnly: true);
 }
Ejemplo n.º 22
0
 public void rateBook(int idB, string desc, int rate)
 {
     BooksLogic.rateBook(idB, desc, rate);
 }
Ejemplo n.º 23
0
 //בזה כן משתמשים
 public Statistics GetAllStatisticsToBook(int IdB)
 {
     return(BooksLogic.Fullstatistics(IdB));
 }
Ejemplo n.º 24
0
 public void deleteBook(int idB)
 {
     BooksLogic.deleteBook(idB);
 }
Ejemplo n.º 25
0
 public Books GetBookById(int idBook)
 {
     return(BooksLogic.getBookAndOtherDetailesToStatisckById(idBook));
 }