// GET: PhieuNhap/Edit/5 public ActionResult Edit(int?id) { if (id == null) { putErrorMessage("Đường dẫn không chính xác"); return(RedirectToAction("All")); } if (_currentPhieu == null || _currentPhieu != id) { _currentPhieu = id; _phieu = PhieuXuatManager.find((int)id); if (_phieu == null) { putErrorMessage("Không tìm thấy"); return(RedirectToAction("All")); } if (_phieu.TrangThai == 1) { //Nếu đã duyệt thì không cho sửa, chuyển sang trang chi tiết _currentPhieu = null; putErrorMessage("Phiếu đã duyệt"); return(RedirectToAction("Details", new { id = id })); } } ViewBag.cultureInfo = CultureInfo; ViewBag.DMSach = new SelectList(SachManager.getAllAlive() .Where(s => s.Soluong > 0).ToList(), nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); ViewBag.DMDaiLy = new SelectList(DaiLyManager.getAllAlive(), nameof(DaiLyManager.Properties.MaSoDaiLy), nameof(DaiLyManager.Properties.TenDaiLy), ""); setAlertMessage(); return(View(_phieu)); }
public ViewResult BlankEditorRow() { var chitiet = new ChiTietPhieuXuat(); var founded = false; foreach (Sach s in SachManager.getAllAlive().Where(s => s.Soluong > 0).ToList()) { chitiet.MaSoSach = s.MaSoSach; if (_phieu.ChiTiet.Contains(chitiet)) { continue; } founded = true; break; } if (!founded) { return(null); } ViewBag.cultureInfo = CultureInfo; ViewBag.DMSach = new SelectList(SachManager.getAllAlive() .Where(s => s.Soluong > 0).ToList(), nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); chitiet.SoLuong = 1; chitiet.DonGia = chitiet.Sach.GiaBan; _phieu.addDetail(chitiet); return(View("ChiTietEditorRow", chitiet)); }
// 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)); }
protected override void OnActionExecuted(ActionExecutedContext filterContext) { var sess = (NguoiDung)Session[Core.Constants.SESSION.USERNAME]; if (sess == null) { //filterContext.Result = new RedirectToRouteResult( // new RouteValueDictionary(new { controller = "Account", action = "Login"})); } else { ViewBag.currentUser = sess; } ViewBag.Catalory = LinhVucManager.getAllALive(); 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>; } //Sách còn tồn nhiều nhất ViewBag.newProduct = DMSach.OrderByDescending(s => s.Soluong).FirstOrDefault(); //Sách có giá cao nhất ViewBag.hightRateProducts = DMSach.OrderByDescending(s => s.GiaBan).Take(2).ToList(); base.OnActionExecuted(filterContext); }
public void loadSach() { _DMSach = SachManager.getAllAlive() .Where(p => p.tongSoLuongNhapTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0 && p.tongTienNhapTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList(); lbTongLuongNhap.Text = _DMSach.Sum(s => s.SoLuongNhapTheoThang).ToString(); gdvLoNhap.DataSource = _DMSach; }
// GET: PhieuNhap/Create public ActionResult Create() { ViewBag.cultureInfo = CultureInfo; ViewBag.DMSach = new SelectList(SachManager.getAllAlive() .Where(s => s.Soluong > 0).ToList(), nameof(SachManager.Properties.MaSoSach), nameof(SachManager.Properties.TenSach), ""); ViewBag.DMDaiLy = new SelectList(DaiLyManager.getAllAlive(), nameof(DaiLyManager.Properties.MaSoDaiLy), nameof(DaiLyManager.Properties.TenDaiLy), ""); if (_phieu == null) { _phieu = new PhieuXuat(); } _phieu.NgayLap = DateTime.Now; setAlertMessage(); return(View(_phieu)); }
public ActionResult Index() { var rand = new Random(); //Giới hạn sách hiển thị var limit = 6; 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>; } //Láy random 6 sách var models = DMSach.OrderBy(c => rand.Next()).Take(limit); //Danh mục lĩnh vực ViewBag.DMLinhVuc = LinhVucManager.getAllALive().Take(5).ToList(); return(View(models)); }
public void loadSach() { _DMSach = SachManager.getAllAlive().Where(s => s.tongSoLuongXuatTheoThang(_startMonth, _startYear, _endMonth, _endYear) > 0).ToList(); gdvLoXuat.DataSource = _DMSach; }
/// <summary> /// Load danh sách Sách và add vào giao diện /// </summary> public void loadSach() { _DMSach = SachManager.getAllAlive(); gdvDanhMucSach.DataSource = _DMSach; }