Esempio n. 1
0
        /// <summary>
        /// Metorda zwracająca klasę zawierającą elementy wyświetlane na stronie wszytskich ofert regionalnych
        /// </summary>
        /// <param name="currentUmbracoPageId">id strony umbraco na której się znajdujemy</param>
        /// <returns>Model zawierający elementy strony ze wszytskimi artykułami</returns>
        public RegionalOfferBoxViewModel GetRegionalArticleBoxesModel(int currentUmbracoPageId)
        {
            var _model = new RegionalOfferBoxViewModel();

            _model.CurrentUmbracoPageId = currentUmbracoPageId;
            _model.CurrentPageCulture   = Thread.CurrentThread.CurrentCulture;

            var _filterStateCookie = CookiesExtensions.GetCookieValue(CookieVariables.OffersFilterCookie);

            if (string.IsNullOrEmpty(_filterStateCookie))
            {
                return(GetRegionalArticleBoxesModel(_model));
            }

            var _filterModel = JsonConvert.DeserializeObject <NewsFilterStateViewModel>(StringExtensions.Base64Decode(_filterStateCookie));

            if (_filterModel == null)
            {
                return(GetRegionalArticleBoxesModel(_model));
            }

            if (_filterModel.NewsRegionFiltr.HasValue)
            {
                _model.SelectedRegionId = _filterModel.NewsRegionFiltr.Value;
            }

            return(GetRegionalArticleBoxesModel(_model));
        }
Esempio n. 2
0
        /// <summary>
        /// Metorda zwracająca klasę zawierającą elementy wyświetlane na stronie wszytskich zamówień publicznych
        /// </summary>
        /// <param name="currentUmbracoPageId">id strony umbraco na której się znajdujemy</param>
        /// <returns>Model zawierający elementy strony ze wszytskimi zamówieniami publicznymi</returns>
        public ContractNoticesViewModel GetNoticeBoxesModel(int currentUmbracoPageId, TempDataDictionary tempData)
        {
            var _model = new ContractNoticesViewModel();

            _model.CurrentUmbracoPageId = currentUmbracoPageId;
            _model.CurrentPageCulture   = Thread.CurrentThread.CurrentCulture;

            var _filterStateCookie = CookiesExtensions.GetCookieValue(CookieVariables.ContractsFilterCookie);

            if (string.IsNullOrEmpty(_filterStateCookie))
            {
                return(GetNoticeBoxesModel(_model));
            }

            var _filterModel = JsonConvert.DeserializeObject <ContractsFilterStateModel>(StringExtensions.Base64Decode(_filterStateCookie));

            if (_filterModel == null)
            {
                return(GetNoticeBoxesModel(_model));
            }

            _model.SelectedStatusId         = _filterModel.SelectedStatusId;
            _model.SelectedAdministrativeId = _filterModel.SelectedAdministrativeId;
            _model.SelectedLawActId         = _filterModel.SelectedLawActId;
            _model.SelectedTypeOfContractId = _filterModel.SelectedTypeOfContractId;

            if (!string.IsNullOrWhiteSpace(_filterModel.Name))
            {
                _model.Name = _filterModel.Name;
            }
            if (!string.IsNullOrWhiteSpace(_filterModel.Number))
            {
                _model.Number = _filterModel.Number;
            }
            if (_filterModel.StartDate.HasValue)
            {
                _model.StartDate = _filterModel.StartDate.Value;
            }
            if (_filterModel.EndDate.HasValue)
            {
                _model.EndDate = _filterModel.EndDate.Value;
            }

            return(GetNoticeBoxesModel(_model));
        }
        public NewsPageViewModel GetNewsBoxesModel(int currentUmbracoPageId, string typeFromUrl)
        {
            var _model = new NewsPageViewModel();

            _model.CurrentUmbracoPageId = currentUmbracoPageId;
            _model.CurrentPageCulture   = Thread.CurrentThread.CurrentCulture;
            if (!string.IsNullOrEmpty(typeFromUrl))
            {
                _model.SelectedTypeFromUrl = typeFromUrl.Trim();
            }

            var _filterStateCookie = CookiesExtensions.GetCookieValue(CookieVariables.NewsFilterCookie);

            if (string.IsNullOrEmpty(_filterStateCookie))
            {
                return(GetNewsBoxesModel(_model));
            }

            var _filterModel = JsonConvert.DeserializeObject <NewsFilterStateViewModel>(StringExtensions.Base64Decode(_filterStateCookie));

            if (_filterModel == null)
            {
                return(GetNewsBoxesModel(_model));
            }

            if (_filterModel.NewsRegionFiltr.HasValue)
            {
                _model.SelectedRegionId = _filterModel.NewsRegionFiltr.Value;
            }

            if (_filterModel.NewsTypeFilter != null && _filterModel.NewsTypeFilter.Count > 0)
            {
                _model.SelectedTypeIds = _filterModel.NewsTypeFilter;
            }

            return(GetNewsBoxesModel(_model));
        }