Beispiel #1
0
        // GET: Sanpham
        public ActionResult Index(int page = 1, int pageSize = 10)
        {
            int            totalPage          = 0;
            IProduct       dbProduct          = ADODAOFactory.Instance().CreateProductDao();
            List <Product> listProductByOrder = dbProduct.GetListProductByOrder(3, 1, 10000, out totalPage);

            return(View(listProductByOrder.ToPagedList(page, pageSize)));
        }
Beispiel #2
0
        public ActionResult Tintucen(int page = 1, int pageSize = 10)
        {
            int            totalPage           = 0;
            IArticle       dbArticle           = ADODAOFactory.Instance().CreateArticleDao();
            List <Article> listNewArticle      = dbArticle.GetListArticleNew(1, 4, out totalPage);
            List <Article> listArticleMostView = dbArticle.GetListArticleMostView(1, 4, out totalPage);
            List <Article> listArticleByOrder  = dbArticle.GetListArticleByCate(22222, 1, 100, out totalPage);

            ViewBag.listNewArticle      = listNewArticle;
            ViewBag.listArticleMostView = listArticleMostView;

            return(View(listArticleByOrder.ToPagedList(page, pageSize)));
        }
Beispiel #3
0
        public ActionResult Chitiet(int id)
        {
            int      totalPage = 0;
            IProduct dbProduct = ADODAOFactory.Instance().CreateProductDao();

            ProductDetail product = dbProduct.GetProductDetail(id);

            //List<Article> listArticleByTag = dbAccount.GetArticleByTag(article.Tags, 1, 6, out totalPage);

            //ViewBag.listArticleByTag = listArticleByTag;

            return(View(product));
        }
Beispiel #4
0
        public static CategoryContainer getCateSession()
        {
            var cate = HttpContext.Current.Session["CateSession"];

            if (cate == null)
            {
                CategoryContainer getCate = new CategoryContainer();
                List <Category>   list    = ADODAOFactory.Instance().CreateCommonDao().GetCate(SessionHelper.getLanguageSession());
                getCate.cateList = list;
                SessionHelper.setCateSession(getCate);
                return(getCate);
            }
            return((CategoryContainer)cate);
        }
Beispiel #5
0
        public ActionResult TrangChuEn()
        {
            if (SessionHelper.getLanguageSession() != "en")
                SessionHelper.removeCateSession();
            SessionHelper.setLanguageSession("en");
            int totalPage = 0;
            IArticle dbArticle = ADODAOFactory.Instance().CreateArticleDao();
            IProduct dbProduct = ADODAOFactory.Instance().CreateProductDao();
            List<Article> listArticleByOrder = dbArticle.GetListArticleByCate(22222, 1, 10, out totalPage);
            List<Product> listProductByOrder = dbProduct.GetListProductByCate(22223, 1, 10, out totalPage);

            ViewBag.listArticleByOrder = listArticleByOrder;
            ViewBag.listProductByOrder = listProductByOrder;
            return View();
        }
Beispiel #6
0
        public ActionResult Sanphamen(string Url = "", int page = 1, int pageSize = 10)
        {
            Category cate = SessionHelper.getCateSession().getCateByUrl(Url);

            if (cate == null)
            {
                cate.CateId = -1;
            }

            int            totalPage          = 0;
            IProduct       dbProduct          = ADODAOFactory.Instance().CreateProductDao();
            List <Product> listProductByOrder = dbProduct.GetListProductByOrder(22223, 1, 10000, out totalPage);

            ViewBag.CateID = cate.CateId;
            return(View(listProductByOrder.ToPagedList(page, pageSize)));
        }
Beispiel #7
0
        public ActionResult Chitiet(int id)
        {
            int            totalPage           = 0;
            IArticle       dbArticle           = ADODAOFactory.Instance().CreateArticleDao();
            List <Article> listNewArticle      = dbArticle.GetListArticleNew(1, 4, out totalPage);
            List <Article> listArticleMostView = dbArticle.GetListArticleMostView(1, 4, out totalPage);

            ArticleDetail article = dbArticle.GetArticleDetail(id);

            List <Article> listArticleByTag = dbArticle.GetArticleByTag(article.Tags, 1, 6, out totalPage);

            ViewBag.listNewArticle      = listNewArticle;
            ViewBag.listArticleMostView = listArticleMostView;
            ViewBag.listArticleByTag    = listArticleByTag;

            return(PartialView(article));
        }
Beispiel #8
0
        public ActionResult BenhVaDieuTri(string Url = "", int page = 1, int pageSize = 10)
        {
            int      totalPage = 0;
            string   url       = Url;
            Category cate      = SessionHelper.getCateSession().getCateByUrl(url);

            if (cate == null)
            {
                cate.CateId = -1;
            }
            IArticle       dbArticle           = ADODAOFactory.Instance().CreateArticleDao();
            List <Article> listNewArticle      = dbArticle.GetListArticleNew(1, 4, out totalPage);
            List <Article> listArticleMostView = dbArticle.GetListArticleMostView(1, 4, out totalPage);
            List <Article> listArticleByOrder  = dbArticle.GetListArticleByCate(cate.CateId, 1, 100, out totalPage);

            ViewBag.listNewArticle      = listNewArticle;
            ViewBag.listArticleMostView = listArticleMostView;

            return(View(listArticleByOrder.ToPagedList(page, pageSize)));
        }
Beispiel #9
0
        public ActionResult Index(UserLogin user)
        {
            int userID = ADODAOFactory.Instance().CreateAccountDao().User_Login(user.username, Encryptor.GetMD5(user.password));

            if (ModelState.IsValid && userID > 0)
            {
                AdminSession admin = new AdminSession()
                {
                    userID = userID, username = user.username
                };
                List <Menu> menu = ADODAOFactory.Instance().CreateCommonDao().GetMenuByUserID(userID);
                admin.menu = menu;
                SessionHelper.setAdminSession(admin);

                FormsAuthentication.SetAuthCookie(user.username, user.remember);

                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                ModelState.AddModelError("", "Tài khoản hoặc mật khẩu không đúng!");
            }
            return(View());
        }