コード例 #1
0
        public void LoadGame(
            out List <Brands> brands,
            out List <Cards> cards,
            out List <Matches> matches,
            out List <Promotions> promotions,
            out List <Teams> teams,
            out List <TitlesMain> titles,
            out List <WrestlersMain> wrestlers
            )
        {
            BrandHelper     bHelper  = new BrandHelper();
            CardHelper      cHelper  = new CardHelper();
            MatchHelper     mHelper  = new MatchHelper();
            PromotionHelper pHelper  = new PromotionHelper();
            TeamHelper      tHelper  = new TeamHelper();
            TitleHelper     tlHelper = new TitleHelper();
            WrestlerHelper  wHelper  = new WrestlerHelper();

            brands     = bHelper.PopulateBrandsList();
            cards      = cHelper.PopulateCardsList();
            matches    = mHelper.PopulateMatchesList();
            promotions = pHelper.PopulatePromotionsList();
            teams      = tHelper.PopulateTeamsList();
            titles     = tlHelper.PopulateTitlesList();
            wrestlers  = wHelper.PopulateWrestlersList();
        }
コード例 #2
0
ファイル: BrandTests.cs プロジェクト: singlag888/aft-regov2
        public void Cannot_activate_brand_over_licensee_brand_limit()
        {
            var licensee = BrandHelper.CreateLicensee();

            licensee.AllowedBrandCount = 1;
            var brand = BrandHelper.CreateBrand(licensee);

            BrandCommands.ActivateBrand(new ActivateBrandRequest {
                BrandId = brand.Id, Remarks = "remarks"
            });

            var newBrand = BrandHelper.CreateBrand(BrandRepository.Licensees.Single(x => x.Id == licensee.Id));

            BrandHelper.AssignCountry(newBrand.Id, Country.Code);
            BrandHelper.AssignCulture(newBrand.Id, Culture.Code);
            PaymentHelper.CreatePaymentLevel(newBrand.Id, Currency.Code);
            BrandHelper.CreateWallet(licensee.Id, newBrand.Id);

            Action action = () => BrandCommands.ActivateBrand(new ActivateBrandRequest {
                BrandId = newBrand.Id, Remarks = "remarks"
            });

            action.ShouldThrow <ValidationException>()
            .Where(x => x.Message.Contains("licenseeBrandLimitExceeded"));
        }
コード例 #3
0
        public void Can_create_two_vip_levels_with_same_code_and_name_for_different_brands()
        {
            var brand2 = BrandHelper.CreateBrand(Brand.Licensee);

            SecurityTestHelper.CreateBrand(brand2.Id, brand2.LicenseeId, brand2.TimezoneId);

            var role  = SecurityTestHelper.CreateRole();
            var admin = SecurityTestHelper.CreateAdmin(Licensee.Id, roleId: role.Id);

            role.Id = RoleIds.SingleBrandManagerId;

            admin.Licensees.Clear();
            admin.AllowedBrands.Clear();
            admin.Currencies.Clear();

            admin.SetLicensees(new[] { Licensee.Id });
            admin.AddAllowedBrand(Brand.Id);
            admin.AddAllowedBrand(brand2.Id);
            SecurityTestHelper.SignInAdmin(admin);

            var vipLevel1 = CreateAddVipLevelCommand(Brand);
            var vipLevel2 = CreateAddVipLevelCommand(brand2, vipLevel1.Name, vipLevel1.Code);

            _brandCommands.AddVipLevel(vipLevel1);
            _brandCommands.AddVipLevel(vipLevel2);

            var vipLevels = BrandQueries.GetVipLevels().Where(x => x.Id == vipLevel1.Id || x.Id == vipLevel2.Id).ToList();

            Assert.That(vipLevels.Count, Is.EqualTo(2));
        }
コード例 #4
0
        private async Task <String> GetBrandsHtml(string designName, int take, int imageWidth, int imageHeight)
        {
            string returnHtml;

            take = take == 0 ? GetSettingValueInt("BrandsPartial_ItemsNumber", 50) : take;
            var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, designName);
            var brandsTask     = BrandService.GetBrandsAsync(StoreId, take, true);

            BrandHelper.StoreSettings = GetStoreSettings();
            BrandHelper.ImageWidth    = imageWidth == 0 ? GetSettingValueInt("BrandsPartial_ImageWidth", 50) : imageWidth;
            BrandHelper.ImageHeight   = imageHeight == 0 ? GetSettingValueInt("BrandsPartial_ImageHeight", 50) : imageHeight;

            await Task.WhenAll(pageDesignTask, brandsTask);

            var pageDesign = pageDesignTask.Result;
            var brands     = brandsTask.Result;

            if (pageDesign == null)
            {
                throw new Exception("PageDesing is null");
            }


            var pageOuput = BrandHelper.GetBrandsPartial(brands, pageDesign);

            returnHtml = pageOuput.PageOutputText;

            return(returnHtml);
        }
コード例 #5
0
ファイル: BrandTests.cs プロジェクト: singlag888/aft-regov2
        public override void BeforeEach()
        {
            base.BeforeEach();

            Country  = BrandHelper.CreateCountry("CA", "Canada");
            Culture  = BrandHelper.CreateCulture("en-CA", "English (Canada)");
            Currency = BrandHelper.CreateCurrency("CAD", "Canadian Dollar");
        }
コード例 #6
0
        public void WhenNewVipLevelIsCreated()
        {
            ScenarioContext.Current.Should().ContainKey("brandId");
            var brandId  = ScenarioContext.Current.Get <Guid>("brandId");
            var vipLevel = BrandHelper.CreateVipLevel(brandId, 0, false);

            ScenarioContext.Current.Add("vipLevelId", vipLevel.Id);
        }
コード例 #7
0
        public void WhenNewBankAccountIsCreated()
        {
            var licensee    = BrandHelper.CreateLicensee();
            var brand       = BrandHelper.CreateBrand(licensee, isActive: true);
            var bankAccount = PaymentHelper.CreateBankAccount(brand.Id, brand.DefaultCurrency);

            ScenarioContext.Current.Add("bankAccountId", bankAccount.Id);
        }
コード例 #8
0
        public void WhenNewBrandIsCreated()
        {
            var licensee = BrandHelper.CreateLicensee();
            var brand    = BrandHelper.CreateBrand(licensee, isActive: true);

            ScenarioContext.Current.Add("licenseeId", licensee.Id);
            ScenarioContext.Current.Add("brandId", brand.Id);
            ScenarioContext.Current.Add("currencyCode", brand.DefaultCurrency);
        }
コード例 #9
0
        public override void BeforeEach()
        {
            base.BeforeEach();

            _fakeGsiRepository = Container.Resolve <FakeGameRepository>();
            FillFakeGsiRepository();

            Country  = BrandHelper.CreateCountry("CA", "Canada");
            Culture  = BrandHelper.CreateCulture("en-CA", "English (Canada)");
            Currency = BrandHelper.CreateCurrency("CAD", "Canadian Dollar");
        }
コード例 #10
0
        private void buttonAddBrand_Click(object sender, RoutedEventArgs e)
        {
            Brand brand = (Brand)comboBrand.SelectedItem;

            if (!brands.Contains(brand))
            {
                brands.Add(brand);
            }

            BrandHelper.setBrandGrid(dataGridBrands, brands);
        }
コード例 #11
0
    protected void btnApplyAllChanges_Click(object sender, EventArgs e)
    {
        //Create product list from json posted from client
        List <brand> brands         = new List <brand>();
        var          brandsJson     = Server_Data1.Text;
        dynamic      brandsResponse = JsonConvert.DeserializeObject(brandsJson);

        if (brandsResponse != null)
        {
            List <object> brandObjects = brandsResponse.ToObject <List <object> >();
            foreach (var obj in brandObjects)
            {
                brand item = new brand();

                int brand_id = -1;
                Int32.TryParse(Helper.GetPropValue(obj + "", "brand_id") + "", out brand_id);
                item.brand_id = brand_id;

                item.brand_name        = Helper.GetPropValue(obj + "", "brand_name") + "";
                item.brand_description = Helper.GetPropValue(obj + "", "brand_description") + "";
                item.images            = Helper.GetPropValue(obj + "", "images") + "";
                item.create_date       = Helper.ConverToDateTime(Helper.GetPropValue(obj + "", "create_date") + "");

                brands.Add(item);
            }
        }

        //Delete records from product
        //Get product ids from json posted from client
        var     deletedIdsJson     = txtDeletedIds.Text;
        dynamic deletedIdsResponse = JsonConvert.DeserializeObject(deletedIdsJson);

        if (deletedIdsResponse != null)
        {
            List <int> deletedIds = deletedIdsResponse.ToObject <List <int> >();

            if (deletedIds.Count > 0)
            {
                foreach (var id in deletedIds)
                {
                    var found = brands.Find(x => x.brand_id == id);
                    if (found != null)
                    {
                        brands.Remove(found);
                    }
                }
                BrandHelper.DeleteBrandByIds(deletedIds);
            }
        }

        BrandHelper.Updatebrands(brands);
        PushDataToClient();
    }
コード例 #12
0
        public void UnknownBrands()
        {
            var helper = GetDbHelper();
            var brands = new[] { "noname", "sdfadf", "", " ", null, "USHATAVA", "Грандсток", "Adidas", "Грандсток", "Eger", "Eger" };

            foreach (var brand in brands)
            {
                var cleanName = BrandHelper.GetClearlyVendor(brand);
                helper.RememberVendorIfUnknown(cleanName, brand);
            }
            helper.WriteUnknownBrands();
        }
コード例 #13
0
ファイル: BrandTests.cs プロジェクト: singlag888/aft-regov2
        public void Can_Activate_Brand()
        {
            var brand = BrandHelper.CreateBrand();

            BrandCommands.ActivateBrand(new ActivateBrandRequest
            {
                BrandId = brand.Id,
                Remarks = "remarks"
            });
            brand = BrandQueries.GetBrandOrNull(brand.Id);

            Assert.That(brand.Status, Is.EqualTo(BrandStatus.Active));
        }
コード例 #14
0
        private IList <Licensee> CreateLicensees(int count = 1, LicenseeStatus status = LicenseeStatus.Active)
        {
            var result = new List <Licensee>();

            for (var i = 0; i < count; i++)
            {
                var licensee = BrandHelper.CreateLicensee();
                licensee.Status = status;
                result.Add(licensee);
            }

            return(result);
        }
コード例 #15
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            comboBrand.ItemsSource = BrandHelper.GetBrands();

            comboUnits.ItemsSource = UnitHelper.GetUnits();

            comboTitle.ItemsSource = TitleHelper.GetTitles();

            comboCompany.ItemsSource = CompanyHelper.GetCompanies();

            comboShop.ItemsSource = ShopHelper.GetShops();

            dataGridCompanies.HeadersVisibility = DataGridHeadersVisibility.None;

            loadCompanies();
        }
コード例 #16
0
        public void Can_add_allowed_brand_to_admin()
        {
            // *** Arrange ***
            var admin = SecurityTestHelper.CreateAdmin();

            var brand = BrandHelper.CreateBrand();

            // *** Act ***
            AdminCommands.AddBrandToAdmin(admin.Id, brand.Id);

            // *** Assert ***
            var createdAdmin = SecurityRepository.Admins.Include(u => u.AllowedBrands).FirstOrDefault(u => u.Id == admin.Id);

            Assert.IsNotNull(createdAdmin);
            Assert.IsNotNull(createdAdmin.AllowedBrands);
            Assert.True(createdAdmin.AllowedBrands.Any(b => b.Id == brand.Id));
        }
コード例 #17
0
        public async Task <ActionResult> Index(int page = 1)
        {
            try
            {
                var pageDesignTask = PageDesignService.GetPageDesignByName(StoreId, PageDesingIndexPageName);
                var pageSize       = GetSettingValueInt("Brands_PageSize", StoreConstants.DefaultPageSize);
                var brandsTask     = BrandService.GetBrandsByStoreIdWithPagingAsync(StoreId, true, page, pageSize);
                var settings       = GetStoreSettings();
                BrandHelper.StoreSettings = settings;

                await Task.WhenAll(pageDesignTask, brandsTask);

                var pageDesign = pageDesignTask.Result;
                var brands     = brandsTask.Result;
                if (pageDesign == null)
                {
                    Logger.Error("PageDesing is null:" + PageDesingIndexPageName);
                    throw new Exception("PageDesing is null:" + PageDesingIndexPageName);
                }
                var pageOutput           = BrandHelper.GetBrandsIndexPage(pageDesign, brands);
                var pagingPageDesignTask = PageDesignService.GetPageDesignByName(StoreId, "Paging");


                PagingHelper.StoreSettings   = settings;
                PagingHelper.StoreId         = StoreId;
                PagingHelper.PageOutput      = pageOutput;
                PagingHelper.HttpRequestBase = this.Request;
                PagingHelper.RouteData       = this.RouteData;
                PagingHelper.ActionName      = this.ControllerContext.RouteData.Values["action"].ToString();
                PagingHelper.ControllerName  = this.ControllerContext.RouteData.Values["controller"].ToString();
                await Task.WhenAll(pagingPageDesignTask);

                var pagingDic = PagingHelper.GetPaging(pagingPageDesignTask.Result);
                pagingDic.StoreSettings = settings;
                pageOutput.MyStore      = this.MyStore;
                pageOutput.PageTitle    = "Brands";
                return(View(pagingDic));
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Brands:Index:" + ex.StackTrace, page);
                return(new HttpStatusCodeResult(500));
            }
        }
コード例 #18
0
ファイル: BrandTests.cs プロジェクト: singlag888/aft-regov2
        public void Cannot_Activate_Brand_Without_Country()
        {
            var licensee = BrandHelper.CreateLicensee();
            var brandId  = BrandHelper.CreateBrand(licensee, PlayerActivationMethod.Automatic);

            BrandHelper.AssignCurrency(brandId, Currency.Code);
            BrandHelper.AssignCulture(brandId, Culture.Code);
            PaymentHelper.CreateBank(brandId, Country.Code);
            PaymentHelper.CreateBankAccount(brandId, Currency.Code);
            PaymentHelper.CreatePaymentLevel(brandId, Currency.Code);
            BrandHelper.CreateWallet(licensee.Id, brandId);
            BrandHelper.CreateVipLevel(brandId);

            Action action = () => BrandCommands.ActivateBrand(new ActivateBrandRequest {
                BrandId = brandId, Remarks = "remarks"
            });

            action.ShouldThrow <ValidationException>()
            .Where(x => x.Message.Contains("noAssignedCountry"));
        }
コード例 #19
0
ファイル: BrandTests.cs プロジェクト: singlag888/aft-regov2
        public void Cannot_Activate_Brand_Without_Payment_Level()
        {
            var licensee = BrandHelper.CreateLicensee();
            var brandId  = BrandHelper.CreateBrand(licensee, PlayerActivationMethod.Automatic);

            BrandHelper.AssignCountry(brandId, Country.Code);
            BrandHelper.AssignCurrency(brandId, Currency.Code);
            BrandHelper.AssignCulture(brandId, Culture.Code);
            BrandHelper.CreateWallet(licensee.Id, brandId);
            BrandHelper.CreateVipLevel(brandId);
            BrandHelper.CreateRiskLevel(brandId);
            BrandHelper.AssignProducts(brandId, new [] { licensee.Products.First().ProductId });

            Action action = () => BrandCommands.ActivateBrand(new ActivateBrandRequest {
                BrandId = brandId, Remarks = "remarks"
            });

            action.ShouldThrow <ValidationException>()
            .Where(x => x.Message.Contains("noDefaultPaymentLevels"));
        }
コード例 #20
0
ファイル: BrandTests.cs プロジェクト: singlag888/aft-regov2
        public void Can_assign_brand_culture()
        {
            var brand = BrandHelper.CreateBrand();

            BrandCommands.AssignBrandCulture(new AssignBrandCultureRequest
            {
                Brand          = brand.Id,
                Cultures       = new [] { Culture.Code },
                DefaultCulture = Culture.Code
            });

            brand = BrandQueries.GetBrand(brand.Id);

            Assert.That(brand.BrandCultures.Count, Is.EqualTo(1));
            Assert.That(brand.DefaultCulture, Is.EqualTo(Culture.Code));

            var assignedCulture = brand.BrandCultures.First().Culture;

            Assert.That(assignedCulture.Code, Is.EqualTo(Culture.Code));
            Assert.That(assignedCulture.Name, Is.EqualTo(Culture.Name));
        }
コード例 #21
0
        public void Cannot_execute_BrandCommands_without_permissions()
        {
            /* Arrange */
            LogWithNewAdmin(Modules.VipLevelManager, Permissions.View);

            /* Act */
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.AddVipLevel(new VipLevelViewModel()));
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.EditVipLevel(new VipLevelViewModel()));

            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.ActivateVipLevel(new Guid(), "remarks"));
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.DeactivateVipLevel(new Guid(), "remarks", null));

            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.CreateCountry(TestDataGenerator.GetRandomString(2), TestDataGenerator.GetRandomString(5)));
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.UpdateCountry(TestDataGenerator.GetRandomString(2), TestDataGenerator.GetRandomString(5)));
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.DeleteCountry(TestDataGenerator.GetRandomString(2)));

            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.ActivateCulture(TestDataGenerator.GetRandomString(2), "remark"));
            Assert.Throws <InsufficientPermissionsException>(() => BrandCommands.DeactivateCulture(TestDataGenerator.GetRandomString(2), "remark"));

            Assert.Throws <InsufficientPermissionsException>(() => BrandHelper.CreateBrand());
        }
コード例 #22
0
        public async Task <ActionResult> Detail(String id = "")
        {
            try
            {
                int brandId               = id.Split("-".ToCharArray()).Last().ToInt();
                var pageDesignTask        = PageDesignService.GetPageDesignByName(StoreId, BrandDetailPageDesignName);
                var brandTask             = BrandService.GetBrandAsync(brandId);
                var take                  = GetSettingValueInt("BrandProducts_ItemNumber", 20);
                var productsTask          = ProductService.GetProductsByBrandAsync(StoreId, brandId, take, 0);
                var productCategoriesTask = ProductCategoryService.GetCategoriesByBrandIdAsync(StoreId, brandId);

                var settings = GetStoreSettings();
                BrandHelper.StoreSettings = settings;
                BrandHelper.ImageWidth    = GetSettingValueInt("BrandDetail_ImageWidth", 50);
                BrandHelper.ImageHeight   = GetSettingValueInt("BrandDetail_ImageHeight", 50);

                await Task.WhenAll(brandTask, pageDesignTask, productsTask, productCategoriesTask);

                var pageDesign        = pageDesignTask.Result;
                var products          = productsTask.Result;
                var productCategories = productCategoriesTask.Result;
                var brand             = brandTask.Result;

                if (pageDesign == null)
                {
                    throw new Exception("PageDesing is null:" + BrandDetailPageDesignName);
                }

                var dic = BrandHelper.GetBrandDetailPage(brand, products, pageDesign, productCategories);
                dic.StoreSettings = settings;
                dic.MyStore       = this.MyStore;
                dic.PageTitle     = brand.Name;
                return(View(dic));
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Stack Trace:" + ex.StackTrace, id);
                return(new HttpStatusCodeResult(500));
            }
        }
コード例 #23
0
 public void WhenNewCultureIsCreatedForAdmin()
 {
     ScenarioContext.Current.Add("cultureCode", BrandHelper.CreateCulture(TestDataGenerator.GetRandomString(3), TestDataGenerator.GetRandomString(5)).Code);
 }
コード例 #24
0
 public void WhenNewCountryIsCreatedForAdmin()
 {
     ScenarioContext.Current.Add("countryCode", BrandHelper.CreateCountry(TestDataGenerator.GetRandomString(2), TestDataGenerator.GetRandomString(5)).Code);
 }
コード例 #25
0
        public void SaveGame(
            List <Brands> brands,
            List <Cards> cards,
            List <Matches> matches,
            List <Promotions> promotions,
            List <Teams> teams,
            List <TitlesMain> titles,
            List <WrestlersMain> wrestlers
            )
        {
            string dir = string.Concat(Directory.GetCurrentDirectory(), "\\Saves");

            if (!Directory.Exists(dir))
            {
                Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves"));
            }
            else
            {
                string main = string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\" + "\\" + "Main");

                if (!Directory.Exists(main))
                {
                    Directory.CreateDirectory(string.Concat(Directory.GetCurrentDirectory(), "\\Saves\\" + "\\" + "Main"));
                }
                else
                {
                    BrandHelper     bHelper  = new BrandHelper();
                    CardHelper      cHelper  = new CardHelper();
                    MatchHelper     mHelper  = new MatchHelper();
                    PromotionHelper pHelper  = new PromotionHelper();
                    TeamHelper      tHelper  = new TeamHelper();
                    TitleHelper     tlHelper = new TitleHelper();
                    WrestlerHelper  wHelper  = new WrestlerHelper();

                    foreach (Brands b in brands)
                    {
                        bHelper.SaveBrandsList(b);
                    }

                    foreach (Cards c in cards)
                    {
                        cHelper.SaveCardsList(c);
                    }

                    foreach (Matches m in matches)
                    {
                        mHelper.SaveMatchesList(m);
                    }

                    foreach (Promotions p in promotions)
                    {
                        pHelper.SavePromotionsList(p);
                    }

                    foreach (Teams t in teams)
                    {
                        tHelper.SaveTeamsList(t);
                    }

                    foreach (TitlesMain tl in titles)
                    {
                        tlHelper.SaveTitlesList(tl);
                    }

                    foreach (WrestlersMain w in wrestlers)
                    {
                        wHelper.SaveWrestlersList(w);
                    }
                }
            }
        }
コード例 #26
0
        public void WhenNewLicenseeIsCreated()
        {
            var licensee = BrandHelper.CreateLicensee();

            ScenarioContext.Current.Add("licenseeId", licensee.Id);
        }
コード例 #27
0
        public int CurrentID(
            bool isBrands     = false,
            bool isCards      = false,
            bool isMatches    = false,
            bool isPromotions = false,
            bool isTeams      = false,
            bool isTitles     = false,
            bool isWrestlers  = false
            )
        {
            int currentID = 0;

            if (isBrands)
            {
                BrandHelper         bHelper   = new BrandHelper();
                List <BrandsEntity> allBrands = bHelper.PopulateBrandsList();

                currentID = allBrands.Count() + 1;
            }

            if (isCards)
            {
                CardHelper         cHelper  = new CardHelper();
                List <CardsEntity> allCards = cHelper.PopulateCardsList();

                currentID = allCards.Count() + 1;
            }

            if (isMatches)
            {
                MatchHelper          mHelper    = new MatchHelper();
                List <MatchesEntity> allMatches = mHelper.PopulateMatchesList();

                currentID = allMatches.Count() + 1;
            }

            if (isPromotions)
            {
                PromotionHelper         pHelper   = new PromotionHelper();
                List <PromotionsEntity> allPromos = pHelper.PopulatePromotionsList();

                currentID = allPromos.Count() + 1;
            }

            if (isTeams)
            {
                TeamHelper         tHelper  = new TeamHelper();
                List <TeamsEntity> allTeams = tHelper.PopulateTeamsList();

                currentID = allTeams.Count() + 1;
            }

            if (isTitles)
            {
                TitleHelper         tiHelper  = new TitleHelper();
                List <TitlesEntity> allTitles = tiHelper.PopulateTitlesList();

                currentID = allTitles.Count() + 1;
            }

            if (isWrestlers)
            {
                WrestlerHelper         wHelper   = new WrestlerHelper();
                List <WrestlersEntity> allWrests = wHelper.PopulateWrestlersList();

                currentID = allWrests.Count() + 1;
            }

            return(currentID);
        }
コード例 #28
0
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     //BrandHelper.setBrandGrid(dgBrand);
     BrandHelper.LoadBrandsGrid(dgBrand);
 }