예제 #1
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            Dialog.Window.RequestFeature(WindowFeatures.NoTitle); // sets the title bar to invisable
            base.OnActivityCreated(savedInstanceState);
            Dialog.Window.Attributes.WindowAnimations = Resource.Style.dialog_animation;

            List <bookstore.backend.Class.IBooksWithInterface> temList = new List <IBooksWithInterface>();
            decimal totalcost = 0;

            foreach (var book in InCart.BooksInCart)
            {
                int status = bookstore.backend.Class.ShopingCart.check(book.InStock, book.NumberOfThisBookIncart);
                if (status != 0)
                {
                    totalcost = bookstore.backend.Class.ShopingCart.TotalCost(totalcost, book.Price, status);
                    IBooksWithInterface temp = new IBooksWithInterface(book.Title, book.Author, book.Price, book.InStock);
                    temp.NumberOfThisBookIncart = status;
                    temList.Add(temp);
                }
            }
            IBook_LV_Adpater adapterBooksBought = new IBook_LV_Adpater(this.Activity, temList);

            fragLVbooksBought.Adapter = adapterBooksBought;

            List <bookstore.backend.Class.IBooksWithInterface> temList2 = new List <IBooksWithInterface>();

            foreach (var book in InCart.BooksInCart)
            {
                int status = bookstore.backend.Class.ShopingCart.outofstock(book.InStock, book.NumberOfThisBookIncart);
                if (status != -1)
                {
                    IBooksWithInterface temp = new IBooksWithInterface(book.Title, book.Author, book.Price, book.InStock);
                    temp.NumberOfThisBookIncart = status;
                    temList2.Add(temp);
                }
            }
            fragtxtTotalcost.Text = "Totalcost: " + totalcost.ToString();

            IBook_LV_Adpater adapterBooksNotBought = new IBook_LV_Adpater(this.Activity, temList2);

            fragLVbooksNonBought.Adapter = adapterBooksNotBought;
        }
예제 #2
0
        private List <IBooksWithInterface> getLVcart()
        {
            List <IBooksWithInterface> templist = new List <IBooksWithInterface>();

            int i = 0;

            foreach (var row in LVCART.Items)
            {
                string              title   = LVCART.Items[i].SubItems[0].Text;
                string              author  = LVCART.Items[i].SubItems[1].Text;
                decimal             price   = decimal.Parse(LVCART.Items[i].SubItems[2].Text);
                int                 instock = int.Parse(LVCART.Items[i].SubItems[3].Text);
                int                 incart  = int.Parse(LVCART.Items[i].SubItems[4].Text);
                IBooksWithInterface temp    = new IBooksWithInterface(title, author, price, instock, incart);
                templist.Add(temp);

                i++;
            }

            return(templist);
        }
예제 #3
0
        private void moveSelectedToCart()
        {
            // nothing selected, just return
            if (LVSeach.SelectedItems.Count == 0)
            {
                return;
            }

            List <IBooksWithInterface> templist = new List <IBooksWithInterface>();
            string  title   = LVSeach.SelectedItems[0].SubItems[0].Text;
            string  author  = LVSeach.SelectedItems[0].SubItems[1].Text;
            decimal price   = decimal.Parse(LVSeach.SelectedItems[0].SubItems[2].Text);
            int     instock = int.Parse(LVSeach.SelectedItems[0].SubItems[3].Text);
            //download whats inside the cart
            IBooksWithInterface temp = new IBooksWithInterface(title, author, price, instock);

            templist = getLVcart(); // call function here instead

            LVCART.Items.Clear();   // now clear it
            PopulateInCartListView(UITools.checkIFExistInCart(totalcost, temp, templist, out totalcost).AsEnumerable());

            tbTotalCost.Text = totalcost.ToString();
        }