public async Task <IActionResult> AdvancedSearch(ContentAdvancedSearchPost AdvancedSearch)
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            AdvancedSearch.UserId = CurrentUser.Id;
            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                //var CheckString = await _ContentProvider.CreatePostCheck(Content);
                //if (CheckString.Length == 0)
                //{
                if (AdvancedSearch.Contains == null)
                {
                    AdvancedSearch.Contains = "";
                }
                if (AdvancedSearch.OrganizationId == null)
                {
                    AdvancedSearch.OrganizationId = 0;
                }
                if (AdvancedSearch.ProjectId == null)
                {
                    AdvancedSearch.ProjectId = 0;
                }
                if (AdvancedSearch.ContentTypeId == null)
                {
                    AdvancedSearch.ContentTypeId = 0;
                }
                if (AdvancedSearch.ContentStatusId == null)
                {
                    AdvancedSearch.ContentStatusId = 0;
                }
                if (AdvancedSearch.LanguageId == null)
                {
                    AdvancedSearch.LanguageId = 0;
                }

                foreach (var x in AdvancedSearch.Classifications)
                {
                    if (x.ClassificationValueId == null)
                    {
                        x.ClassificationValueId = 0;
                    }
                }

                var Result = await _contentProvider.AdvancedSearch(CurrentUser.Id, AdvancedSearch);

                return(Ok(Result));

                //}
                return(BadRequest(new
                {
                    IsSuccess = false,
                    //Message = CheckString,
                }));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
        public async Task <IActionResult> AdvancedSearch()
        {
            var CurrentUser = await _userManager.GetUserAsync(User);

            if (await _claimCheck.CheckClaim(CurrentUser, "ApplicationRight", this.ControllerContext.RouteData.Values["controller"].ToString() + "\\" + this.ControllerContext.RouteData.Values["action"].ToString()))
            {
                var ContentSearch = new ContentAdvancedSearchPost();
                ContentSearch.Classifications = await _classificationProvider.ClassificationsWithValues(CurrentUser.Id);

                ContentSearch.Organizations = await _organizationProvider.List(CurrentUser.Id);

                ContentSearch.Projects = await _projectProvider.List(CurrentUser.Id);

                ContentSearch.ContentTypes = await _contentTypeProvider.List(CurrentUser.Id);

                ContentSearch.ContentStatuses = await _contentStatusProvider.List(CurrentUser.Id);

                ContentSearch.Languages = await _languageProvider.List(CurrentUser.Id);

                ContentSearch.SecurityLevels = await _securityLevelProvider.List(CurrentUser.Id);

                foreach (var x in ContentSearch.Classifications)
                {
                    x.ClassificationValues = await _classificationValueProvider.ListPerClassification(CurrentUser.Id, x.ClassificationId);
                }

                return(Ok(ContentSearch));
            }
            return(BadRequest(new
            {
                IsSuccess = false,
                Message = "No rights",
            }));
        }
Beispiel #3
0
        public async Task <IActionResult> AdvancedSearch(ContentAdvancedSearchPost SearchData)
        {
            var token = HttpContext.Session.GetString("Token"); if (token == null)
            {
                return(RedirectToAction("Login", "FrontAuth"));
            }
            var result = await _client.PostProtectedAsync <List <ContentAdvancedSearchResult> >($"{_configuration["APIUrl"]}api/FrontContent/AdvancedSearch", SearchData, token);

            ViewBag.AllStuff = await _loadViewBagModel.ViewBagLoad(this.ControllerContext.RouteData.Values["controller"].ToString(), this.ControllerContext.RouteData.Values["action"].ToString(), token, _hostingEnv.EnvironmentName, _configuration, false, 0, "");

            //var UITerms = await _client.GetProtectedAsync<List<UITermLanguageCustomizationList>>($"{_configuration["APIUrl"]}api/MVC/FrontContent/SearchResult", token);

            return(View("SearchResult", result));
        }
Beispiel #4
0
        public async Task <List <ContentAdvancedSearchResult> > AdvancedSearch(string UserId, ContentAdvancedSearchPost AdvancedSearch)
        {
            string usp = "usp_ContentAdvancedSearch @UserId, @Contains, @OrganizationId, @ProjectId, @ContentTypeId, @ContentStatusId, @SecurityLevelId, @LanguageId, @ClassificationValueTable";

            //System.Data.DataTable ClassificationValueTable = ContentAdvancedSearchClassificationValueDataTable.CreateTable();
            System.Data.DataTable ClassificationValueTable = new System.Data.DataTable();
            ClassificationValueTable.Columns.Add("ClassificationValueId", typeof(Int32));
            //var xy = new List<int>();

            foreach (var x in AdvancedSearch.Classifications)
            {
                if (x.ClassificationValueId != null && x.ClassificationValueId != 0)
                {
                    ClassificationValueTable.Rows.Add(

                        x.ClassificationValueId);
                }
            }
            var result = await _sqlDataAccess.LoadData <ContentAdvancedSearchResult, dynamic>(usp, new { UserId = AdvancedSearch.UserId, Contains = AdvancedSearch.Contains, OrganizationId = AdvancedSearch.OrganizationId, ProjectId = AdvancedSearch.ProjectId, ContentTypeId = AdvancedSearch.ContentTypeId, ContentStatusId = AdvancedSearch.ContentStatusId, SecurityLevelId = AdvancedSearch.SecurityLevelId, LanguageId = AdvancedSearch.LanguageId, ClassificationValueTable = ClassificationValueTable.AsTableValuedParameter("udt_ContentAdvancedSearchClassificationValues") });

            return(result);
        }