Пример #1
0
        //
        // GET: /Order/

        public ActionResult Index()
        {
            int c_id;
            List <OrderView> orderList = new List <OrderView>();

            try
            {
                OrderView Ov;
                c_id = ((Ecommerce.Models.Register.RegisterPro)Session["userId"]).Id;
                Ecommerce.Areas.admin.Models.ShopingContext shpoing = new Ecommerce.Areas.admin.Models.ShopingContext();
                foreach (Order ord in shpoing.Order.Where(x => x.c_id == c_id).ToList())
                {
                    Ov                = new OrderView();
                    Ov.c_id           = ord.c_id;
                    Ov.date           = ord.date;
                    Ov.imageurl       = shpoing.uploadImage.Where(x => x.p_id == ord.p_id).FirstOrDefault().imageURL;
                    Ov.order_status   = ord.order_status;
                    Ov.OrderDetailsID = ord.OrderDetailsID;
                    Ov.OrderId        = ord.OrderId;
                    Ov.p_id           = ord.p_id;
                    Ov.price          = ord.price;
                    Ov.productname    = shpoing.product.Where(x => x.Id == ord.p_id).FirstOrDefault().p_name;
                    Ov.qty            = ord.qty;
                    Ov.status         = getStatus(ord.order_status);
                    orderList.Add(Ov);
                }
            }
            catch (Exception ex)
            {
            }
            return(View(orderList));
        }
Пример #2
0
        public ActionResult CartItem()
        {
            Ecommerce.Areas.admin.Models.ShopingContext shpoing = new Ecommerce.Areas.admin.Models.ShopingContext();
            List <AddToCartBean> cartList = AddToCart.getData();

            if (cartList != null)
            {
                foreach (AddToCartBean bean in cartList)
                {
                    int id = Convert.ToInt32(bean.pid);
                    Ecommerce.Areas.admin.Models.Product.Product prod = shpoing.product.Where(x => x.Id == id).FirstOrDefault();
                    bean.ProductName  = prod.p_name;
                    bean.ProductPrice = float.Parse(prod.p_price.ToString());
                    bean.ProductQty   = 1;
                    bean.TotalPrice   = 1 * bean.ProductPrice;
                    bean.ProductImage = shpoing.uploadImage.Where(x => x.p_id == id).FirstOrDefault().imageURL;
                }
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
            Session["AddList"] = cartList;
            return(View(cartList));
        }
Пример #3
0
        public ActionResult PaymentMethod()
        {
            Ecommerce.Models.Register.RegisterPro shippingdetails = null;
            try
            {
                shippingdetails =
                    ((Ecommerce.Models.Register.RegisterPro)Session["userId"]);
            }
            catch { }
            ViewBag.shippingDetails = shippingdetails;
            Ecommerce.Areas.admin.Models.ShopingContext shpoing = new Ecommerce.Areas.admin.Models.ShopingContext();
            List <AddToCartBean> cartList = AddToCart.getData();

            if (cartList != null)
            {
                foreach (AddToCartBean bean in cartList)
                {
                    int id = Convert.ToInt32(bean.pid);
                    Ecommerce.Areas.admin.Models.Product.Product prod = shpoing.product.Where(x => x.Id == id).FirstOrDefault();
                    bean.ProductName  = prod.p_name;
                    bean.ProductPrice = float.Parse(prod.p_price.ToString());
                    bean.ProductQty   = 1;
                    bean.TotalPrice   = 1 * bean.ProductPrice;
                    bean.ProductImage = shpoing.uploadImage.Where(x => x.p_id == id).FirstOrDefault().imageURL;
                }
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
            Session["AddList"]  = cartList;
            ViewBag.cartAddItem = cartList;
            return(View());
        }
Пример #4
0
        public ActionResult PaymentMethod_Post()
        {
            Ecommerce.Areas.admin.Models.ShopingContext shpoing =
                new Ecommerce.Areas.admin.Models.ShopingContext();
            int c_id = ((Ecommerce.Models.Register.RegisterPro)Session["userId"]).Id;
            List <AddToCartBean> cartList = AddToCart.getData();

            if (cartList != null)
            {
                int   qty    = 0;
                float tprice = 0;
                foreach (AddToCartBean bean in cartList)
                {
                    qty    = 1 + qty;
                    tprice = tprice + bean.ProductPrice;
                }
                OrderDetails OD = new OrderDetails();
                OD.c_id       = c_id;
                OD.datetime   = DateTime.Now;
                OD.status     = 1;
                OD.totalPrice = tprice;
                OD.totalQty   = qty;
                shpoing.OrderDetails.Add(OD);
                shpoing.SaveChanges();
                Order ord;
                foreach (AddToCartBean bean in cartList)
                {
                    int id = Convert.ToInt32(bean.pid);
                    Ecommerce.Areas.admin.Models.Product.Product prod = shpoing.product.Where(x => x.Id == id).FirstOrDefault();
                    ord                = new Order();
                    ord.c_id           = c_id;
                    ord.OrderDetailsID = OD.Id;
                    ord.date           = DateTime.Now;
                    ord.order_status   = 1;
                    ord.p_id           = Convert.ToInt32(bean.pid);
                    ord.price          = bean.ProductPrice * 1;
                    ord.qty            = 1;
                    shpoing.Order.Add(ord);
                    shpoing.SaveChanges();
                }
                // Session.Remove("AddList");
            }
            Ecommerce.Models.Register.RegisterPro shippingdetails = null;
            try
            {
                shippingdetails =
                    ((Ecommerce.Models.Register.RegisterPro)Session["userId"]);
            }
            catch { }
            ViewBag.shippingDetails = shippingdetails;
            ViewBag.cartAddItem     = (List <AddToCartBean>)Session["AddList"];
            return(RedirectToAction("ThankYou", "Confirm"));
        }
Пример #5
0
        public ActionResult Details_GET(int id)
        {
            int Id = id;

            if (Request.QueryString["id"] != null)
            {
                Id = int.Parse(Request.QueryString["id"].ToString());
            }
            Ecommerce.Areas.admin.Models.ShopingContext shpoing = new Ecommerce.Areas.admin.Models.ShopingContext();
            Product prod = shpoing.product.Where(x => x.Id == Id).FirstOrDefault();

            ViewBag.imageList = shpoing.uploadImage.Where(x => x.p_id == Id).ToList();
            return(View(prod));
        }
Пример #6
0
        public ActionResult Index()
        {
            List <productWrapperBrand> product = new List <productWrapperBrand>();
            int id = 0;

            if (Request.QueryString["id"] != null)
            {
                id = int.Parse(Request.QueryString["id"].ToString());
            }
            productWrapperBrand productBean;
            ProductWrapper      proWrap = new ProductWrapper();

            Ecommerce.Areas.admin.Models.ShopingContext shpoing = new Ecommerce.Areas.admin.Models.ShopingContext();
            var ProductList = shpoing.product.Where(x => x.b_id == id).ToList();

            proWrap.productList = new List <Product>();
            foreach (Ecommerce.Areas.admin.Models.Product.Product produt in ProductList)
            {
                productBean           = new productWrapperBrand();
                productBean.p_name    = produt.p_name;
                productBean.p_model   = produt.p_model;
                productBean.p_price   = produt.p_price;
                productBean.Id        = produt.Id;
                productBean.c_id      = produt.c_id;
                productBean.brandName = shpoing.brand.Where(x => x.Id == produt.b_id).Single().b_name;
                try
                {
                    productBean.ImageURL = shpoing.uploadImage.Where(x => x.p_id == produt.Id).FirstOrDefault().imageURL;
                }
                catch
                {
                    productBean.ImageURL = "";
                }
                productBean.p_short_description = produt.p_short_description;
                //   proWrap.productList.Add(productBean);
                product.Add(productBean);
            }
            // product.Add(proWrap);
            return(View(product));
        }
Пример #7
0
        public JsonResult ProductView()
        {
            Ecommerce.Areas.admin.Models.ShopingContext shpoing = new Ecommerce.Areas.admin.Models.ShopingContext();
            List <ProductWrapper> product = new List <ProductWrapper>();
            ProductWrapper        proWrap;
            productWrapperBrand   productBean;

            foreach (Ecommerce.Areas.admin.Models.Category.category cat in shpoing.category)
            {
                proWrap              = new ProductWrapper();
                proWrap.id           = cat.Id;
                proWrap.categoryname = cat.c_name;

                var ProductList = shpoing.product.Where(x => x.c_id == cat.Id).OrderByDescending(x => x.Id).Take(5).ToList();
                proWrap.productList = new List <Product>();
                foreach (Ecommerce.Areas.admin.Models.Product.Product produt in ProductList)
                {
                    productBean           = new productWrapperBrand();
                    productBean.p_name    = produt.p_name;
                    productBean.p_model   = produt.p_model;
                    productBean.p_price   = produt.p_price;
                    productBean.Id        = produt.Id;
                    productBean.c_id      = produt.c_id;
                    productBean.brandName = shpoing.brand.Where(x => x.Id == produt.b_id).Single().b_name;
                    try
                    {
                        productBean.ImageURL = shpoing.uploadImage.Where(x => x.p_id == produt.Id).FirstOrDefault().imageURL;
                    }
                    catch
                    {
                        productBean.ImageURL = "";
                    }
                    productBean.p_short_description = produt.p_short_description;
                    proWrap.productList.Add(productBean);
                }
                product.Add(proWrap);
            }
            return(Json(product, JsonRequestBehavior.AllowGet));
        }