当前位置: 首页>>代码示例>>C#>>正文


C# Directory.Country类代码示例

本文整理汇总了C#中Nop.Core.Domain.Directory.Country的典型用法代码示例。如果您正苦于以下问题:C# Country类的具体用法?C# Country怎么用?C# Country使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Country类属于Nop.Core.Domain.Directory命名空间,在下文中一共展示了Country类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Can_save_and_load_country

        public void Can_save_and_load_country()
        {
            var country = new Country
            {
                Name = "United States",
                AllowsBilling = true,
                AllowsShipping = true,
                TwoLetterIsoCode = "US",
                ThreeLetterIsoCode = "USA",
                NumericIsoCode = 1,
                SubjectToVat = true,
                Published = true,
                DisplayOrder = 1,
                LimitedToStores = true
            };

            var fromDb = SaveAndLoadEntity(country);
            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("United States");
            fromDb.AllowsBilling.ShouldEqual(true);
            fromDb.AllowsShipping.ShouldEqual(true);
            fromDb.TwoLetterIsoCode.ShouldEqual("US");
            fromDb.ThreeLetterIsoCode.ShouldEqual("USA");
            fromDb.NumericIsoCode.ShouldEqual(1);
            fromDb.SubjectToVat.ShouldEqual(true);
            fromDb.Published.ShouldEqual(true);
            fromDb.DisplayOrder.ShouldEqual(1);
            fromDb.LimitedToStores.ShouldEqual(true);
        }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:29,代码来源:CountryPersistenceTests.cs

示例2: Can_save_and_load_country_with_states

        public void Can_save_and_load_country_with_states()
        {
            var country = new Country
            {
                Name = "United States",
                AllowsBilling = true,
                AllowsShipping = true,
                TwoLetterIsoCode = "US",
                ThreeLetterIsoCode = "USA",
                NumericIsoCode = 1,
                SubjectToVat = true,
                Published = true,
                DisplayOrder = 1
            };
            country.StateProvinces.Add
                (
                    new StateProvince()
                    {
                        Name = "California",
                        Abbreviation = "CA",
                        DisplayOrder = 1
                    }
                );
            var fromDb = SaveAndLoadEntity(country);
            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("United States");

            fromDb.StateProvinces.ShouldNotBeNull();
            (fromDb.StateProvinces.Count == 1).ShouldBeTrue();
            fromDb.StateProvinces.First().Name.ShouldEqual("California");
        }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:31,代码来源:CountryPersistenceTests.cs

示例3: Can_save_and_load_country_with_restrictions

        public void Can_save_and_load_country_with_restrictions()
        {
            var country = new Country
            {
                Name = "United States",
                AllowsBilling = true,
                AllowsShipping = true,
                TwoLetterIsoCode = "US",
                ThreeLetterIsoCode = "USA",
                NumericIsoCode = 1,
                SubjectToVat = true,
                Published = true,
                DisplayOrder = 1
            };
            country.RestrictedShippingMethods.Add
                (
                    new ShippingMethod()
                    {
                        Name = "By train",
                    }
                );
            var fromDb = SaveAndLoadEntity(country);
            fromDb.ShouldNotBeNull();
            fromDb.Name.ShouldEqual("United States");

            fromDb.RestrictedShippingMethods.ShouldNotBeNull();
            (fromDb.RestrictedShippingMethods.Count == 1).ShouldBeTrue();
            fromDb.RestrictedShippingMethods.First().Name.ShouldEqual("By train");
        }
开发者ID:emretiryaki,项目名称:paymill-nopcommerce,代码行数:29,代码来源:CountryPersistenceTests.cs

示例4: UpdateLocales

 protected void UpdateLocales(Country country, CountryModel model)
 {
     foreach (var localized in model.Locales)
     {
         _localizedEntityService.SaveLocalizedValue(country,
                                                        x => x.Name,
                                                        localized.Name,
                                                        localized.LanguageId);
     }
 }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:10,代码来源:CountryController.cs

示例5: GetPaypalCountryCodeType

 /// <summary>
 /// Get Paypal country code
 /// </summary>
 /// <param name="country">Country</param>
 /// <returns>Paypal country code</returns>
 protected CountryCodeType GetPaypalCountryCodeType(Country country)
 {
     CountryCodeType payerCountry = CountryCodeType.US;
     try
     {
         payerCountry = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), country.TwoLetterIsoCode);
     }
     catch
     {
     }
     return payerCountry;
 }
开发者ID:minuzZ,项目名称:zelectroshop,代码行数:17,代码来源:PayPalDirectPaymentProcessor.cs

示例6: DeleteCountry

        /// <summary>
        /// Deletes a country
        /// </summary>
        /// <param name="country">Country</param>
        public virtual void DeleteCountry(Country country)
        {
            if (country == null)
                throw new ArgumentNullException("country");

            _countryRepository.Delete(country);

            _cacheManager.RemoveByPattern(COUNTRIES_PATTERN_KEY);

            //event notification
            _eventPublisher.EntityDeleted(country);
        }
开发者ID:LaOrigin,项目名称:Leorigin,代码行数:16,代码来源:CountryService.cs

示例7: GetPaypalCountryCodeType

 /// <summary>
 /// Get Paypal country code
 /// </summary>
 /// <param name="country">Country</param>
 /// <returns>Paypal country code</returns>
 protected CountryCodeType GetPaypalCountryCodeType(Country country)
 {
     var payerCountry = CountryCodeType.US;
     try
     {
         payerCountry = (CountryCodeType)Enum.Parse(typeof(CountryCodeType), country.TwoLetterIsoCode.ToUpperInvariant());
     }
     catch
     {
     }
     return payerCountry;
 }
开发者ID:NALSS,项目名称:grandnode,代码行数:17,代码来源:PayPalDirectPaymentProcessor.cs

示例8: ToEntity

 public static Country ToEntity(this CountryModel model, Country destination)
 {
     return Mapper.Map(model, destination);
 }
开发者ID:nguyentu1982,项目名称:quancu,代码行数:4,代码来源:MappingExtensions.cs

示例9: PrepareStoresMappingModel

        private void PrepareStoresMappingModel(CountryModel model, Country country, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableStores = _storeService
                .GetAllStores()
                .Select(s => s.ToModel())
                .ToList();
            if (!excludeProperties)
            {
                if (country != null)
                {
                    model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(country);
                }
                else
                {
                    model.SelectedStoreIds = new int[0];
                }
            }
        }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:21,代码来源:CountryController.cs

示例10: SaveStoreMappings

 protected void SaveStoreMappings(Country country, CountryModel model)
 {
     var existingStoreMappings = _storeMappingService.GetStoreMappings(country);
     var allStores = _storeService.GetAllStores();
     foreach (var store in allStores)
     {
         if (model.SelectedStoreIds != null && model.SelectedStoreIds.Contains(store.Id))
         {
             //new role
             if (existingStoreMappings.Count(sm => sm.StoreId == store.Id) == 0)
                 _storeMappingService.InsertStoreMapping(country, store.Id);
         }
         else
         {
             //removed role
             var storeMappingToDelete = existingStoreMappings.FirstOrDefault(sm => sm.StoreId == store.Id);
             if (storeMappingToDelete != null)
                 _storeMappingService.DeleteStoreMapping(storeMappingToDelete);
         }
     }
 }
开发者ID:haithemChkel,项目名称:nopCommerce_33,代码行数:21,代码来源:CountryController.cs

示例11: InstallCountriesAndStates

        protected virtual void InstallCountriesAndStates()
        {
            var cUsa = new Country
            {
                Id = 1,
                _id = ObjectId.GenerateNewId().ToString(),
                Name = "United States",
                AllowsBilling = true,
                AllowsShipping = true,
                TwoLetterIsoCode = "US",
                ThreeLetterIsoCode = "USA",
                NumericIsoCode = 840,
                SubjectToVat = false,
                DisplayOrder = 1,
                Published = true,
            };

            var states = new List<StateProvince>();
            _countryRepository.Insert(cUsa);

            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "AA (Armed Forces Americas)",
                Abbreviation = "AA",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "AE (Armed Forces Europe)",
                Abbreviation = "AE",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "Alabama",
                Abbreviation = "AL",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "Alaska",
                Abbreviation = "AK",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "American Samoa",
                Abbreviation = "AS",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "AP (Armed Forces Pacific)",
                Abbreviation = "AP",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "Arizona",
                Abbreviation = "AZ",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "Arkansas",
                Abbreviation = "AR",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "California",
                Abbreviation = "CA",
                Published = true,
                DisplayOrder = 1,
            });
            states.Add(new StateProvince
            {
                CountryId = 1,
                Name = "Colorado",
                Abbreviation = "CO",
                Published = true,
                DisplayOrder = 1,
            });
//.........这里部分代码省略.........
开发者ID:powareverb,项目名称:grandnode,代码行数:101,代码来源:CodeFirstInstallationService.cs

示例12: PrepareStoresMappingModel

        protected virtual void PrepareStoresMappingModel(CountryModel model, Country country, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            if (!excludeProperties && country != null)
                model.SelectedStoreIds = _storeMappingService.GetStoresIdsWithAccess(country).ToList();

            var allStores = _storeService.GetAllStores();
            foreach (var store in allStores)
            {
                model.AvailableStores.Add(new SelectListItem
                {
                    Text = store.Name,
                    Value = store.Id.ToString(),
                    Selected = model.SelectedStoreIds.Contains(store.Id)
                });
            }
        }
开发者ID:RobinHoody,项目名称:nopCommerce,代码行数:19,代码来源:CountryController.cs

示例13: UpdateLocales

        protected virtual List<LocalizedProperty> UpdateLocales(Country country, CountryModel model)
        {
            List<LocalizedProperty> localized = new List<LocalizedProperty>();
            foreach (var local in model.Locales)
            {

                localized.Add(new LocalizedProperty()
                {
                    LanguageId = local.LanguageId,
                    LocaleKey = "Name",
                    LocaleValue = local.Name
                });
            }
            return localized;
        }
开发者ID:powareverb,项目名称:grandnode,代码行数:15,代码来源:CountryController.cs

示例14: PrepareStoresMappingModel

        protected virtual void PrepareStoresMappingModel(CountryModel model, Country country, bool excludeProperties)
        {
            if (model == null)
                throw new ArgumentNullException("model");

            model.AvailableStores = _storeService
                .GetAllStores()
                .Select(s => s.ToModel())
                .ToList();
            if (!excludeProperties)
            {
                if (country != null)
                {
                    model.SelectedStoreIds = country.Stores.ToArray();
                }
            }
        }
开发者ID:powareverb,项目名称:grandnode,代码行数:17,代码来源:CountryController.cs

示例15: CityList

        public ActionResult CityList(DataSourceRequest command, int productId)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageProducts))
                return AccessDeniedView();

            var product = _productService.GetProductById(productId);
            if (product == null)
                throw new ArgumentException("No product found with the specified id");

            //a vendor should have access only to his products
            if (_workContext.CurrentVendor != null && product.VendorId != _workContext.CurrentVendor.Id)
                return Content("This is not your product");
            var Cities = _productCitiesService.GetProductsCitiesByProductId(productId);
            List<ProductModel.CityModel> citymodel = new List<ProductModel.CityModel>();
            foreach (var c in Cities)
            {
                if (c != null)
                {
                    ProductModel.CityModel city = new ProductModel.CityModel();
                    string countryName;
                    var state = new StateProvince();
                    var country = new Country();
                    var cty = new City();
                    if (c.CityID > 0)
                    {
                        cty = _cityService.GetCityById(c.CityID);
                        state = _stateProvinceService.GetStateProvinceById(cty.StateID);
                        country = _countryService.GetCountryById(state.Id);
                        countryName = country != null ? country.Name : "Deleted";
                    }
                    else
                    {
                        countryName = _localizationService.GetResource("Admin.Catalog.Products.City.Fields.Country.All");
                    }

                    city.Id = c.Id;
                    city.CityId = c.CityID;
                    city.City = cty.CityName;
                    city.CountryId = country != null ? country.Id : 0;
                    city.Country = country != null ? country.Name : "Deleted";
                    city.StateId = state != null ? state.Id : 0;
                    city.State = state != null ? state.Name : "Deleted";
                    city.ProductId = c.ProductID;
                    citymodel.Add(city);
                }
            }
            var gridModel = new DataSourceResult
            {
                Data = citymodel,
                Total = citymodel.Count
            };
            return Json(gridModel);
        }
开发者ID:LaOrigin,项目名称:Leorigin,代码行数:53,代码来源:ProductController.cs


注:本文中的Nop.Core.Domain.Directory.Country类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。