Пример #1
0
        public ActionResult Index(string searchYeuCau, string searchTinhTrang, string searchName,
                                  string searchTenDanhMuc, string searchTenDonVi, string searchTenLop, string searchEmail, string searchTenVaiTro, int page = 1, int pageSize = 10)
        {
            var dao   = new HocVuDao();
            var model = dao.ListThongKe(searchYeuCau, searchTinhTrang, searchName, searchTenDanhMuc,
                                        searchTenDonVi, searchTenLop, searchEmail, searchTenVaiTro, page, pageSize);
            var dao1 = new DonViDao();

            ViewBag.listDonVi     = new SelectList(dao1.ListAll(), "TenDonVi", "TenDonVi");
            ViewBag.listTinhTrang = new SelectList(dao.ListAll(), "TinhTrang", "TinhTrang");
            var lop = new LopDao();

            ViewBag.listLop = new SelectList(lop.ListAll(), "TenLop", "TenLop");
            var vaitro = new VaiTroDao();

            ViewBag.listVaiTro       = new SelectList(vaitro.ListAll(), "TenVaiTro", "TenVaiTro");
            ViewBag.searchYeuCau     = searchYeuCau;
            ViewBag.searchTinhTrang  = searchTinhTrang;
            ViewBag.searchName       = searchName;
            ViewBag.searchTenDanhMuc = searchTenDanhMuc;
            ViewBag.searchTenDonVi   = searchTenDonVi;
            ViewBag.searchTenLop     = searchTenLop;
            ViewBag.searchEmail      = searchEmail;
            ViewBag.searchTenVaiTro  = searchTenVaiTro;

            var        list     = dao.ListAll();
            List <int> repart   = new List <int>();
            var        userID   = list.Select(x => x.UserID).Distinct();
            var        listUser = from a in userID
                                  join b in db.Users on a.Value equals b.UserID
                                  select b.UserName;

            foreach (var item in userID)
            {
                repart.Add(list.Count(x => x.UserID == item));
            }
            var rep = repart;

            ViewBag.UserID = listUser;
            ViewBag.REP    = repart.ToList();


            var danhmucID = list.Select(x => x.DanhMucID).Distinct();
            var listDM    = from a in danhmucID
                            join b in db.DanhMucs on a.ToString() equals b.DanhMucID.ToString()
                            select b.TenDanhMuc;

            List <int> listDanhMuc = new List <int>();

            foreach (var item in danhmucID)
            {
                listDanhMuc.Add(list.Count(x => x.DanhMucID == item));
            }
            ViewBag.danhmucID   = listDM;
            ViewBag.listDanhMuc = listDanhMuc.ToList();
            return(View(model));
        }
Пример #2
0
        public ActionResult Index(string searchString, string searchUser, int page = 1, int pageSize = 100)
        {
            var dao   = new HocVuDao();
            var model = dao.ListHocVu(searchString, searchUser, page, pageSize);

            ViewBag.SearchString = searchString;
            ViewBag.searchUser   = searchUser;

            var dao1 = new DonViDao();

            ViewBag.listDonVi = new SelectList(dao1.ListAll(), "TenDonVi", "TenDonVi");
            return(View(model));
        }
Пример #3
0
        public void SetViewBag(int?DonViID = null)
        {
            var dao = new DonViDao();

            ViewBag.DonViID = new SelectList(dao.ListAll(), "DonViID", "TenDonVi", DonViID);
        }