示例#1
0
 private void SeedCatalogParamSection(ReklamaContext context)
 {
     context.CatalogParamSubsections.AddOrUpdate(
         new CatalogParamSubsection()
     {
         Id = 1, SecondCategoryId = 1, Name = "Длина провода", Slogan = "Длина провода проводного телефона"
     },
         new CatalogParamSubsection()
     {
         Id = 2, SecondCategoryId = 1, Name = "Дополнительные функции", Slogan = "Дополнительные функции проводного телефона"
     },
         new CatalogParamSubsection()
     {
         Id = 3, SecondCategoryId = 2, Name = "Характеристики дизайна", Slogan = "Характеристики дизайна мобильного телефона"
     },
         new CatalogParamSubsection()
     {
         Id = 4, SecondCategoryId = 2, Name = "Характеристики процессора", Slogan = "Характеристики процессора мобильного телефона"
     },
         new CatalogParamSubsection()
     {
         Id = 5, SecondCategoryId = 3, Name = "Характеристики процессора", Slogan = "Характеристики процессора ПК"
     },
         new CatalogParamSubsection()
     {
         Id = 6, SecondCategoryId = 4, Name = "Характеристики процессора", Slogan = "Характеристики процессора ноутбука"
     },
         new CatalogParamSubsection()
     {
         Id = 7, SecondCategoryId = 4, Name = "Покрытие", Slogan = "Покрытие ноутбука"
     }
         );
 }
示例#2
0
        public RealtySortByParams()
        {
            IList <City>           cities;
            IList <RealtyCategory> categories;

            SortOptions = SortOptionsParams.ByDate;
            SortOrder   = SortOrderParams.Descending;
            CurrentPage = 1;
            PageSize    = ProjectConfiguration.Get.ItemsOnPage[0];
            //Initialize list of counts room
            if (CountsRoom == null)
            {
                CountsRoom = new List <bool>()
                {
                    false, false, false, false, false, false
                }
            }
            ;
            var cityRepository     = DependencyResolver.Current.GetService <ICityRepository>();
            var categoryRepository = DependencyResolver.Current.GetService <IRealtyCategoryRepository>();

            using (var rc = new ReklamaContext())
            {
                cityRepository.Context = rc;
                cities = cityRepository.Read().OrderBy(c => c.Id).ToList();

                categoryRepository.Context = rc;
                categories = categoryRepository.Read().OrderBy(c => c.Id).ToList();
            }
            PopulateCity(cities);
            PopulateCategory(categories);
        }
示例#3
0
 private void SeedProductParam(ReklamaContext context)
 {
     context.ProductParams.AddOrUpdate(
         new ProductParam()
     {
         Id = 1, Name = "Год выпуска"
     },
         new ProductParam()
     {
         Id = 2, Name = "Вес"
     },
         new ProductParam()
     {
         Id = 3, Name = "Габариты"
     },
         new ProductParam()
     {
         Id = 4, Name = "Объем памяти"
     },
         new ProductParam()
     {
         Id = 5, Name = "Мощность"
     }
         );
 }
示例#4
0
 private void SeedPopularSectionInCatalog(ReklamaContext context)
 {
     context.PopularSectionsInCatalog.AddOrUpdate(
         new PopularSectionInCatalog()
     {
         Id = 1, SectionId = 1
     },
         new PopularSectionInCatalog()
     {
         Id = 2, SectionId = 2
     },
         new PopularSectionInCatalog()
     {
         Id = 3, SectionId = 3
     },
         new PopularSectionInCatalog()
     {
         Id = 4, SectionId = 4
     },
         new PopularSectionInCatalog()
     {
         Id = 5, SectionId = 5
     }
         );
 }
示例#5
0
 private void SeedPopularProducts(ReklamaContext context)
 {
     context.PopularProducts.AddOrUpdate(
         new PopularProduct()
     {
         Id = 1, ProductId = 1
     },
         new PopularProduct()
     {
         Id = 2, ProductId = 19
     },
         new PopularProduct()
     {
         Id = 3, ProductId = 20
     },
         new PopularProduct()
     {
         Id = 4, ProductId = 21
     },
         new PopularProduct()
     {
         Id = 5, ProductId = 24
     }
         );
 }
示例#6
0
 private void SeedPopularAnnouncement(ReklamaContext context)
 {
     context.PopularAnnouncement.AddOrUpdate(
         new PopularAnnouncement()
     {
         Id = 1, AnnouncementId = 19
     },
         new PopularAnnouncement()
     {
         Id = 2, AnnouncementId = 20
     },
         new PopularAnnouncement()
     {
         Id = 3, AnnouncementId = 21
     },
         new PopularAnnouncement()
     {
         Id = 4, AnnouncementId = 11
     },
         new PopularAnnouncement()
     {
         Id = 5, AnnouncementId = 12
     },
         new PopularAnnouncement()
     {
         Id = 6, AnnouncementId = 5
     });
 }
示例#7
0
 private void SeedRealtySection(ReklamaContext context)
 {
     //RealtySection
     context.RealtySections.AddOrUpdate(
         new RealtySection()
     {
         Id = 1, Name = "Продам"
     },
         new RealtySection()
     {
         Id = 2, Name = "Куплю"
     },
         new RealtySection()
     {
         Id = 3, Name = "Обменяю"
     },
         new RealtySection()
     {
         Id = 4, Name = "Сдам"
     },
         new RealtySection()
     {
         Id = 5, Name = "Сниму"
     },
         new RealtySection()
     {
         Id = 6, Name = "Услуга"
     }
         );
 }
示例#8
0
        private void SeedPremium(ReklamaContext context)
        {
            context.Premiums.AddOrUpdate(
                new Premium()
            {
                Id = 1, Name = "Премим1 Доски", Description = "Премиум первого уровня для доски объявлений", Cost = 15, Lifetime = 72
            },
                new Premium()
            {
                Id = 2, Name = "Премим2 Доски", Description = "Премиум второго уровня для доски объявлений", Cost = 10, Lifetime = 72
            },
                new Premium()
            {
                Id = 3, Name = "Премим3 Доски", Description = "Премиум третьего уровня для доски объявлений", Cost = 5, Lifetime = 72
            },

                new Premium()
            {
                Id = 4, Name = "Премим1 Недвижимости", Description = "Премиум первого уровня для недвижимости", Cost = 15, Lifetime = 72
            },
                new Premium()
            {
                Id = 5, Name = "Премим2 Недвижимости", Description = "Премиум второго уровня для недвижимости", Cost = 10, Lifetime = 72
            },
                new Premium()
            {
                Id = 6, Name = "Премим3 Недвижимости", Description = "Премиум третьего уровня для недвижимости", Cost = 5, Lifetime = 72
            }
                );
        }
        public ShopRegistrationDataViewModel()
        {
            var rc = new ReklamaContext();

            _profileRepository         = DependencyResolver.Current.GetService <IProfileRepository>();
            _cityRepository            = DependencyResolver.Current.GetService <ICityRepository>();
            _cityRepository.Context    = rc;
            _profileRepository.Context = rc;
        }
示例#10
0
 private void SeedAnnouncementConfiguration(ReklamaContext context)
 {
     context.AnnouncementConfigs.AddOrUpdate(
         new AnnouncementConfig()
     {
         Id = 1, Slogan = "Объявления. Это стабильная версия нашего сайта", Premium1Id = 1, Premium2Id = 2, Premium3Id = 3
     }
         );
 }
示例#11
0
 private void SeedPage(ReklamaContext context)
 {
     context.Pages.AddOrUpdate(
         new Page()
     {
         Id = 1, Name = "Контакты", Description = "Наши контакты", CreatedAt = DateTime.Now, IsActive = true, PageTemplateId = 1, Slug = "our-contacts"
     }
         );
 }
示例#12
0
 private void SeedArticleConfig(ReklamaContext context)
 {
     context.ArticleConfigs.AddOrUpdate(
         new ArticleConfig()
     {
         Id = 1, Slogan = "Статьи. Это стабильная версия нашего сайта"
     }
         );
 }
示例#13
0
        public ShopsController(IProfileRepository profileRepository, IConfigRepository configRepository, ICityRepository cityRepository)
        {
            _profileRepository = profileRepository;
            _configRepository  = configRepository;
            _cityRepository    = cityRepository;

            var rc = new ReklamaContext();

            _configRepository.Context = _cityRepository.Context = rc;
        }
示例#14
0
 private void SeedMainPageArticleConfig(ReklamaContext context)
 {
     context.MainPageArticleConfigs.AddOrUpdate(
         new MainPageArticleConfig()
     {
         Article1Id = 26,
         Article2Id = 25,
         Article3Id = 24,
         Article4Id = 22
     }
         );
 }
示例#15
0
 private void SeedCatalogConfig(ReklamaContext context)
 {
     context.CatalogConfigs.AddOrUpdate(
         new CatalogConfig()
     {
         Id               = 1,
         Slogan           = "Каталог. Это часть сайта находится на этапе тестирования",
         PromoText        = "<strong class=\"orangeStrong\">Увеличьте продажи</strong><br/>МТС-СМС",
         RegShopPromoText = "<p>Несколько обзацев про-текста про выгодные условия торговли через ресурс.</p>\n<span>Наши преимущества</span>\n<ul>\n<li><img src=\"/Images/System/regN1.png\" />Краткий текст описания того или иного преимущества проекта перед конкурентами</li>\n<li><img src=\"/Images/System/regN2.png\" />Краткий текст описания того или иного преимущества проекта перед конкурентами</li>\n<li><img src=\"/Images/System/regN3.png\" />Краткий текст описания того или иного преимущества проекта перед конкурентами</li>\n<li><img src=\"/Images/System/regN4.png\" />Краткий текст описания того или иного преимущества проекта перед конкурентами</li>\n</ul>",
         WarningText      = "Приведенные предложения продавцов являются рекламной информацией и их приглашением делать оферы. При покупке всегда запоминайте полное наименование юридического лица или ИП продавца. Обязательно уточняйте комплект поставки, цвет товара и иную информацию в процессе заказа."
     }
         );
 }
示例#16
0
 private void SeedCurrency(ReklamaContext context)
 {
     //Currency
     context.Currencies.AddOrUpdate(
         new Currency()
     {
         Id = 1, Name = "USD", Rate = 1
     },
         //new Currency() { Id = 2, Name = "EUR", Rate = 1.41f },
         new Currency()
     {
         Id = 3, Name = "TMT", Rate = 2.85f
     }
         );
 }
示例#17
0
 private void SeedArticleSection(ReklamaContext context)
 {
     context.ArticleSections.AddOrUpdate(
         new ArticleSection()
     {
         Id = 1, Name = "Телефоны"
     },
         new ArticleSection()
     {
         Id = 2, Name = "Компьютеры"
     },
         new ArticleSection()
     {
         Id = 3, Name = "Велосипеды"
     }
         );
 }
示例#18
0
 private void SeedCategory(ReklamaContext context)
 {
     context.Categories.AddOrUpdate(
         new Category()
     {
         Id = 1, Name = "Продажа"
     },
         new Category()
     {
         Id = 2, Name = "Покупка"
     },
         new Category()
     {
         Id = 3, Name = "Обмен"
     }
         );
 }
示例#19
0
        public Section GetSection()
        {
            Section section = null;

            if (!SectionId.HasValue)
            {
                return(null);
            }

            using (var rc = new ReklamaContext())
            {
                var sectionRepository = DependencyResolver.Current.GetService <ISectionRepository>();
                sectionRepository.Context = rc;
                section = sectionRepository.Read(SectionId.Value);
            }
            return(section);
        }
示例#20
0
        public FilterParams()
        {
            IList <City> cities;

            SortOptions = SortOptionsParams.ByDate;
            SortOrder   = SortOrderParams.Descending;
            CurrentPage = 1;
            PageSize    = ProjectConfiguration.Get.ItemsOnPage[0];
            var cityRepository = DependencyResolver.Current.GetService <ICityRepository>();

            using (var rc = new ReklamaContext())
            {
                cityRepository.Context = rc;
                cities = cityRepository.Read().OrderBy(c => c.Id).ToList();
            }
            PopulateCity(cities);
        }
示例#21
0
 private void SeedRealtyCategory(ReklamaContext context)
 {
     //RealtyCategory
     context.RealtyCategories.AddOrUpdate(
         new RealtyCategory()
     {
         Id = 1, Name = "Дом"
     },
         new RealtyCategory()
     {
         Id = 2, Name = "Квартира"
     },
         new RealtyCategory()
     {
         Id = 3, Name = "Коттедж"
     }
         );
 }
示例#22
0
        public ActionResult ExternalLoginConfirmation(RegisterExternalLoginModel model, string returnUrl)
        {
            string provider       = null;
            string providerUserId = null;

            if (User.Identity.IsAuthenticated || !OAuthWebSecurity.TryDeserializeProviderUserId(model.ExternalLoginData, out provider, out providerUserId))
            {
                return(RedirectToAction("Manage"));
            }

            if (ModelState.IsValid)
            {
                using (ReklamaContext rc = new ReklamaContext())
                {
                    _profileRepository.Context = rc;

                    // Insert a new user into the database

                    // Check if user already exists
                    UserProfile user = _profileRepository.Read().FirstOrDefault(u => u.Email.ToLower() == model.Email.ToLower());

                    if (user == null)
                    {
                        // Insert name into the profile table
                        _profileRepository.Save(new UserProfile {
                            Email = model.Email
                        });

                        OAuthWebSecurity.CreateOrUpdateAccount(provider, providerUserId, model.Email);
                        OAuthWebSecurity.Login(provider, providerUserId, createPersistentCookie: false);

                        return(RedirectToLocal(returnUrl));
                    }
                    else
                    {
                        ModelState.AddModelError("Email", "Такой Email уже существует. Попробуйте ввести другой");
                    }
                }
            }

            ViewBag.ProviderDisplayName = OAuthWebSecurity.GetOAuthClientData(provider).DisplayName;
            ViewBag.ReturnUrl           = returnUrl;
            return(View(model));
        }
示例#23
0
        public ActionResult Deactive(int id)
        {
            using (ReklamaContext rc = new ReklamaContext())
            {
                _profileRepository.Context = rc;
                try
                {
                    var shop = _shopService.GetShop(id);
                    if (shop == null)
                    {
                        return(RedirectToAction("Index"));
                    }

                    shop.IsActive = !shop.IsActive;
                    var user = _profileRepository.Read(shop.UserID.Value);

                    if (user != null)
                    {
                        if (shop.IsActive)
                        {
                            if (!Roles.IsUserInRole(user.Email, "Shop"))
                            {
                                Roles.AddUserToRole(user.Email, "Shop");
                            }
                        }
                        else
                        {
                            if (Roles.IsUserInRole(user.Email, "Shop"))
                            {
                                Roles.RemoveUserFromRole(user.Email, "Shop");
                            }
                        }
                    }

                    _shopService.Save();

                    return(RedirectToAction("Index"));
                }
                catch
                {
                    return(RedirectToAction("Index"));
                }
            }
        }
示例#24
0
        public ActionResult Feedbacks(int id, int?commentPage)
        {
            var rc = new ReklamaContext();

            _profileRepository.Context = rc;
            var result  = new ProductFeedbacksPageViewModel();
            var product = _productService.GetProduct(id);

            result.Product  = product;
            result.Comments = product.ProductFeedback.Select(q => new FeedbackViewModel(_profileRepository)
            {
                ID        = q.ID,
                UserID    = q.UserID,
                Comment   = q.Comment,
                CreatedAt = q.CreatedAt
            }).ToPagedList(commentPage ?? 1, ProjectConfiguration.Get.CommentsOnPage);

            return(View(result));
        }
示例#25
0
 private void SeedNewSectionInCatalog(ReklamaContext context)
 {
     context.NewSectionsInCatalog.AddOrUpdate(
         new NewSectionInCatalog()
     {
         Id = 1, SectionId = 1
     },
         new NewSectionInCatalog()
     {
         Id = 2, SectionId = 2
     },
         new NewSectionInCatalog()
     {
         Id = 3, SectionId = 3
     },
         new NewSectionInCatalog()
     {
         Id = 4, SectionId = 4
     }
         );
 }
示例#26
0
 private void SeedArticleSubsection(ReklamaContext context)
 {
     context.ArticleSubsections.AddOrUpdate(
         new ArticleSubsection()
     {
         Id = 1, Name = "Mototola", SectionId = 1
     },
         new ArticleSubsection()
     {
         Id = 2, Name = "Apple", SectionId = 2
     },
         new ArticleSubsection()
     {
         Id = 3, Name = "Аист", SectionId = 3
     },
         new ArticleSubsection()
     {
         Id = 4, Name = "Author", SectionId = 3
     }
         );
 }
示例#27
0
 private void SeedUnit(ReklamaContext context)
 {
     context.Units.AddOrUpdate(
         new Unit()
     {
         Id = 1, Name = ""
     },
         new Unit()
     {
         Id = 2, Name = "кг"
     },
         new Unit()
     {
         Id = 3, Name = "вольт"
     },
         new Unit()
     {
         Id = 4, Name = "мм"
     }
         );
 }
示例#28
0
        private void SeedConfig(ReklamaContext context)
        {
            //Доделать
            //Обязательные/Необазятельные поля для заполнения при регистрации магазина(п.16 в конце)
            //context.Configs.AddOrUpdate(
            //    new Config() { Id = 1, Name = "TextInfomationBlock", Description = "Текстовый информационный блок" , IsEnable = true , IsEnableValue = true},
            //    new Config() { Id = 2, Name = "CatalogTextPromoBlock", Description = "Текстовый промо блок", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 5, Name = "NumberActualArticles", Description = "Количество актуальных статей", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 6, Name = "NumberPopularArticles", Description = "Количество популярных статей", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 8, Name = "ExpiredAtAnnouncement", Description = "Время действия объявления", Value = "30", IsEnable = null, IsEnableValue = true },
            //new Config() { Id = 9, Name = "ExpiredAtRealty", Description = "Время действия объявления недвижимости", Value = "30", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 10, Name = "UpTimeAnnouncement", Description = "Количество часов до поднятия объявления", Value = "20", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 11, Name = "UpTimeRealty", Description = "Количество часов до поднятия объявления недвижимости", Value = "20", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 12, Name = "LinkFacebook", Description = "Ссылка на группу в Facebook", Value = "http://facebook.com", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 13, Name = "LinkVk", Description = "Ссылка на группу в ВКонтакте", Value = "http://vk.com", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 14, Name = "LinkTwitter", Description = "Ссылка на аккаунт Twitter", Value = "http://twitter.com", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 15, Name = "LinkGooglePlus", Description = "Ссылка на группу в Google plus", Value = "http://plus.google.com", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 16, Name = "LinkOdnoklassniki", Description = "Ссылка на группу в 'Одноклассники'", Value = "http://odnoklassniki.ru", IsEnable = null, IsEnableValue = true },
            //    new Config() { Id = 17, Name = "LinkMail", Description = "Ссылка на группу в 'Мой мир'", Value = "http://mail.ru", IsEnable = null, IsEnableValue = true }
            //    );

            //context.Configs.AddOrUpdate(
            //        new Config() { Id = 18, Name = "UserAgreement", Description = "Страница пользовательского соглашения", IsEnable = true, IsEnableValue = true, Value = 1.ToString() },
            //        new Config() { Id = 19, Name = "HowToUpAnnouncement", Description = "Как поднять объявление?", IsEnable = true, IsEnableValue = true, Value = 1.ToString() }

            //new Config() { Id = 20, Name = "IsEnabledPaymentTerminal", Description = "Включить агрегатор платежей?", IsEnable = true },
            //new Config() { Id = 21, Name = "Yandex Direct", Description = "Включить контекстную рекламу Яндекса?", IsEnable = true, IsEnableValue = true },
            //new Config() { Id = 22, Name = "CountOfPremium1Items", Description = "Количество выводимых Премиум-1 объявлений", IsEnableValue = true, Value = "3" },
            //new Config() { Id = 23, Name = "CountOfPremium2Items", Description = "Количество выводимых Премиум-2 объявлений", IsEnableValue = true, Value = "3" },
            //new Config() { Id = 24, Name = "CountOfPremium3Items", Description = "Количество выводимых Премиум-3 объявлений", IsEnableValue = true, Value = "3" },
            //new Config() { Id = 25, Name = "ROBOPass1", Description = "Пароль #1 для робокассы", IsEnableValue = true, Value = "adsaderq534asasd" },
            //new Config() { Id = 26, Name = "ROBOPass2", Description = "Пароль #2 для робокассы", IsEnableValue = true, Value = "fhsdkf7#T*Rhjgfhj" },
            //new Config() { Id = 27, Name = "ROBOLogin", Description = "Логин для робокассы", IsEnableValue = true, Value = "maximahmedov" }
            //);
            context.Configs.AddOrUpdate(new Config()
            {
                Id = 28, Name = "ChangeRegistrationDataHelp", Description = "Сообщение выводимое при изменении регистрационных данных магазина", IsEnableValue = true, Value = ""
            });
        }
            public SimpleMembershipInitializer()
            {
                //var context = new ReklamaContext();
                //var context = DependencyResolver.Current.GetService<IReklamaContextOperation>()
                //    .GetReklamaContext();
                //var context = _context.GetContext();

                using (var context = new ReklamaContext())
                {
                    try
                    {
                        lock (thisLock)
                        {
                            if (!context.Database.Exists())
                            {
                                // Create the SimpleMembership database without Entity Framework migration schema
                                Database.SetInitializer <ReklamaContext>(null);
                                ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
                            }
                        }

                        lock (thisLock)
                        {
                            if (!WebSecurity.Initialized)
                            {
                                Database.SetInitializer <ReklamaContext>(null);
                                WebSecurity.InitializeDatabaseConnection("UserDbConnection", "UserProfile", "UserId",
                                                                         "Email", autoCreateTables: true);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
                    }
                }
            }
示例#30
0
        private ProjectConfiguration()
        {
            var announcementConfigRepository    = DependencyResolver.Current.GetService <IAnnouncementConfigRepository>();
            var articleConfigRepository         = DependencyResolver.Current.GetService <IArticleConfigRepository>();
            var mainPageArticleConfigRepository = DependencyResolver.Current.GetService <IMainPageArticleConfigRepository>();
            var catalogConfigRepository         = DependencyResolver.Current.GetService <ICatalogConfigRepository>();
            var configRepository = DependencyResolver.Current.GetService <IConfigRepository>();

            using (var context = new ReklamaContext())
            {
                announcementConfigRepository.Context    = context;
                articleConfigRepository.Context         = context;
                mainPageArticleConfigRepository.Context = context;
                catalogConfigRepository.Context         = context;
                configRepository.Context = context;


                AnnouncementConfig    = announcementConfigRepository.ReadConfig();
                ArticleConfig         = articleConfigRepository.ReadConfig();
                MainPageArticleConfig = mainPageArticleConfigRepository.ReadConfig();
                CatalogConfig         = catalogConfigRepository.ReadConfig();
                Configs = configRepository.Read().ToArray();
            }
        }