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));
        }
Exemple #2
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));
            }
        }
Exemple #3
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));
            }
        }
Exemple #4
0
        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));
            }
        }
Exemple #5
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));
            }
        }
        public ActionResult Index(string _searchKey, int?_parentId, int?_pageIndex)
        {
            ContentView result;

            result = _services.GetAllAdmin(_searchKey, null, null, _parentId, "CHUYENMUCTINTUC", 1, false, _pageIndex, 20);
            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, "CHUYENMUCTINTUC", 1);

            ViewBag._parentId = category.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            if (result != null && result.ViewContents.Count() > 0)
            {
                IEnumerable <ModelChuyenMuc> model = result.ViewContents.Select(x => new ModelChuyenMuc
                {
                    Link            = x.contentAlias,
                    Id              = x.contentId,
                    Thumbnail       = x.contentThumbnail,
                    MetaDescription = x.contentDescription,
                    MetaKeywords    = x.contentMetaKeywords,
                    MetaTitle       = x.contentMetaTitle,
                    Name            = x.contentName,
                    Note            = x.contentDescription,
                    ParentId        = x.contentParentId
                });
                return(View(model));
            }
            else
            {
                List <ModelChuyenMuc> model = new List <ModelChuyenMuc>();
                return(View(model));
            }
        }
Exemple #7
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));
            }
        }
Exemple #8
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));
            }
        }
Exemple #9
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));
            }
        }
Exemple #10
0
        public ActionResult Index()
        {
            modelConfig model = new modelConfig();

            if (!string.IsNullOrEmpty(_services.GetValueByKey("MenuFooter")))
            {
                model.MenuFooter = int.Parse(_services.GetValueByKey("MenuFooter"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("MenuLeft1")))
            {
                model.MenuLeft1 = int.Parse(_services.GetValueByKey("MenuLeft1"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("MenuLeft2")))
            {
                model.MenuLeft2 = int.Parse(_services.GetValueByKey("MenuLeft2"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("MenuMain")))
            {
                model.MenuMain = int.Parse(_services.GetValueByKey("MenuMain"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxHinhAnh")))
            {
                model.BoxHinhAnh = int.Parse(_services.GetValueByKey("BoxHinhAnh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BannerLeft")))
            {
                model.BannerLeft = int.Parse(_services.GetValueByKey("BannerLeft"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BannerRight")))
            {
                model.BannerRight = int.Parse(_services.GetValueByKey("BannerRight"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("ThongBao")))
            {
                model.ThongBao = int.Parse(_services.GetValueByKey("ThongBao"));
            }
            model.SiteBanner      = _services.GetValueByKey("SiteBanner");
            model.SiteContact     = _services.GetValueByKey("SiteContact");
            model.SiteDescription = _services.GetValueByKey("SiteDescription");
            model.SiteEmail       = _services.GetValueByKey("SiteEmail");
            model.SiteFooterInfo  = _services.GetValueByKey("SiteFooterInfo");
            model.SiteKeywords    = _services.GetValueByKey("SiteKeywords");
            model.SiteTitle       = _services.GetValueByKey("SiteTitle");
            var enMenu        = _menuService.Dropdownlist(0, null, 1);
            var enHinhAnh     = _contentService.Dropdownlist(0, null, "csukienquaanh", 1);
            var enBannerLeft  = _contentService.Dropdownlist(0, null, "cbanner", 1);
            var enBannerRight = _contentService.Dropdownlist(0, null, "cbanner", 1);
            var enThongBao    = _contentService.Dropdownlist(0, null, "cnews", 1);

            ViewBag.MenuMain = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.MenuLeft1 = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.MenuLeft2 = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxHinhAnh = enHinhAnh.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BannerLeft = enBannerLeft.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BannerRight = enBannerRight.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.ThongBao = enThongBao.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
        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));
            }
        }
        public ActionResult Index(string _searchKey, int?_parentId, 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);
            }
            int    _languageId = 1;
            string _userName   = null;

            if (User.IsInRole("Admin"))
            {
                _userName = null;
            }
            else
            {
                _userName = User.Identity.Name;
            }
            var _list = new List <int>();
            IQueryable <www.Models.Content> _listChuyenMuc = null;

            if (_parentId > 0)
            {
                _listChuyenMuc = _db.Contents.Where(x => x.contentKey == "ChuyenMucTinTuc" && x.languageId == 1 && x.isTrash == false && x.parentId == _parentId);
            }
            if (_listChuyenMuc != null && _listChuyenMuc.Count() > 0)
            {
                foreach (var item in _listChuyenMuc)
                {
                    _list.Add(item.contentId);
                    _list = getById(item.contentId, _list);
                }
            }
            var _listContent = new List <www.Models.Content>();

            if (_parentId > 0)
            {
                _list.Add(_parentId.Value);
            }
            if (_list.Count > 0)
            {
                foreach (var item in _list)
                {
                    var model = _db.Contents.Where(x => x.parentId == item && x.contentKey == "TinTuc" && x.languageId == 1 && x.isTrash == false);
                    _listContent.AddRange(model.ToList());
                }
            }
            else
            {
                _listContent = _db.Contents.Where(x => x.contentKey == "TinTuc" && x.languageId == 1 && x.isTrash == false).ToList();
            }
            _listContent = _listContent.OrderByDescending(x => x.ngayDang).ToList();
            if (!string.IsNullOrEmpty(_searchKey))
            {
                _listContent = _listContent.Where(x => x.name.Contains(_searchKey)).ToList();
            }
            if (_fromDate.HasValue)
            {
                _listContent = _listContent.Where(x => x.ngayDang >= _fromDate.Value.Date).ToList();
            }
            if (_toDate.HasValue)
            {
                _listContent = _listContent.Where(x => x.ngayDang <= _toDate.Value.Date.AddDays(1).AddSeconds(-1)).ToList();
            }
            int _totalRecord = _listContent.Count;

            if (_pageIndex != null)
            {
                _listContent = _listContent.Skip((_pageIndex.Value - 1) * 15).ToList();
            }
            var totalPage = 0;

            totalPage           = (int)Math.Ceiling(1.0 * _totalRecord / 15);
            _listContent        = _listContent.Take(15).ToList();
            ViewBag.TotalRecord = _totalRecord.ToString();
            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()
            });
            return(View(_listContent));
        }
        public ActionResult Index()
        {
            var model = new ModelCaiDatHeThong();

            if (!string.IsNullOrEmpty(_services.GetValueByKey("DanhMucChinh")))
            {
                model.DanhMucChinh = int.Parse(_services.GetValueByKey("DanhMucChinh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("DanhMucPhai")))
            {
                model.DanhMucPhai = int.Parse(_services.GetValueByKey("DanhMucPhai"));
            }
            model.SiteBanner      = _services.GetValueByKey("SiteBanner");
            model.SiteAbout       = _services.GetValueByKey("SiteAbout");
            model.SiteContact     = _services.GetValueByKey("SiteContact");
            model.SiteDescription = _services.GetValueByKey("SiteDescription");
            model.SiteEmail       = _services.GetValueByKey("SiteEmail");
            model.SiteFooterInfo  = _services.GetValueByKey("SiteFooterInfo");
            model.SiteKeywords    = _services.GetValueByKey("SiteKeywords");
            model.SiteTitle       = _services.GetValueByKey("SiteTitle");
            model.BanDo           = _services.GetValueByKey("BanDo");
            model.LinkSiteMap     = _services.GetValueByKey("LinkSiteMap");
            model.LinkMessenger   = _services.GetValueByKey("LinkMessenger");
            model.LinkFanPage     = _services.GetValueByKey("LinkFanPage");
            model.LinkEnglish     = _services.GetValueByKey("LinkEnglish");
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxPhongSuAnh")))
            {
                model.BoxPhongSuAnh = int.Parse(_services.GetValueByKey("BoxPhongSuAnh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxTinTucChung")))
            {
                model.BoxTinTucChung = int.Parse(_services.GetValueByKey("BoxTinTucChung"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxTinTucNganh")))
            {
                model.BoxTinTucNganh = int.Parse(_services.GetValueByKey("BoxTinTucNganh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxMedia")))
            {
                model.BoxMedia = int.Parse(_services.GetValueByKey("BoxMedia"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxSlider")))
            {
                model.BoxSlider = int.Parse(_services.GetValueByKey("BoxSlider"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxBanner")))
            {
                model.BoxBanner = int.Parse(_services.GetValueByKey("BoxBanner"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxBannerRight")))
            {
                model.BoxBannerRight = int.Parse(_services.GetValueByKey("BoxBannerRight"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxLienKet")))
            {
                model.BoxLienKet = int.Parse(_services.GetValueByKey("BoxLienKet"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxSachVaHocLieu")))
            {
                model.BoxSachVaHocLieu = int.Parse(_services.GetValueByKey("BoxSachVaHocLieu"));
            }
            var enMenu   = _menuService.Dropdownlist(0, null, 1);
            var enTinTuc = _contentService.Dropdownlist(0, null, "CHUYENMUCTINTUC", 1);
            var enBanner = _contentService.Dropdownlist(0, null, "BANNER", 1);
            var enMedia  = _contentService.Dropdownlist(0, null, "CHUYENMUCMEDIA", 1);

            ViewBag.DanhMucChinh = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.DanhMucPhai = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxTinTucChung = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxTinTucNganh = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxPhongSuAnh = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxMedia = enMedia.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.SachVaHocLieu = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxSlider = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxBanner = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxBannerRight = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxLienKet = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxSachVaHocLieu = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }
Exemple #14
0
        public ActionResult Role(string id)
        {
            if (!string.IsNullOrEmpty(id))
            {
                ApplicationDbContext db = new ApplicationDbContext();
                var role = db.Roles.Find(id);

                ModelRoleFunction model = new ModelRoleFunction();
                model.UserName = role.Name;
                var _News     = _services.GetByUserNameCode(role.Name, "TINTUC");
                var _Document = _services.GetByUserNameCode(role.Name, "DOCUMENT");
                var _Media    = _services.GetByUserNameCode(role.Name, "MEDIA");
                var _Caledar  = _services.GetByUserNameCode(role.Name, "CALENDAR");
                var _Trained  = _services.GetByUserNameCode(role.Name, "TRAINED");
                if (_Trained != null)
                {
                    model.IdTrained             = _Trained.Id;
                    model.FunctionAdminTrained  = _Trained.ActionAdmin;
                    model.FunctionEditTrained   = _Trained.ActionEdit;
                    model.FunctionAddTrained    = _Trained.ActionAdd;
                    model.FunctionDeleteTrained = _Trained.ActionDelete;
                }

                if (_Media != null)
                {
                    model.IdMedia             = _Media.Id;
                    model.FunctionAdminMedia  = _Media.ActionAdmin;
                    model.FunctionEditMedia   = _Media.ActionEdit;
                    model.FunctionAddMedia    = _Media.ActionAdd;
                    model.FunctionDeleteMedia = _Media.ActionDelete;
                }
                if (_News != null)
                {
                    model.IdNews             = _News.Id;
                    model.FunctionAdminNews  = _News.ActionAdmin;
                    model.FunctionEditNews   = _News.ActionEdit;
                    model.FunctionAddNews    = _News.ActionAdd;
                    model.FunctionDeleteNews = _News.ActionDelete;
                }

                if (_Document != null)
                {
                    model.IdDocument             = _Document.Id;
                    model.FunctionAdminDocument  = _Document.ActionAdmin;
                    model.FunctionEditDocument   = _Document.ActionEdit;
                    model.FunctionAddDocument    = _Document.ActionAdd;
                    model.FunctionDeleteDocument = _Document.ActionDelete;
                }
                if (_Caledar != null)
                {
                    model.IdCalendar             = _Caledar.Id;
                    model.FunctionAdminCalendar  = _Caledar.ActionAdmin;
                    model.FunctionEditCalendar   = _Caledar.ActionEdit;
                    model.FunctionAddCalendar    = _Caledar.ActionAdd;
                    model.FunctionDeleteCalendar = _Caledar.ActionDelete;
                    model.ChuyenMucDonViId       = _Caledar.ChuyenMucId ?? 0;
                }
                IEnumerable <DropdownModel> category = _servicesContent.Dropdownlist(model.ChuyenMucDonViId, null, "DONVIPHONGKHOA", 1);
                ViewBag.ChuyenMucDonViId = category.Select(x => new SelectListItem {
                    Text = x.Text, Value = x.Value.ToString()
                });
                return(View(model));
            }
            return(RedirectToAction("Index"));
        }
        public ActionResult Index()
        {
            var _user = _db.UserLogins.Find(User.Identity.Name);

            if (_user != null && _user.sessionId != HttpContext.Session.SessionID)
            {
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            }
            var model = new ModelCaiDatHeThong();

            if (!string.IsNullOrEmpty(_services.GetValueByKey("DanhMucChinh")))
            {
                model.DanhMucChinh = int.Parse(_services.GetValueByKey("DanhMucChinh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("DanhMucPhai")))
            {
                model.DanhMucPhai = int.Parse(_services.GetValueByKey("DanhMucPhai"));
            }
            model.SiteBanner      = _services.GetValueByKey("SiteBanner");
            model.SiteAbout       = _services.GetValueByKey("SiteAbout");
            model.SiteContact     = _services.GetValueByKey("SiteContact");
            model.SiteDescription = _services.GetValueByKey("SiteDescription");
            model.SiteEmail       = _services.GetValueByKey("SiteEmail");
            model.SiteFooterInfo  = _services.GetValueByKey("SiteFooterInfo");
            model.SiteKeywords    = _services.GetValueByKey("SiteKeywords");
            model.SiteTitle       = _services.GetValueByKey("SiteTitle");
            model.BanDo           = _services.GetValueByKey("BanDo");
            model.LinkSiteMap     = _services.GetValueByKey("LinkSiteMap");
            model.LinkMessenger   = _services.GetValueByKey("LinkMessenger");
            model.LinkFanPage     = _services.GetValueByKey("LinkFanPage");
            model.LinkEnglish     = _services.GetValueByKey("LinkEnglish");
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxPhongSuAnh")))
            {
                model.BoxPhongSuAnh = int.Parse(_services.GetValueByKey("BoxPhongSuAnh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxTinTucChung")))
            {
                model.BoxTinTucChung = int.Parse(_services.GetValueByKey("BoxTinTucChung"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxTinTucNganh")))
            {
                model.BoxTinTucNganh = int.Parse(_services.GetValueByKey("BoxTinTucNganh"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxMedia")))
            {
                model.BoxMedia = int.Parse(_services.GetValueByKey("BoxMedia"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxSlider")))
            {
                model.BoxSlider = int.Parse(_services.GetValueByKey("BoxSlider"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxBanner")))
            {
                model.BoxBanner = int.Parse(_services.GetValueByKey("BoxBanner"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxBannerRight")))
            {
                model.BoxBannerRight = int.Parse(_services.GetValueByKey("BoxBannerRight"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxLienKet")))
            {
                model.BoxLienKet = int.Parse(_services.GetValueByKey("BoxLienKet"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("BoxSachVaHocLieu")))
            {
                model.BoxSachVaHocLieu = int.Parse(_services.GetValueByKey("BoxSachVaHocLieu"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box1")))
            {
                model.Box1 = int.Parse(_services.GetValueByKey("Box1"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box2")))
            {
                model.Box2 = int.Parse(_services.GetValueByKey("Box2"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box3")))
            {
                model.Box3 = int.Parse(_services.GetValueByKey("Box3"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box4")))
            {
                model.Box4 = int.Parse(_services.GetValueByKey("Box4"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box5")))
            {
                model.Box5 = int.Parse(_services.GetValueByKey("Box5"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box6")))
            {
                model.Box6 = int.Parse(_services.GetValueByKey("Box6"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box7")))
            {
                model.Box7 = int.Parse(_services.GetValueByKey("Box7"));
            }
            if (!string.IsNullOrEmpty(_services.GetValueByKey("Box8")))
            {
                model.Box8 = int.Parse(_services.GetValueByKey("Box8"));
            }
            var enMenu   = _menuService.Dropdownlist(0, null, 1);
            var enTinTuc = _contentService.Dropdownlist(0, null, "ChuyenMucTinTuc", 1);
            var enBanner = _contentService.Dropdownlist(0, null, "BANNER", 1);
            var enMedia  = _contentService.Dropdownlist(0, null, "CHUYENMUCMEDIA", 1);

            ViewBag.DanhMucChinh = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.DanhMucPhai = enMenu.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxTinTucChung = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxTinTucNganh = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxPhongSuAnh = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxMedia = enMedia.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.SachVaHocLieu = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxSlider = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxBanner = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxBannerRight = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxLienKet = enBanner.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.BoxSachVaHocLieu = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box1 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box2 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box3 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box4 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box5 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box6 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box7 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            ViewBag.Box8 = enTinTuc.Select(x => new SelectListItem {
                Text = x.Text, Value = x.Value.ToString()
            });
            return(View(model));
        }