Click here to Skip to main content
16,015,097 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
CSS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Shopping
{
    public class Cart
    {
        private int _IDproduct;
        private string _nameProduct;
        private int _Quantity;
        private string _ImageUrl;
        private double _Price;
        private double _Total;




       public Cart(){}
       public  Cart(int IDProduct, string NameProduct, int Quantity, string ImageURL, double Price){

           _IDproduct = IDProduct;
           _nameProduct = NameProduct;
           _Quantity = Quantity;
           _ImageUrl = ImageURL; ;
           _Price = Price;
           _Total = Price*Quantity;
                }
       public int IDProduct {
           get { return _IDproduct; }
           set { _IDproduct = value; }
       }

       public string NameProduct
       {
           get { return _nameProduct; }
           set { _nameProduct = value; }
       }

       public int Quantity
       {
           get { return _Quantity; }
           set { _Quantity = value; }
       }

       public string ImageURL
       {
           get { return _ImageUrl; }
           set { _ImageUrl = value; }
       }

       public double Price
       {
           get { return _Price; }
           set { _Price = value; }
       }

       public double Total
       {
           get { return _Price*_Quantity; }

       }
             }

        public  class CartItem{

            private DateTime _dateCreate;
            private DateTime _dateUpdate;
            private List<Cart> _Item;
            public CartItem() {

             if(this._Item==null){

                     this._Item = new List<Cart>();
                     this._dateCreate = DateTime.Now;
             }
                        }

            public List<Cart> Item {
                get { return _Item; }
                set { _Item = value; }
            }

            public void Insert(int IDProduct, int Quantity, string ImageURL, string NameProuct, double Price) {

   int ItemIndex = ItemIndexOfID(ProductID);Error at ItemIndexOfID?
            
}


        }



}
Posted
Comments
Sergey Alexandrovich Kryukov 30-Oct-13 1:17am    
Off-topic; this is not a forum on cognitive science... :-)

The post is just a code dump. You did not explain what did you want to achieve and did not show the definition or even declaration of ItemIndexOfID. And you did not even explain if this is a compilation error or exception in your code.

—SA
johannesnestler 30-Oct-13 12:49pm    
Why don't you show the code producing the error "ItemIndexOfID" (which I think should be named ItemIndexFromID) - chances are high your error comes from there. All the other code you showed looks completly irrelevant for your question... - And we are programmers, the word "error" has to many meanings for us. What is the error you "see", an exception? the wrong index? -> what kind of error, and what error information you have should always be mentioned in a forum question regarding that error, don't you agree?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900