/// <summary> /// Khởi tạo PageElementID đối với mỗi trang thành phần /// </summary> /// <returns>PageElementID</returns> public int InitPageElementId() { var pageElementId = 999999999; var langCode = "vn"; if (Session["langcode"] != null) { langCode = (string)Session["langcode"]; } else { Session["langcode"] = langCode; } if (langCode == "vn") { var tblPageElement = _pageElementRepository.GetAll().FirstOrDefault(g => g.Code == "trang-chu"); if (tblPageElement != null) { Session["PageElementId"] = tblPageElement.ID; pageElementId = tblPageElement.ID; } } else { var tblPageElement = _pageElementRepository.GetAll().FirstOrDefault(g => g.Code == "home"); if (tblPageElement != null) { Session["PageElementId"] = tblPageElement.ID; pageElementId = tblPageElement.ID; } } return(pageElementId); }
public ActionResult Add() { var lstPageElement = _pageElementRepository.GetAll(); TempData["PageElement"] = lstPageElement; var lstGroupUser = _groupuserRepository.GetAll().ToList(); TempData["lstGroupUser"] = lstGroupUser; return(Json(RenderViewToString("~/Areas/Admin/Views/Account/_Create.cshtml"), JsonRequestBehavior.AllowGet)); }
[DisableAuditing]//不添加日志 public PagedResultOutput <PageElementQueryDto> GetPageElementQuery(GetPageElementQueryInput input) { if (input.MaxResultCount <= 0) { input.MaxResultCount = SettingManager.GetSettingValue <int>(MySettingProvider.QuestionsDefaultPageSize); } var query = _pageElementRepository.GetAll() //TODO:根据传入的参数添加过滤条件 //.WhereIf(input.PageElementCategoryId.HasValue, m => m.PageElementCategoryId == input.PageElementCategoryId) .WhereIf(input.ElementType != 0, m => m.ElementType == input.ElementType) .WhereIf(input.PagesId != 0, m => m.PageId == input.PagesId) .WhereIf(!input.Keywords.IsNullOrWhiteSpace(), m => m.Title.Contains(input.Keywords)).OrderBy(input.Sorting); var totalCount = query.Count(); var list = query.ToList(); List <PageElementQueryDto> PageElementlist = new List <PageElementQueryDto>(); foreach (PageElementQueryDto item in list.MapTo <List <PageElementQueryDto> >()) { if (item.LastModifierUserId != null) { User user = _userManager.Users.FirstOrDefault(u => u.Id == item.LastModifierUserId.Value); item.UserName = user.UserName + "[" + item.LastModificationTime + "]"; } item.StatusName = AppEnum.GetBiStatus(item.Status); item.ElementTypeName = AppEnum.GetElementType(item.ElementType); item.Icon = "<i class=\"fa fa-arrows\"></i>"; PageElementlist.Add(item); } return(new PagedResultOutput <PageElementQueryDto> { TotalCount = totalCount, Items = PageElementlist }); }
public override RouteData GetRouteData(HttpContextBase httpContext) { //HelperCache.ClearAllCache(); var lstPageElement = _pageElementRepository.GetAll(); var url = httpContext.Request.Headers["HOST"]; var index = url.IndexOf("."); if (index < 0) { return(null); } var routeData = base.GetRouteData(httpContext); if (routeData != null) { var objPageElement = lstPageElement.FirstOrDefault(g => g.Subdomain == url); if (objPageElement != null && objPageElement.Area != null) { namespaces.SetValue("Web.Areas." + objPageElement.Area + ".Controllers", 0); if (this.namespaces != null && this.namespaces.Length > 0) { routeData.DataTokens["Namespaces"] = this.namespaces; } routeData.Values["area"] = objPageElement.Area; routeData.DataTokens["Area"] = objPageElement.Area; } else { return(null); } routeData.DataTokens["UseNamespaceFallback"] = bool.FalseString; return(routeData); } return(null); }