Пример #1
0
        // GET: Sach
        public ActionResult Index(int page = 1, int pageSize = 10, string search = null)
        {
            List <Sach> DMSach = null;

            if (Session[Core.Constants.TEMPDATA.BOOKS] == null)
            {
                DMSach = SachManager.getAllAlive();
                Session[Core.Constants.TEMPDATA.BOOKS] = DMSach;
            }
            else
            {
                DMSach = Session[Core.Constants.TEMPDATA.BOOKS] as List <Sach>;
            }

            ViewBag.cultureInfo = CultureInfo;
            if (!String.IsNullOrEmpty(search))
            {
                DMSach            = SachManager.filter(search, DMSach);
                ViewBag.SearchKey = search;
            }

            var models = DMSach.ToPagedList(page, pageSize);

            setAlertMessage();
            return(View(models));
        }
        public ActionResult Search(string request = null, int page = 1, int pageSize = 9)
        {
            if (String.IsNullOrEmpty(request))
            {
                return(RedirectToAction("Index"));
            }
            List <Sach> DMSach = null;

            if (Session[Core.Constants.SESSION.BOOKS] == null)
            {
                DMSach = SachManager.getAllAlive();
                Session[Core.Constants.SESSION.BOOKS] = DMSach;
            }
            else
            {
                DMSach = Session[Core.Constants.SESSION.BOOKS] as List <Sach>;
            }
            DMSach = SachManager.filter(request, DMSach);
            if (DMSach.Count == 0)
            {
                putErrorMessage("Không có kết quả nào");
            }
            ViewBag.searchKey = request;
            var models = DMSach.ToPagedList(page, pageSize);

            setAlertMessage();
            return(View(models));
        }
 public ActionResult LoNhap(DateTime?startDate, DateTime?endDate, int page = 1, int pageSize = 10, string search = null)
 {
     if (startDate != null && endDate != null)
     {
         ViewBag.cultureInfo = CultureInfo;
         ViewBag.startDate   = startDate;
         ViewBag.endDate     = endDate;
         List <Sach> DMSach = SachManager.getAll()
                              .Where(s => s.tongSoLuongNhapTheoThang(
                                         ((DateTime)startDate).Month,
                                         ((DateTime)startDate).Year,
                                         ((DateTime)endDate).Month,
                                         ((DateTime)endDate).Year) > 0 &&
                                     s.tongTienNhapTheoThang(
                                         ((DateTime)startDate).Month,
                                         ((DateTime)startDate).Year,
                                         ((DateTime)endDate).Month,
                                         ((DateTime)endDate).Year) > 0).ToList();
         if (!String.IsNullOrEmpty(search))
         {
             DMSach            = SachManager.filter(search, DMSach);
             ViewBag.SearchKey = search;
         }
         ViewBag.tongSoLuongNhap = DMSach.Sum(s => s.SoLuongNhapTheoThang);
         ViewBag.tongTienNhap    = DMSach.Sum(s => s.TongTienNhapTheoThang);
         var models = DMSach.ToPagedList(page, pageSize);
         setAlertMessage();
         return(View(models));
     }
     setAlertMessage();
     return(View());
 }
Пример #4
0
 private void txbLoc_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         gdvDanhMucSach.DataSource = SachManager.filter(txbLoc.Text, _DMSach);
     }
 }
        public ActionResult List(int?id, int page = 1, int pageSize = 9, string search = null)
        {
            if (id == null)
            {
                return(new HttpNotFoundResult("Bad Request!"));
            }
            var model = LinhVucManager.find((int)id);

            if (model == null || model.TrangThai == 0)
            {
                return(new HttpNotFoundResult("Not Found!"));
            }
            List <Sach> DMSach = model.Sach;

            if (!String.IsNullOrEmpty(search))
            {
                DMSach            = SachManager.filter(search, DMSach);
                ViewBag.SearchKey = search;
            }
            ViewBag.currentLV = model;
            var models = DMSach.ToPagedList(page, pageSize);

            return(View(models));
        }
Пример #6
0
 //Chọn Lọc danh sách sách theo từ khóa
 private void btnLoc_Click(object sender, EventArgs e)
 {
     gdvDanhMucSach.DataSource = SachManager.filter(txbLoc.Text, _DMSach);
 }