protected void Page_Load(object sender, EventArgs e)
        {
            Dictionary<int, int> myDictionary = (Dictionary<int, int>)Session["shoppingCart"];
                // foreach (var my in myDictionary) { }
                EntityManager<ProductListing> object1 = new EntityManager<ProductListing>();
                ProductListing mgr_productListing = new ProductListing();
                List<ProductListing> list2 = new List<ProductListing>();
                // myDictionary.Add(984, 1);

                foreach (var pair in myDictionary)
                {

                    mgr_productListing.ProductID = pair.Key;
                    List<ProductListing> list3 = new List<ProductListing>();
                    list3 = object1.Search(mgr_productListing);
                    list4.Add(pair.Value);
                    list2.AddRange(list3);
                }
                if (!IsPostBack)
                {
                    GridView1.DataSource = list2;
                    GridView1.DataBind();
                    lblTotalValue.Text = totalvalue.ToString();
                }
        }
Esempio n. 2
0
        protected void btnfinalize_Click(object sender, EventArgs e)
        {
            Dictionary<int, int> cartItems1 = (Dictionary<int, int>)Session["ShoppingCart"];
            int prodid1;
            int prodqty1;

            foreach (KeyValuePair<int, int> productidQty in cartItems1)
            {
                prodid1 = productidQty.Key;
                prodqty1 = productidQty.Value;

                EntityManager<ProductListing> pcat = new EntityManager<ProductListing>();
                ProductListing procat = new ProductListing();
                procat.ProductID = prodid1;
                List<ProductListing> prodcatID = pcat.Search(procat);

            }

               // ShoppingCrt.
            //EntityManager<ShippingAddress> pcat = new EntityManager<ShippingAddress>();
            //ShippingAddress procat = new ShippingAddress();
            //procat.CustomerID = 10;
            //procat.AddressLine1 = "sdfag";

            //List<ShippingAddress> prodcatID = pcat.Insert(procat);
        }
        public void refreshdata_desc()
        {
            EntityManager<ProductListing> object1 =new EntityManager<ProductListing>();
            ProductListing mgr_productListing = new ProductListing();
            mgr_productListing.

            //List<Address> list2 = mgrProduct.Search(obj);
            //lbl.Text = list2[0].AddressLine1;
        }
        public void refreshdata_desc(int val)
        {
            EntityManager<ProductListing> object1 = new EntityManager<ProductListing>();
               ProductListing mgr_productListing = new ProductListing  ();
               mgr_productListing.ProductID = val;

            List<ProductListing> list2 = object1.Search(mgr_productListing);
            Label1.Text = list2[0].Description;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                createtable();

                Dictionary<int, int> cartItems = (Dictionary<int, int>)Session["ShoppingCart"];
                int prodid;
                int prodqty;
                decimal grandtotal = 0;
                // List<cartitem> crtitem = new List<cartitem>();

                foreach (KeyValuePair<int, int> productidQty in cartItems)
                {
                    prodid = productidQty.Key;
                    prodqty = productidQty.Value;

                    EntityManager<ProductListing> pcat = new EntityManager<ProductListing>();
                    ProductListing procat = new ProductListing();
                    procat.ProductID = prodid;
                    List<ProductListing> prodcatID = pcat.Search(procat);

                    int ID = prodid;
                    string Name = prodcatID[0].Name;
                    string ProductNumber = prodcatID[0].ProductNumber;
                    string Description = prodcatID[0].Description;
                    string Color = prodcatID[0].Color;
                    decimal ListPrice = prodcatID[0].ListPrice;
                    string CategoryName = prodcatID[0].CategoryName;
                    string ModelName = prodcatID[0].ModelName;
                    int Quantity = prodqty;
                    decimal Totalprice = prodqty * prodcatID[0].ListPrice;
                    grandtotal = grandtotal + Totalprice;

                    tb = (DataTable)ViewState["table1"];
                    dr = tb.NewRow();
                    dr["Product Name"] = Name;
                    dr["Number"] = ProductNumber;
                    dr["Description"] = Description;
                    dr["color"] = Color;

                    dr["List Price"] = ListPrice;
                    dr["Category Name"] = CategoryName;
                    dr["Model Name"] = ModelName;

                    dr["Quantity"] = Quantity;
                    dr["Total Price"] = Totalprice;
                    tb.Rows.Add(dr);
                    Gv1.DataSource = tb;
                    Gv1.DataBind();

                }

                lbl_GrandTotal.Text = "Grand Total of your cart Items =" + grandtotal.ToString();
            }
        }
        public void refreshdata(int val)
        {
            EntityManager<ProductListing> object1 = new EntityManager<ProductListing>();
               ProductListing mgr_productListing = new ProductListing  ();
               mgr_productListing.ProductID = val;

            List<ProductListing> list2 = object1.Search(mgr_productListing);
            GridView1.DataSource = list2;
            GridView1.DataBind();
        }
        public void GetDesc(int ProductDescriptionId)
        {
            EntityManager<ProductListing> pcat = new EntityManager<ProductListing>();
            ProductListing procat = new ProductListing();
            procat.ProductID = ProductDescriptionId;
            List<ProductListing> prodcatID = pcat.Search(procat);
            Label2.Text = prodcatID[0].Description;

            //int id = ProductDescriptionId;
            //Label2.Text = ProductDescriptionId.ToString();
        }
        public void refreshdata(int val)
        {
            global_productId = val;
            EntityManager<ProductListing> object1 = new EntityManager<ProductListing>();
            ProductListing mgr_productListing = new ProductListing  ();
            mgr_productListing.ProductID = val;

            List<ProductListing> list2 = object1.Search(mgr_productListing);
            GridView1.DataSource = list2;

            GridView1.DataBind();
            GridView1.Columns[2].ItemStyle.Width = Unit.Pixel(400);
        }
 public void GetDesc(int ProductDescriptionId)
 {
     EntityManager<ProductListing> pcat = new EntityManager<ProductListing>();
     ProductListing procat = new ProductListing();
     procat.ProductID = ProductDescriptionId;
     List<ProductListing> prodcatID = pcat.Search(procat);
     lbl_description.Text = prodcatID[0].Description;
     lbl_productname.Text = prodcatID[0].Name;
     lbl_productnumber.Text = prodcatID[0].ProductNumber;
     lbl_color.Text = prodcatID[0].Color;
     lbl_listprice.Text = prodcatID[0].ListPrice.ToString();
     lbl_categoryname.Text = prodcatID[0].CategoryName;
     lbl_modelname.Text = prodcatID[0].ModelName;
     txt_totalprice.Text = prodcatID[0].ListPrice.ToString();
     lbl_productid.Text = prodcatID[0].ProductID.ToString();
 }
Esempio n. 10
0
        public void dataload()
        {
            Dictionary<int, int> cartItems1 = (Dictionary<int, int>)Session["ShoppingCart"];
            int prodid1;
            int prodqty1;
            int i = 0;
            gtotal = 0;
            List<cartitem> abccart = new List<cartitem>();
            foreach (KeyValuePair<int, int> productidQty in cartItems1)
            {
                prodid1 = productidQty.Key;
                prodqty1 = productidQty.Value;

                EntityManager<ProductListing> pcat = new EntityManager<ProductListing>();
                ProductListing procat = new ProductListing();
                procat.ProductID = prodid1;
                List<ProductListing> prodcatID = pcat.Search(procat);

                gtotal = gtotal + prodcatID[0].ListPrice;

                cartitem mycart = new cartitem()
                {
                    ID = prodid1,
                    Name = prodcatID[0].Name,
                    ProductNumber = prodcatID[0].ProductNumber,
                    Description = prodcatID[0].Description,
                    Color = prodcatID[0].Color,
                    ListPrice = prodcatID[0].ListPrice,
                    CategoryName = prodcatID[0].CategoryName,
                    ModelName = prodcatID[0].ModelName,
                    Quantity = prodqty1,
                    Totalprice = (prodcatID[0].ListPrice * prodqty1)

                };

                abccart.Add(mycart);
            }
            Gv1.DataSource = abccart;
            Gv1.DataBind();
            totalAmountLabel.Text = gtotal.ToString();
        }
        public void refresh_data()
        {
            Dictionary<int, int> myDictionary = (Dictionary<int, int>)Session["shoppingCart"];
            EntityManager<ProductListing> object1 = new EntityManager<ProductListing>();
            ProductListing mgr_productListing = new ProductListing();
            List<ProductListing> list2 = new List<ProductListing>();

            foreach (var pair in myDictionary)
            {
                mgr_productListing.ProductID = pair.Key;
                List<ProductListing> list3 = new List<ProductListing>();
                list3 = object1.Search(mgr_productListing);
                list4.Add(pair.Value);
                list2.AddRange(list3);
            }

            GridView1.DataSource = list2;
            GridView1.DataBind();
            double tt = list_total.Sum();
            lblTotalValue.Text = tt.ToString();
        }