public ActionResult Search(string tenKM, DateTime?ngayBD, DateTime?ngayKT)
        {
            var tk = Session["TaiKhoan"] as KhachHang;

            if (tk == null)
            {
                return(View("../Login/Index"));
            }
            else
            {
                if (tk.LoaiTK != "Admin")
                {
                    return(View("../Home/Index"));
                }
                else
                {
                    var db = new KhuyenMaiDAO();
                    Session["ListKM"] = db.Search(tenKM, ngayBD, ngayKT);
                    return(View("Index"));
                }
            }
        }
Esempio n. 2
0
        public ActionResult TimKiem(string tenkm, DateTime?batdau, DateTime?ketthuc, string phantram, DateTime?indate)
        {
            if (Session["TaiKhoan"] != null)
            {
                var tk = Session["TaiKhoan"] as KhachHang;


                if (tk.LoaiTK == "Khách Hàng")
                {
                    return(View("../Home/Index"));
                }
                else
                {
                    KhuyenMaiDAO dao = new KhuyenMaiDAO();
                    Session["ListKM"] = dao.Search(tenkm, batdau, ketthuc, phantram, indate);
                    return(View("Index"));
                }
            }
            else
            {
                return(View("../DangNhap/Index"));
            }
        }
 public void SearchTest1()// lay het
 {
     Assert.AreEqual(3, dao.Search(null, null, null).Count);
 }