public ActionResult CategoryManager(int?page)
        {
            CategoryDao           dao     = new CategoryDao();
            IQueryable <Category> lisCate = dao.GetCategory();
            int pageSize            = 10;
            int pageNumber          = (page ?? 1);
            IPagedList <Category> a = lisCate.ToPagedList(pageNumber, pageSize);

            return(View(a));
        }
        public ActionResult Contact()
        {
            CategoryDao categoryDao = new CategoryDao();
            IndexData   data        = new IndexData()
            {
                listCategory = categoryDao.GetCategory()
            };

            return(View(data));
        }
        public ActionResult ProductsPromosion()
        {
            CategoryDao categoryDao = new CategoryDao();
            IndexData   data        = new IndexData
            {
                listCategory = categoryDao.GetCategory()
            };

            return(View(data));
        }
        public ActionResult ProductsDetail(string ma)
        {
            CategoryDao categoryDao = new CategoryDao();
            ProductsDao productDao  = new ProductsDao();

            IndexData data = new IndexData
            {
                listCategory   = categoryDao.GetCategory(),
                productsDetail = productDao.GetProductDetail(ma)
            };

            return(View(data));
        }
Exemple #5
0
        private void GetInfo(TreeNodeTag tag)
        {
            Category cate;
            Types    cellType;

            switch (tag.NodeType)
            {
            case TreeNodeType.Category:
                cate             = cateDao.GetCategory(tag.Id);
                cmbCateID.Text   = cate.CateId.ToString();
                txtCateName.Text = cate.CategoryName;
                break;

            case TreeNodeType.Type:
                cellType            = typesDao.GetTypeById(tag.Id);
                cmbCateID.Text      = cellType.CateId.ToString();
                txtTypeId.Text      = cellType.TypeId.ToString();
                txtCellType.Text    = cellType.CellType;
                txtCellCode.Text    = cellType.CellCode;
                txtDescription.Text = cellType.Description;
                cate             = cateDao.GetCategory(cellType.CateId);
                txtCateName.Text = cate.CategoryName;
                if (cellType.ColorStr != null && cellType.ColorStr != "NULL")
                {
                    btnColor.BackColor = ColorTranslator.FromHtml(cellType.ColorStr);
                }
                else
                {
                    btnColor.BackColor = Color.Black;
                }
                break;

            default:
                break;
            }
        }
        public ActionResult ProductSearch(string key, int?page)
        {
            //ViewBag.chuoi = temp;
            CategoryDao          categoryDao = new CategoryDao();
            ProductsDao          productDao  = new ProductsDao();
            List <Product>       list        = productDao.SearchProduct(key);
            int                  pageSize    = 6;
            int                  pageNumber  = (page ?? 1);
            IPagedList <Product> a           = list.ToPagedList(pageNumber, pageSize);
            IndexData            data        = new IndexData
            {
                listCategory     = categoryDao.GetCategory(),
                listProductsType = a
            };

            return(View(data));
        }
        public ActionResult Products(string type, int?page)
        {
            ViewBag.kieu = type;
            CategoryDao          categoryDao = new CategoryDao();
            ProductsDao          productDao  = new ProductsDao();
            IQueryable <Product> list        = productDao.GetProducts(type);
            int pageSize              = 6;
            int pageNumber            = (page ?? 1);
            IPagedList <Product> a    = list.ToPagedList(pageNumber, pageSize);
            IndexData            data = new IndexData
            {
                listCategory     = categoryDao.GetCategory(),
                listProductsType = a
            };

            //return View(list.ToPagedList(pageNumber, pageSize));
            return(View(data));
        }
        // GET: Home
        public ActionResult Index()
        {
            CategoryDao  categoryDao = new CategoryDao();
            ProductsDao  productDao  = new ProductsDao();
            ShoppingCart Cart        = (ShoppingCart)Session["cart"];

            if (Cart == null)
            {
                Session["cart"] = new ShoppingCart();
            }
            IndexData data = new IndexData {
                listCategory     = categoryDao.GetCategory(),
                featuredProducts = productDao.GetFeaturedProducts(),
                lastestProducts  = productDao.GetLastestProducts()
            };

            return(View(data));
        }
Exemple #9
0
        public ActionResult DatHang()
        {
            CategoryDao     categoryDao = new CategoryDao();
            ShoppingCart    Cart        = (ShoppingCart)Session["cart"];
            List <ItemCart> listItem    = new List <ItemCart>();
            IndexData       data        = new IndexData();

            data.listCategory = categoryDao.GetCategory();
            if (Cart != null)
            {
                data.listItemCart = Cart.listItem;
            }
            else
            {
                data.listItemCart = listItem;
                Session["cart"]   = new ShoppingCart();
            }

            return(View(data));
        }
Exemple #10
0
        /// <summary>
        /// 获取所有类别
        /// </summary>
        /// <returns></returns>
        public static DataTable GetCategory()
        {
            DataTable dt = CategoryDao.GetCategory();

            return(dt);
        }
Exemple #11
0
        public ActionResult DatHang(string shipName, string shipMobile, string shipAddress, string shipEmail)
        {
            if (Session["cart"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            //Thêm chi tiết vào giỏ hàng
            Customer cus  = new Customer();
            Customer test = model.Customers.SingleOrDefault(x => x.shipName == shipName && x.shipMobile == shipMobile && x.shipAddress == shipAddress && x.shipEmail == shipEmail);

            if (test != null)
            {
                cus.makhachhang = test.makhachhang;
                cus.shipName    = test.shipName;
                cus.shipMobile  = test.shipMobile;
                cus.shipAddress = test.shipAddress;
                cus.shipEmail   = test.shipEmail;
            }
            else
            {
                cus.shipName    = shipName;
                cus.shipMobile  = shipMobile;
                cus.shipAddress = shipAddress;
                cus.shipEmail   = shipEmail;
                model.Customers.Add(cus);
                model.SaveChanges();
            }
            ShoppingCart Cart  = (ShoppingCart)Session["cart"];
            Order        order = new Order();

            order.ngaydathang  = DateTime.Now;
            order.ngaygiaohang = DateTime.Now;
            order.status       = "Đang giao hang";
            order.makhachhang  = cus.makhachhang;
            model.Orders.Add(order);
            model.SaveChanges();
            CategoryDao     categoryDao = new CategoryDao();
            List <ItemCart> listItem    = new List <ItemCart>();
            IndexData       data        = new IndexData();

            data.listCategory = categoryDao.GetCategory();

            if (Cart != null)
            {
                data.listItemCart = Cart.listItem;
                foreach (var item in data.listItemCart)
                {
                    OrderDetail detail = new OrderDetail();
                    detail.madathang = order.ma;
                    detail.masanpham = item.Product.ma;
                    detail.soluong   = item.soluong;
                    detail.dongia    = item.Product.dongia;
                    Product sp = model.Products.Find(detail.masanpham);
                    sp.soluong = sp.soluong - item.soluong;
                    SubCategory subcategory = model.SubCategories.Find(sp.producttype);
                    subcategory.soluong = subcategory.soluong - item.soluong;
                    Category category = model.Categories.Find(subcategory.danhmucma);
                    category.soluong = category.soluong - item.soluong;
                    model.OrderDetails.Add(detail);
                    model.SaveChanges();
                }
                ViewData["DonHang"] = order;
            }

            return(View(data));
        }