コード例 #1
0
        public ActionResult Index(string _searchKey, int?_parentId, DateTime?_fromDate, DateTime?_toDate, int?_pageIndex)
        {
            string _userName = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            ContentView result;

            result = _services.GetAll(_searchKey, _fromDate, _toDate, _parentId, "DOCUMENT", 1, false, _pageIndex, 20, _userName, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            ViewBag.FromDate  = _fromDate?.ToString("dd/MM/yyyy") ?? null;
            ViewBag.ToDate    = _toDate?.ToString("dd/MM/yyyy") ?? null;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "CHUYENMUCTAILIEU", 1);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelTaiLieu> model = result.ViewContents.Select(x => new ModelTaiLieu
                {
                    Alias           = x.contentAlias,
                    BodyContent     = x.contentBody,
                    Id              = x.contentId,
                    Img             = x.contentThumbnail,
                    LanguageId      = 1,
                    MetaDescription = x.contentDescription,
                    MetaKeywords    = x.contentMetaKeywords,
                    MetaTitle       = x.contentMetaTitle,
                    Name            = x.contentName,
                    Note            = x.contentDescription,
                    ParentId        = x.contentParentId,
                    ParentName      = getNameById(x.contentParentId),
                    isApproval      = x.isApproval,
                    CreateTime      = x.contentUpdateTime.ToString("dd/MM/yyyy")
                });
                return(View(model));
            }
            else
            {
                List <ModelTaiLieu> model = new List <ModelTaiLieu>();
                return(View(model));
            }
        }
コード例 #2
0
        public ActionResult Index(string _searchKey, int?_parentId, DateTime?_fromDate, DateTime?_toDate, int?_pageIndex)
        {
            ContentView result;
            string      cookieLanguage = "1";

            if (Request.Cookies["cookieLanguage"] != null)
            {
                cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString();
            }
            int.TryParse(cookieLanguage, out int _languageId);
            result = _services.GetAll(_searchKey, _fromDate, _toDate, _parentId, "News", _languageId, false, _pageIndex, 20);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            ViewBag.FromDate  = _fromDate?.ToString("dd/MM/yyyy") ?? null;
            ViewBag.ToDate    = _toDate?.ToString("dd/MM/yyyy") ?? null;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "cnews", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.Contents.Count() > 0)
            {
                IEnumerable <modelNews> model = result.Contents.Select(x => new modelNews
                {
                    Alias           = x.contentAlias,
                    BodyContent     = x.contentBody,
                    Id              = x.contentId,
                    Img             = x.contentThumbnail,
                    LanguageId      = x.languageId,
                    LanguageName    = _languageService.GetNameById(x.languageId),
                    MetaDescription = x.contentDescription,
                    MetaKeywords    = x.contentKeywords,
                    MetaTitle       = x.contentTitle,
                    Name            = x.contentName,
                    Note            = x.note,
                    ParentId        = x.parentId,
                    ParentName      = _services.GetNameById(x.parentId),
                    CreateTime      = x.updateTime.ToString("dd/MM/yyyy"),
                    Approval        = (x.approval ?? false),
                    IsHome          = (x.isHome ?? false)
                });
                return(View(model));
            }
            else
            {
                List <modelNews> model = new List <modelNews>();
                return(View(model));
            }
        }
コード例 #3
0
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            ContentView result;

            result = _services.GetAll(_searchKey, null, null, _parentId, "DONVIPHONGKHOA", 1, false, _pageIndex, 20, null, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(_parentId.GetValueOrDefault(), null, "DONVIPHONGKHOA", 1);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelDonVi> model = result.ViewContents.Select(x => new ModelDonVi
                {
                    DonViId  = x.contentId,
                    Link     = x.contentAlias,
                    DonviCha = x.contentParentId,
                    TenDonVi = x.contentName,
                    ThuTu    = x.isSort
                });
                return(View(model));
            }
            else
            {
                List <ModelDonVi> model = new List <ModelDonVi>();
                return(View(model));
            }
        }
コード例 #4
0
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            var _user = _db.UserLogins.Find(User.Identity.Name);

            if (_user != null && _user.sessionId != HttpContext.Session.SessionID)
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            ContentView result;
            int         _languageId = 1;
            string      _userName   = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            result = _services.GetAll(_searchKey, null, null, _parentId, "Banner", _languageId, false, _pageIndex, 20, _userName, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "Banner", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(result.ViewContents));
        }
コード例 #5
0
        public ActionResult Index(string _searchKey, DateTime?_fromDate, DateTime?_toDate, int?_pageIndex)
        {
            var _user = _db.UserLogins.Find(User.Identity.Name);

            if (_user != null && _user.sessionId != HttpContext.Session.SessionID)
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            ContentView result;
            int         _languageId = 1;
            string      _userName   = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            result = _services.GetAll(_searchKey, _fromDate, _toDate, null, "Gallery", _languageId, false, _pageIndex, 20, _userName, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            ViewBag.FromDate  = _fromDate?.ToString("dd/MM/yyyy") ?? null;
            ViewBag.ToDate    = _toDate?.ToString("dd/MM/yyyy") ?? null;
            return(View(result.ViewContents));
        }
コード例 #6
0
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            string cookieLanguage = "1";

            if (Request.Cookies["cookieLanguage"] != null)
            {
                cookieLanguage = Request.Cookies["cookieLanguage"].Value.ToString();
            }
            int.TryParse(cookieLanguage, out _languageId);
            ContentView result;

            result = _services.GetAll(_searchKey, null, null, _parentId, "Banner", _languageId, false, _pageIndex, 20);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            var category = _services.Dropdownlist(0, null, "cbanner", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.Contents.Count() > 0)
            {
                var model = result.Contents.Select(x => new modelBanner
                {
                    Alias        = x.contentAlias,
                    BodyContent  = x.contentBody,
                    Id           = x.contentId,
                    Img          = x.contentThumbnail,
                    LanguageId   = x.languageId,
                    LanguageName = _languageService.GetNameById(x.languageId),
                    Name         = x.contentName,
                    ParentId     = x.parentId,
                    ParentName   = _services.GetNameById(x.parentId),
                    IsSort       = x.isSort,
                    IsTrash      = x.isTrash
                });
                return(View(model));
            }
            else
            {
                var model = new List <modelBanner>();
                return(View(model));
            }
        }
コード例 #7
0
        public ActionResult Index(string _searchKey, int?_pageIndex)
        {
            string      _userName = null;
            ContentView result;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
                result    = _services.GetAll(_searchKey, null, null, null, "LICHCONGTACTOANTRUONG", 1, false, _pageIndex, 20, _userName, null);
            }
            else
            {
                _userName = User.Identity.Name;
                result    = _services.GetAll(_searchKey, null, null, null, "LICHCONGTACTOANTRUONG", 1, false, null, null, _userName, null);
            }
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelLichCongTac> model = result.ViewContents.Select(x => new ModelLichCongTac
                {
                    Id       = x.contentId,
                    Link     = x.contentAlias,
                    ParentId = x.contentParentId,
                    Name     = x.contentName,
                    Body     = x.contentBody
                });
                if (User.IsInRole("Admin"))
                {
                    return(View(model));
                }
                else
                {
                    return(View(model.ToList().Take(5)));
                }
            }
            else
            {
                List <ModelLichCongTac> model = new List <ModelLichCongTac>();
                return(View(model));
            }
        }
コード例 #8
0
        public ActionResult Index(string _searchKey, int?_parentId, DateTime?_fromDate, DateTime?_toDate, int?_pageIndex)
        {
            ContentView result;
            int         _languageId = 1;
            string      _userName   = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            result = _services.GetAll(_searchKey, _fromDate, _toDate, _parentId, "TINTUC", _languageId, false, _pageIndex, 20, _userName, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            ViewBag.FromDate  = _fromDate?.ToString("dd/MM/yyyy") ?? null;
            ViewBag.ToDate    = _toDate?.ToString("dd/MM/yyyy") ?? null;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(0, null, "CHUYENMUCTINTUC", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelContent> model = result.ViewContents.Select(x => new ModelContent
                {
                    contentAlias       = x.contentAlias,
                    contentBody        = x.contentBody,
                    contentId          = x.contentId,
                    contentThumbnail   = x.contentThumbnail,
                    contentDescription = x.contentDescription,
                    contentKey         = x.contentKey,
                    contentName        = x.contentName,
                    contentParentId    = x.contentParentId,
                    contentCreateTime  = x.contentCreateTime.ToString("dd/MM/yyyy"),
                    isApproval         = (x.isApproval ?? false)
                });
                return(View(model));
            }
            else
            {
                List <ModelContent> model = new List <ModelContent>();
                return(View(model));
            }
        }
コード例 #9
0
ファイル: HomeController.cs プロジェクト: xuanla87/cucdisan
        public ActionResult getBannerRight()
        {
            try
            {
                _languageId = (int)Session["languageId"];
            }
            catch
            {
            }
            int Id = 0;

            if (_languageId == 1)
            {
                int.TryParse(_configSystemServices.GetValueByKey("BannerRight"), out Id);
            }
            else
            {
                int.TryParse(_configSystemServices.GetValueByKey("BannerRightEn"), out Id);
            }
            var entity = _services.GetAll(null, null, null, Id, "Banner", _languageId, false, null, null);

            return(PartialView(entity.Contents.OrderBy(x => x.isSort).ToList()));
        }
コード例 #10
0
ファイル: DaoTaoController.cs プロジェクト: xuanla87/DHTDTT
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            string _userName = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            ContentView result;

            result = _services.GetAll(_searchKey, null, null, _parentId, "TINDAOTAO", 1, false, _pageIndex, 20, _userName, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            IEnumerable <DropdownModel> category = _services.Dropdownlist(_parentId.GetValueOrDefault(), null, "CHUYENMUCDAOTAO", 1);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelContent> model = result.ViewContents.Select(x => new ModelContent
                {
                    contentAlias           = x.contentAlias,
                    contentId              = x.contentId,
                    contentThumbnail       = x.contentThumbnail,
                    contentDescription     = x.contentDescription,
                    contentMetaKeywords    = x.contentMetaKeywords,
                    contentMetaTitle       = x.contentMetaTitle,
                    contentMetaDescription = x.contentMetaDescription,
                    contentName            = x.contentName,
                    contentParentId        = x.contentParentId
                });
                return(View(result.ViewContents));
            }
            else
            {
                List <ModelContent> model = new List <ModelContent>();
                return(View(model));
            }
        }
コード例 #11
0
ファイル: PageController.cs プロジェクト: xuanla87/PhuChuTich
        public ActionResult Index(string _searchKey, DateTime?_fromDate, DateTime?_toDate, int?_pageIndex)
        {
            ContentView result;
            int         _languageId = 1;
            string      _userName   = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            result = _services.GetAll(_searchKey, _fromDate, _toDate, null, "Page", _languageId, false, _pageIndex, 20, _userName, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            ViewBag.FromDate  = _fromDate?.ToString("dd/MM/yyyy") ?? null;
            ViewBag.ToDate    = _toDate?.ToString("dd/MM/yyyy") ?? null;
            return(View(result.ViewContents));
        }
コード例 #12
0
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            ContentView result;

            result = _services.GetAll(_searchKey, null, null, _parentId, "BANNER", _languageId, false, _pageIndex, 20, null, null);
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;
            var category = _services.Dropdownlist(0, null, "BANNER", _languageId);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.ViewContents.Count() > 0)
            {
                var model = result.ViewContents.Select(x => new ModelBanner
                {
                    Alias       = x.contentAlias,
                    BodyContent = x.contentBody,
                    Id          = x.contentId,
                    Img         = x.contentThumbnail,
                    Name        = x.contentName,
                    ParentId    = x.contentParentId,
                    IsSort      = x.isSort,
                    IsTrash     = x.isTrash
                });
                return(View(model));
            }
            else
            {
                var model = new List <ModelBanner>();
                return(View(model));
            }
        }
コード例 #13
0
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            string      _userName = null;
            ContentView result;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
                result    = _services.GetAll(_searchKey, null, null, _parentId, "LICHCONGTAC", 1, false, _pageIndex, 20, _userName, null);
                IEnumerable <DropdownModel> category = _services.Dropdownlist(_parentId.GetValueOrDefault(), null, "DONVIPHONGKHOA", 1);
                ViewBag._parentId = category.Select(x => new SelectListItem {
                    Text = x.Text, Value = x.Value.ToString()
                });
            }
            else
            {
                _userName = User.Identity.Name;
                result    = _services.GetAll(_searchKey, null, null, _parentId, "LICHCONGTAC", 1, false, null, null, _userName, null);

                var um                  = new UserManager <ApplicationUser>(new UserStore <ApplicationUser>(new ApplicationDbContext()));
                var user                = um.FindById(User.Identity.GetUserId());
                var _roleUser           = user.Roles.FirstOrDefault();
                ApplicationDbContext db = new ApplicationDbContext();
                var role                = db.Roles.Find(_roleUser.RoleId);
                var _Trained            = _servicesRoleFunction.GetByUserNameCode(role.Name, "TRAINED");
                IEnumerable <DropdownModel> category = _services.Dropdownlist2(_Trained.ChuyenMucId.GetValueOrDefault(), null, "DONVIPHONGKHOA", 1);
                ViewBag._parentId = category.Select(x => new SelectListItem {
                    Text = x.Text, Value = x.Value.ToString()
                });
            }
            int totalPage = result?.Total ?? 0;

            ViewBag.TotalPage = totalPage;
            ViewBag.PageIndex = _pageIndex ?? 1;
            ViewBag.SearchKey = string.IsNullOrWhiteSpace(_searchKey) ? string.Empty : _searchKey;

            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelLichCongTac> model = result.ViewContents.Select(x => new ModelLichCongTac
                {
                    Id       = x.contentId,
                    Link     = x.contentAlias,
                    ParentId = x.contentParentId,
                    Name     = x.contentName,
                    Body     = x.contentBody
                });
                if (User.IsInRole("Admin"))
                {
                    return(View(model));
                }
                else
                {
                    return(View(model.ToList().Take(5)));
                }
            }
            else
            {
                List <ModelLichCongTac> model = new List <ModelLichCongTac>();
                return(View(model));
            }
        }
コード例 #14
0
ファイル: HomeController.cs プロジェクト: xuanla87/DHTDTT
        public string SubMenu(string _css, string _html, string _link)
        {
            var entity = _services.GetByAlias(_link);

            if (entity != null)
            {
                var model = _services.GetAll(null, null, null, (int)entity.contentId, entity.contentKey, 1, false, null, null, null, null);
                var List  = model.ViewContents.OrderBy(x => x.isSort);
                _html += " <ul class=\"" + _css + "\">";
                foreach (var item in List)
                {
                    _html += " <li>";
                    _html += " <a href=\"" + item.contentAlias + "\">";
                    _html += item.contentName;
                    _html += "</a>";
                    _html += SubMenu2(_css, (int)item.contentId, item.contentKey);
                    _html += "</li>";
                }
                _html += "</ul>";
            }
            return(_html);
        }