Пример #1
0
        protected AppHostBase(string serviceName, params Assembly[] assembliesWithServices)
            : base(serviceName, assembliesWithServices)
        {
#if !NET472
            CookiesExtensions.Init();
#endif
        }
Пример #2
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));
        }
Пример #3
0
        public ActionResult ActivateAccount(string lang, string token)
        {
            var loginPageUrl = AccountRedirectUrls.LoginPage(lang);
            var result       = _accountService.ActivateAccount(token);

            if (result)
            {
                CookiesExtensions.CreateCookie(CookieVariables.TempMessageCookie, "ActivateAccount.Submit.Success");
            }

            return(Redirect(loginPageUrl));
        }
Пример #4
0
        public ActionResult SubmitLoginForm(LoginFormViewModel model)
        {
            SetCulture(model.CurrentPageCulture);
            if (ModelState.IsValid)
            {
                model.Response = _accountService.Login(model);
                if (!model.Response.IsError)
                {
                    CookiesExtensions.CreateCookie(CookieVariables.TempMessageCookie, model.Response.Message);
                }
            }

            model = _accountService.GetLoginFormView(model.CurrentUmbracoPageId, model);
            return(PartialView("LoginFormPartial", model));
        }
Пример #5
0
        public ActionResult SocialMediaLogin(string lang, SocialMediaFormViewModel model)
        {
            if (!_socialMediaService.ValidateToken(model))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var isSuccess = _accountService.TryLoginUsingSocialMedia(model);

            if (isSuccess)
            {
                CookiesExtensions.CreateCookie(CookieVariables.TempMessageCookie, "Login.Submit.Success");
            }

            return(Json(new { LoggedIn = isSuccess }));
        }
Пример #6
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));
        }
Пример #7
0
        /// <summary>
        /// Metorda zwracająca klasę zawierającą elementy wyświetlane na stronie wszytskich ofert regionalnych
        /// </summary>
        /// <param name="model">Obiekt klasy RegionalOfferBoxViewModel</param>
        /// <returns>Gotowy model do wyświetlenia na stronie wszystkich artykułów</returns>
        public RegionalOfferBoxViewModel GetRegionalArticleBoxesModel(RegionalOfferBoxViewModel model)
        {
            var _offersNode = _umbracoHelper.TypedContent(model.CurrentUmbracoPageId);

            var _articleList = _offersNode.Children.Where("Visible").Select(q => new ArticleWithFilter(q));

            model.DisplayCount = new RegionalOffers(_offersNode).DisplayCount;

            #region Pobranie filtrów z bazy danych
            //Pobranie aktywnych filtrów z bazy danych
            var _regionFilterItemsFromDB = _dbService.GetAll <RegionDB>("PolRegioRegion", q => q.IsEnabled);

            model.RegionFilter = _regionFilterItemsFromDB.Where(q => q.Id != int.Parse(RegionVariables.all_poland_region_id)).Select(q => new FilterItem()
            {
                Id = q.Id, DisplayText = _umbracoHelper.GetDictionaryValue(q.DictionaryKey)
            }).ToList();
            model.RegionFilter.Insert(0, new FilterItem()
            {
                Id = 0, DisplayText = _umbracoHelper.GetDictionaryValue("News.Placeholder.AllRegions")
            });

            var _filterModel = new NewsFilterStateViewModel()
            {
                NewsRegionFiltr = model.SelectedRegionId
            };
            CookiesExtensions.CreateCookie(CookieVariables.OffersFilterCookie, StringExtensions.Base64Encode(JsonConvert.SerializeObject(_filterModel)));

            #endregion
            if (model.SelectedRegionId != 0)
            {
                _articleList = _articleList.Where(q => q.RegionFiltr.SavedValue != null && JsonConvert.DeserializeObject <IEnumerable <NuPickersSqlDropDownPicker> >(q.RegionFiltr.SavedValue.ToString()).Any(c => c.Key == model.SelectedRegionId.ToString()));
            }

            model.AllNewsCount = _articleList.Count();
            model.ArticleList  = _articleList.Take(model.DisplayCount).Select(q => new OfferBoxModel(q));

            return(model);
        }
Пример #8
0
        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));
        }
Пример #9
0
        public ActionResult SubmitSocialMediaForm(SocialMediaFormViewModel model)
        {
            if (!_socialMediaService.ValidateToken(model))
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            SetCulture(model.CurrentPageCulture);

            if (ModelState.IsValid)
            {
                model.Response = _accountService.RegisterUsingSocialMedia(model);

                if (model.Response.IsError && model.Response.ValidationErrors.Any())
                {
                    MapErrorsToModelState(model.Response.ValidationErrors);
                }

                CookiesExtensions.CreateCookie(CookieVariables.TempMessageCookie, model.Response.Message);
            }

            model = _accountService.GetSocialMediaFormView(model.CurrentUmbracoPageId, model);
            return(PartialView("SocialMediaFormPartial", model));
        }
Пример #10
0
        /// <summary>
        /// Metorda zwracająca klasę zawierającą elementy wyświetlane na stronie wszytskich postępowań o sprzedaży
        /// </summary>
        /// <param name="model">Obiekt klasy AdvertisingOfSalesViewModel</param>
        /// <returns>Gotowy model do wyświetlenia na stronie wszystkich postępowań o sprzedaży</returns>
        public AdvertisingOfSalesViewModel GetProcedureBoxesModel(AdvertisingOfSalesViewModel model)
        {
            var _advertisingNode = _umbracoHelper.TypedContent(model.CurrentUmbracoPageId);
            var _procedureList   = _advertisingNode.Children.Where("Visible").Select(q => new AnnouncementOfSale(q));
            var _advertisingItem = new AdvertisingOfSales(_advertisingNode);

            model.DisplayCount = _advertisingItem.DisplayItemCount;
            model.ArchiveUrl   = _advertisingItem.ArchiveUrl;

            #region Pobranie filtrów z bazy danych
            //Pobranie aktywnych filtrów z bazy danych
            var _administrativeFilterItemsFromDB = _dbService.GetAll <AdministrativeDB>("PolRegioAdministrative", q => q.IsEnabled);

            model.AdministrativeFilter = _administrativeFilterItemsFromDB.Select(q => new FilterItem()
            {
                Id = q.Id, DisplayText = _umbracoHelper.GetDictionaryValue(q.DictionaryKey)
            }).ToList();
            model.AdministrativeFilter.Insert(0, new FilterItem()
            {
                Id = 0, DisplayText = _umbracoHelper.GetDictionaryValue("Advertising.Placeholder.AllAdministrative")
            });

            model.StatusFilter = Enum.GetValues(typeof(NoticesSalesStatusEnum)).Cast <NoticesSalesStatusEnum>().Select(q => new FilterItem()
            {
                Id = (int)q, DisplayText = _umbracoHelper.GetDictionaryValue(string.Format("Advertising.Placeholder.{0}", q))
            }).ToList();
            model.StatusFilter.Insert(0, new FilterItem()
            {
                Id = 0, DisplayText = _umbracoHelper.GetDictionaryValue("Advertising.Placeholder.Any")
            });
            #endregion
            #region SetFIlterStateCookie

            var _filterModel = new AdvertisingFilterStateModel()
            {
                SelectedStatusId         = model.SelectedStatusId,
                SelectedAdministrativeId = model.SelectedAdministrativeId,
                Name      = model.Name,
                Number    = model.Number,
                StartDate = model.StartDate,
                EndDate   = model.EndDate
            };
            CookiesExtensions.CreateCookie(CookieVariables.AdvertisingFilterCookie, StringExtensions.Base64Encode(JsonConvert.SerializeObject(_filterModel)));
            #endregion
            if (model.SelectedAdministrativeId != 0)
            {
                _procedureList = _procedureList.Where(q => q.Administrative.SavedValue != null && JsonConvert.DeserializeObject <IEnumerable <NuPickersSqlDropDownPicker> >(q.Administrative.SavedValue.ToString()).Any(c => c.Key == model.SelectedAdministrativeId.ToString()));
            }
            if (model.SelectedStatusId != 0)
            {
                _procedureList = _procedureList.Where(q => ((int)q.GetStatus()) == model.SelectedStatusId);
            }
            if (!string.IsNullOrEmpty(model.Name))
            {
                _procedureList = _procedureList.Where(q => q.Name.Trim().ToLower().Contains(model.Name.Trim().ToLower()));
            }
            if (!string.IsNullOrEmpty(model.Number))
            {
                _procedureList = _procedureList.Where(q => q.NumberOfProceedings.Trim().ToLower().Contains(model.Number.Trim().ToLower()));
            }
            if (model.StartDate.HasValue && model.EndDate.HasValue)
            {
                _procedureList = _procedureList.Where(q => q.InitiationOfProceedingsDate >= model.StartDate.Value && q.InitiationOfProceedingsDate <= model.EndDate.Value);
            }
            else if (model.StartDate.HasValue && !model.EndDate.HasValue)
            {
                _procedureList = _procedureList.Where(q => q.InitiationOfProceedingsDate >= model.StartDate.Value);
            }
            else if (!model.StartDate.HasValue && model.EndDate.HasValue)
            {
                _procedureList = _procedureList.Where(q => q.InitiationOfProceedingsDate <= model.EndDate.Value);
            }
            model.AllNewsCount  = _procedureList.Count();
            model.ProcedureList = _procedureList.OrderByDescending(q => q.InitiationOfProceedingsDate).Take(model.DisplayCount).Select(q => new AdvertisingBoxModel(q));
            return(model);
        }
Пример #11
0
        public NewsPageViewModel GetNewsBoxesModel(NewsPageViewModel model)
        {
            var _newsNode       = _umbracoHelper.TypedContent(model.CurrentUmbracoPageId);
            var _newsList       = _newsNode.Children.Where("Visible").Select(q => new ArticleWithDoubleFiltr(q));
            var _isParamFromUrl = !string.IsNullOrEmpty(model.SelectedTypeFromUrl);

            model.DisplayCount = new Information(_newsNode).DisplayItemsCount;

            #region Pobranie filtrów z bazy danych


            //Pobranie aktywnych filtrów z bazy danych
            var _regionFilterItemsFromDB = _dbService.GetAll <RegionDB>("PolRegioRegion", q => q.IsEnabled);
            var _newsTypeItemsFromDB     = _dbService.GetAll <ArticleTypeDB>("PolRegioArticleType", q => q.IsEnabled);

            model.RegionFilter = _regionFilterItemsFromDB.Select(q => new FilterItem()
            {
                Id = q.Id, DisplayText = _umbracoHelper.GetDictionaryValue(q.DictionaryKey)
            }).ToList();
            model.RegionFilter.Insert(0, new FilterItem()
            {
                Id = 0, DisplayText = _umbracoHelper.GetDictionaryValue("News.Placeholder.AllRegions")
            });
            if (model.NewsTypeFilter == null)
            {
                model.NewsTypeFilter = _newsTypeItemsFromDB.Select(q => new CheckBoxFilterItem()
                {
                    Id = q.Id, DisplayText = _umbracoHelper.GetDictionaryValue(q.DictionaryKey), IsChecked = (_isParamFromUrl && q.Name.ToLower() == model.SelectedTypeFromUrl.ToLower()) || (!_isParamFromUrl && model.SelectedTypeIds != null && model.SelectedTypeIds.Contains(q.Id))
                }).ToList();
            }

            var _selectedTypesId = model.NewsTypeFilter.Where(q => q.IsChecked).Select(q => q.Id);

            #region SetFilterStateCookie

            var _typesId     = _selectedTypesId as IList <int> ?? _selectedTypesId.ToList();
            var _filterModel = new NewsFilterStateViewModel()
            {
                NewsRegionFiltr = model.SelectedRegionId,
                NewsTypeFilter  = _typesId.ToList()
            };
            CookiesExtensions.CreateCookie(CookieVariables.NewsFilterCookie, StringExtensions.Base64Encode(JsonConvert.SerializeObject(_filterModel)));
            #endregion
            #endregion
            if (model.SelectedRegionId != 0)
            {
                var _departmentNode = new OfficeAccordion(_newsNode.AncestorOrSelf(DocumentTypeEnum.location.ToString()).DescendantOrSelf(DocumentTypeEnum.officeAccordion.ToString()));

                if (_departmentNode != null && _departmentNode.AddOffice != null)
                {
                    var _contactRegionList = _departmentNode.AddOffice.Fieldsets.Where(x => x != null && x.Properties.Any() && !x.Disabled).Select(q => new RegionContactBox(q));
                    model.RegionContact = _contactRegionList.Where(q => q.Region != null).FirstOrDefault(q => q.Region.Key == model.SelectedRegionId.ToString());
                }

                _newsList = _newsList.Where(q => q.ArticleRegions.SavedValue != null && JsonConvert.DeserializeObject <IEnumerable <NuPickersSqlDropDownPicker> >(q.ArticleRegions.SavedValue.ToString()).Any(c => c.Key == model.SelectedRegionId.ToString()));
            }
            if (_typesId.Count() > 0)
            {
                _newsList = _newsList.Where(q => q.ArticleCategory.SavedValue != null && _typesId.Contains(int.Parse(JsonConvert.DeserializeObject <IEnumerable <NuPickersSqlDropDownPicker> >(q.ArticleCategory.SavedValue.ToString()).Select(c => c.Key).FirstOrDefault())));
            }

            model.AllNewsCount  = _newsList.Count();
            model.NewsBoxesList = _newsList
                                  .OrderByDescending(q => q.ListArticleDate)
                                  .Take(model.DisplayCount)
                                  .Select(q => new NewsBoxModel(q));

            return(model);
        }