Beispiel #1
0
 public ActionResult BuyingBooksCourseFiltered(int courseFilter)
 {
     var book = new ENNewBook();
     var books = book.ReadAll();
     books = books.Where(b => b.Subject.Course.Id == courseFilter).ToList();
     return View("BuyingBooks", books);
 }
 public ActionResult AddToCart(int id)
 {
     var book = new ENNewBook(id);
     //var book = new Book(isbn, des, price, img);
     ShoppingCart.Instance.AddItem(book);
     return Content("true");
 }
 public ActionResult RemoveFromCart(ENNewBook newbook)
 {
     var book = new ENNewBook();
     var nbook = book.Read(newbook.Id);
     ShoppingCart.Instance.RemoveItem(nbook);
     return RedirectToAction("Cart");
 }
Beispiel #4
0
 public void NewBookVerifyingPrice()
 {
     var newBook = new ENNewBook();
     newBook = newBook.Read(1);
     var price = newBook.Price;
     //used to fail casting
 }
 public ENLineCustomerOrder(int idLines_Customers, int customerOrder, ENNewBook newBook, int quantity)
 {
     this.idLines_Customers = idLines_Customers;
     this.idCustomerOrder = customerOrder;
     this.newBook = newBook;
     this.quantity = quantity;
     this.total = quantity * newBook.Price;
     cad = new CADLineCustomerOrder();
 }
Beispiel #6
0
 public ENLineCustomerOrder(int idLines_Customers, int customerOrder, ENNewBook newBook, int quantity)
 {
     this.idLines_Customers = idLines_Customers;
     this.idCustomerOrder   = customerOrder;
     this.newBook           = newBook;
     this.quantity          = quantity;
     this.total             = quantity * newBook.Price;
     cad = new CADLineCustomerOrder();
 }
Beispiel #7
0
 public ENLineCustomerOrder()
 {
     id = 0;
     idLines_Customers = 1;
     idCustomerOrder   = 0;
     newBook           = null;
     total             = 0;
     cad = new CADLineCustomerOrder();
 }
 public ENLineCustomerOrder()
 {
     id = 0;
     idLines_Customers = 1;
     idCustomerOrder = 0;
     newBook = new ENNewBook();
     total = 0;
     cad = new CADLineCustomerOrder();
 }
Beispiel #9
0
 public ENLineDistributorsOrder(int idLines_DOrders, int iddistributororder, ENNewBook newBook, int quantity)
 {
     this.id = 0;
     this.idLines_DOrders    = idLines_DOrders;
     this.iddistributororder = iddistributororder;
     this.newBook            = newBook;
     this.quantity           = quantity;
     cad   = new CADLineDistributorsOrder();
     total = quantity * newBook.Price;
 }
Beispiel #10
0
 public ENLineDistributorsOrder(int idLines_DOrders, int iddistributororder, ENNewBook newBook, int quantity)
 {
     this.id = 0;
     this.idLines_DOrders = idLines_DOrders;
     this.iddistributororder = iddistributororder;
     this.newBook = newBook;
     this.quantity = quantity;
     cad = new CADLineDistributorsOrder();
     total = quantity * newBook.Price;
 }
Beispiel #11
0
 public ENLineDistributorsOrder()
 {
     Id = 0;
     idLines_DOrders = 0;
     iddistributororder = 0;
     newBook = null;
     quantity = 0;
     cad = new CADLineDistributorsOrder();
     total = 0;
 }
Beispiel #12
0
 public ENLineDistributorsOrder()
 {
     Id = 0;
     idLines_DOrders    = 0;
     iddistributororder = 0;
     newBook            = null;
     quantity           = 0;
     cad   = new CADLineDistributorsOrder();
     total = 0;
 }
Beispiel #13
0
        /// <summary>
        /// Busca el libro nuevo en la base de datos y lo devuelve
        /// </summary>
        /// <param name="id">Identificador del libro a buscar.</param>
        /// <returns>ENNewBook del libro encontrado en la base de datos.</returns>
        public ENNewBook Read(int id)
        {
            ENNewBook ret = new ENNewBook();

            cad = new CADNewBook();
            List <object> param = new List <object>();

            param.Add((object)id);
            ret.FromRow(cad.Select(param));
            return(ret);
        }
Beispiel #14
0
        /// <summary>
        /// Devuelve todos los libros nuevos que existen en la base de datos.
        /// </summary>
        /// <returns>Lista de ENNewBook con todos los libros nuevos de la base de datos.</returns>
        public List <ENNewBook> ReadAll()
        {
            List <ENNewBook> ret   = new List <ENNewBook>();
            DataTable        tabla = cad.SelectAll();

            foreach (DataRow rows in tabla.Rows)
            {
                ENNewBook nuevo = new ENNewBook();
                nuevo.FromRow(rows);
                ret.Add(nuevo);
            }
            return(ret);
        }
 public ActionResult BuyingBooks()
 {
     var book = new ENNewBook();
     var books = book.ReadAll();
     /*
     var book = new Book("012345", "Mi bonico libro daprender", 99.01f, "/Scripts/widgets/jqwidgets/images/books/Carrie.jpg");
     var book1 = new Book("012346", "Sueños rallantes", 34.29f, "/Scripts/widgets/jqwidgets/images/inception.jpg");
     var book2 = new Book("012347", "El oso peleon", 1.10f, "/Scripts/widgets/jqwidgets/images/kungfupanda.png");
     var book3 = new Book("012348", "Hostias como panes", 22.99f, "/Scripts/widgets/jqwidgets/images/knockout.png");
     var books = new List<Book>();
     books.Add(book);
     books.Add(book1);
     books.Add(book2);
     books.Add(book3);*/
     return View("BuyingBooks", books);
 }
Beispiel #16
0
        /**
         * AddItem() - Adds an item to the shopping
         */
        public void AddItem(ENNewBook book)
        {
            // Create a new item to add to the cart
            ENNewBook b = new ENNewBook(book.Id);
            CartItem newItem = new CartItem(b);

            // If this item already exists in our list of items, increase the quantity
            // Otherwise, add the new item to the list
                foreach (CartItem item in Items)
                {
                    if (item.BookIsbn == book.IdBook)
                    {
                        item.Quantity++;
                        return;
                    }
                }

                newItem.Quantity = 1;
                Items.Add(newItem);
        }
Beispiel #17
0
        public List <ENNewBook> Filter(String where)
        {
            List <ENNewBook> ret   = new List <ENNewBook>();
            DataTable        table = cad.SelectWhere(where);

            try
            {
                foreach (DataRow row in table.Rows)
                {
                    ENNewBook course = new ENNewBook();
                    course.FromRow(row);
                    ret.Add(course);
                }
                return(ret);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #18
0
        public void AddLine(ENNewBook book, int quantity)
        {
            ENLineDistributorsOrder line = new ENLineDistributorsOrder(0, this.id, book, quantity);

            lines.Add(line);
        }
Beispiel #19
0
 /**
  * RemoveItem() - Removes an item from the shopping cart
  */
 public void RemoveItem(ENNewBook book)
 {
     CartItem removedItem = new CartItem(book);
     foreach (var item in Items)
     {
         if (item.Equals(removedItem))
         {
             Items.Remove(item);
             break;
         }
     }
 }
 protected override void FromRow(DataRow Row)
 {
     this.id = (int) Row["id"];
     idLines_Customers = (int) Row["idLines_Customers"];
     idCustomerOrder = (int)    Row["COrder"];
     newBook = newBook.Read( (int)Row["idNews"]);
     quantity = (int)  Row["Quantity"];
 }
Beispiel #21
0
 public void AddLine(ENNewBook book, int quantity)
 {
     ENLineCustomerOrder line = new ENLineCustomerOrder(0, this.id, book, quantity);
     lines.Add(line);
 }
Beispiel #22
0
 /// <summary>
 /// Devuelve todos los libros nuevos que existen en la base de datos.
 /// </summary>
 /// <returns>Lista de ENNewBook con todos los libros nuevos de la base de datos.</returns>
 public List<ENNewBook> ReadAll()
 {
     List<ENNewBook> ret = new List<ENNewBook>();
     DataTable tabla = cad.SelectAll();
     foreach (DataRow rows in tabla.Rows)
     {
         ENNewBook nuevo = new ENNewBook();
         nuevo.FromRow(rows);
         ret.Add(nuevo);
     }
     return ret;
 }
Beispiel #23
0
 /// <summary>
 /// Busca el libro nuevo en la base de datos y lo devuelve
 /// </summary>
 /// <param name="id">Identificador del libro a buscar.</param>
 /// <returns>ENNewBook del libro encontrado en la base de datos.</returns>
 public ENNewBook Read(int id)
 {
     ENNewBook ret = new ENNewBook();
     cad = new CADNewBook();
     List<object> param = new List<object>();
     param.Add((object)id);
     ret.FromRow(cad.Select(param));
     return ret;
 }
Beispiel #24
0
        public List<ENNewBook> Filter(String where)
        {
            List<ENNewBook> ret = new List<ENNewBook>();
            DataTable table = cad.SelectWhere(where);

            try
            {

                foreach (DataRow row in table.Rows)
                {
                    ENNewBook course = new ENNewBook();
                    course.FromRow(row);
                    ret.Add(course);

                }
                return ret;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #25
0
        public void AddLine(ENNewBook book, int quantity)
        {
            ENLineCustomerOrder line = new ENLineCustomerOrder(0, this.id, book, quantity);

            lines.Add(line);
        }
Beispiel #26
0
 public CartItem(ENNewBook book)
 {
     this.Book = book;
     this.Id = book.Id;
     this.Quantity = 1;
 }
Beispiel #27
0
 public void AddLine(ENNewBook book, int quantity)
 {
     ENLineDistributorsOrder line = new ENLineDistributorsOrder(0, this.id, book, quantity);
     lines.Add(line);
 }