• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Country类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: TransitState

        public TransitState(Country country, CompetentAuthority competentAuthority, EntryOrExitPoint entryPoint, EntryOrExitPoint exitPoint, int ordinalPosition)
        {
            Guard.ArgumentNotNull(() => country, country);
            Guard.ArgumentNotNull(() => competentAuthority, competentAuthority);
            Guard.ArgumentNotNull(() => entryPoint, entryPoint);
            Guard.ArgumentNotNull(() => exitPoint, exitPoint);
            Guard.ArgumentNotZeroOrNegative(() => OrdinalPosition, ordinalPosition);

            if (country.Id != competentAuthority.Country.Id 
                || country.Id != entryPoint.Country.Id
                || country.Id != exitPoint.Country.Id)
            {
                throw new InvalidOperationException(string.Format("Transit State Competent Authority, Entry and Exit Point must all have the same country. Competent Authority: {0}. Entry: {1}. Exit: {2}. Country: {3}",
                    competentAuthority.Id,
                    entryPoint.Id,
                    exitPoint.Id,
                    country.Name));
            }

            Country = country;
            CompetentAuthority = competentAuthority;
            ExitPoint = exitPoint;
            EntryPoint = entryPoint;
            OrdinalPosition = ordinalPosition;
        }
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:25,代码来源:TransitState.cs


示例2: AbstractYahooMarketServer

 public AbstractYahooMarketServer(Country country)
 {
     this.country = country;
     this.stockServer = getStockServer(country);
     /* Hack on Malaysia Market! The format among Yahoo and CIMB are difference. */
     if (country == Country.Malaysia)
     {
         List<Index> tmp = new List<Index>();
         foreach (Index index in Utils.getStockIndices(country))
         {
             if (IndexHelper.Instance().GetIndexCode(index).toString().StartsWith("^"))
             {
                 tmp.Add(index);
             }
         }
         this.indicies = tmp;
     }
     else
     {
         this.indicies = Utils.getStockIndices(country);
     }
     if (this.indicies.Count == 0)
     {
         throw new ArgumentException(country.ToString());
     }
     foreach (Index index in indicies)
     {
         Code curCode = IndexHelper.Instance().GetIndexCode(index);
         codes.Add(curCode);
         codeToIndexMap.Add(curCode, index);
     }
 }
开发者ID:soross,项目名称:stockanalyzer,代码行数:32,代码来源:AbstractYahooMarketServer.cs


示例3: Countries_Inserting

partial         void Countries_Inserting(Country entity)
        {
            entity.InsertDate = DateTime.Now;
            entity.InsertUser = Application.User.Name;
            entity.UpdateDate = DateTime.Now;
            entity.UpdateUser = Application.User.Name;
        }
开发者ID:karthikeyan51,项目名称:EMS,代码行数:7,代码来源:EMSDataService.cs


示例4: CanAddCountriesToCollection

 public void CanAddCountriesToCollection()
 {
     var c = new Country("MEE");
     var collection = new CountryCollection();
     collection.Add(c);
     Assert.That(collection.Count(), Is.EqualTo(1));
 }
开发者ID:nickbabcock,项目名称:EU4.Savegame,代码行数:7,代码来源:CountryCollectionTests.cs


示例5: update

        public HttpResponseMessage update(Country post, Int32 languageId = 0)
        {
            // Check for errors
            if (post == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The post is null");
            }
            else if (Language.MasterPostExists(languageId) == false)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The language does not exist");
            }

            // Make sure that the data is valid
            post.country_code = AnnytabDataValidation.TruncateString(post.country_code, 2);
            post.name = AnnytabDataValidation.TruncateString(post.name, 50);

            // Get the saved post
            Country savedPost = Country.GetOneById(post.id, languageId);

            // Check if the post exists
            if(savedPost == null)
            {
                return Request.CreateResponse<string>(HttpStatusCode.BadRequest, "The record does not exist");
            }

            // Update the post
            Country.UpdateMasterPost(post);
            Country.UpdateLanguagePost(post, languageId);

            // Return the success response
            return Request.CreateResponse<string>(HttpStatusCode.OK, "The update was successful");

        } // End of the update method
开发者ID:raphaelivo,项目名称:a-webshop,代码行数:33,代码来源:countriesController.cs


示例6: GetCountryByID

 public static Country GetCountryByID(int id)
 {
     Country country = new Country();
     SqlCountryProvider sqlCountryProvider = new SqlCountryProvider();
     country = sqlCountryProvider.GetCountryByID(id);
     return country;
 }
开发者ID:anam,项目名称:gp-HO,代码行数:7,代码来源:CountryManager.cs


示例7: adjustedStrength

        // return the "true" strength of a territory including incoming transfers
        private int adjustedStrength(Country c, int attackBias)
        {
            int strength = c.getStrength();

            int attackers = attackBias;
            int transfers = 0;
            foreach (Movement m in gScreen.movements)
            {
                if (m.dest == c)
                {
                    if (m.origin.getOwner() == this)
                        transfers++;
                    else
                        attackers++;
                }
                if (m.origin == c)
                    attackers++;
            }

            // only count incoming transfers if there are more of them than outgoing transfers
            if (transfers >= attackers && transfers >= 0)
            {
                foreach (Movement m in gScreen.movements)
                {
                    if (m.dest == c && m.origin.getOwner() == this)
                        strength += m.origin.getStrength() - 1;
                }
            }

            return strength;
        }
开发者ID:kzielnicki,项目名称:Brisk,代码行数:32,代码来源:AI.cs


示例8: Main

        public static void Main()
        {
            var db = new ApplicationDbContext();

            var configuration = Configuration.Default.WithDefaultLoader();
            var browsingContext = BrowsingContext.New(configuration);

            var url = "https://countrycode.org/";
            var document = browsingContext.OpenAsync(url).Result;

            var countryTable = document.QuerySelectorAll("tbody tr");

            foreach (var row in countryTable)
            {
                var country = new Country
                {
                    Name = row.Children[0].TextContent.Trim(),
                    CountryCode = row.Children[2].TextContent.Trim().Substring(5)
                };

                db.Countries.Add(country);
            }

            db.SaveChanges();
        }
开发者ID:kiko81,项目名称:TABS,代码行数:25,代码来源:Crawler.cs


示例9: RadioWebStreamChannel

 /// <summary>
 /// Initializes a new instance of the <see cref="RadioWebStreamChannel"/> class.
 /// </summary>
 public RadioWebStreamChannel()
 {
   CountryCollection collection = new CountryCollection();
   _country = collection.GetTunerCountryFromID(31);
   Name = String.Empty;
   Url = String.Empty;
 }
开发者ID:arangas,项目名称:MediaPortal-1,代码行数:10,代码来源:RadioWebStreamChannel.cs


示例10: MaakCountry

        private static Country MaakCountry(string lijn)
        {
            try
            {
                String[] stukken = lijn.Split(new char[] { ';' });
                if (stukken.Length != 16) return null;

                Country c = new Country()
                {
                    Code = stukken[0].Trim(),
                    Name = stukken[1].Trim(),
                    Continent = stukken[2].Trim(),
                    Region = stukken[3].Trim(),
                    SurfaceArea = stukken[4].ToNDouble().Value
                   , IndepYear= stukken[4].ToNInt()
                   , Population = stukken[6].ToNInt().Value
                   , LifeExpectancy = stukken[7].ToNDouble()
                   , GNP = stukken[8].ToNDouble().Value
                   , GNPOld = stukken[9].ToNDouble()
                   , LocalName = stukken[10].Trim()
                   , GovernmentForm = stukken[11].Trim()
                   , HeadOfState = stukken[12].Trim()
                   , Capital = stukken[13].ToNInt()
                   , Code2 = stukken[14].Trim()
                };
                return c;
            }
            catch (Exception ex) { return null; }
        }
开发者ID:ZiggyMaes,项目名称:NMCT-Business-Applications,代码行数:29,代码来源:CountryRepository.cs


示例11: Update

    // Update is called once per frame
    void Update()
    {
        if (GameManager.instance.gameState == GameVariableManager.GameState.Management)
        {
        chosenCountry = GameObject.Find ("Player").GetComponent<PlayerScript> ().country;
        sentMetal = chosenCountry.metalToShip + chosenCountry.metalToFE + chosenCountry.metalToOF + chosenCountry.metalToUAT + chosenCountry.metalToRN + (int)chosenCountry.metalToMilitary;
            sentOil = chosenCountry.oilToShip + chosenCountry.oilToFE + chosenCountry.oilToOF + chosenCountry.oilToUAT + chosenCountry.oilToRN + (int)chosenCountry.oilToMilitary;

        mtLabel.text = chosenCountry.metalToMilitary.ToString();
        fuLabel.text = chosenCountry.oilToMilitary.ToString();

        if (mtUP.hold & chosenCountry.stockMetal > 0 & sentMetal < chosenCountry.stockMetal)
        {
            chosenCountry.metalToMilitary += 1.0f;
        }
        if (mtDN.hold & chosenCountry.metalToMilitary > 0)
        {
            chosenCountry.metalToMilitary -= 1.0f;
        }
        if (fuUP.hold & chosenCountry.stockOil > 0 & sentOil < chosenCountry.stockOil)
        {
            chosenCountry.oilToMilitary += 1.0f;
        }
        if (fuDN.hold & chosenCountry.oilToMilitary > 0)
        {
            chosenCountry.oilToMilitary -= 1.0f;
        }
        }
    }
开发者ID:nkornek,项目名称:Spaceship,代码行数:30,代码来源:resource_alloc_military.cs


示例12: TestCreateAndGetAll

        public void TestCreateAndGetAll()
        {
            ICountryDao countryDao = new CountryDao(_graphClient);
            Country country = new Country() {Name = "D"};
            countryDao.Create(country);

            IRoutesDao routeDao = new RouteDao(_graphClient);
            Route route = new Route() {Name = "Route1"};
            routeDao.CreateIn(country, route);

            IDifficultyLevelScaleDao scaleDao = new DifficultyLevelScaleDao(_graphClient);
            DifficultyLevelScale scale = new DifficultyLevelScale() {Name = "sächsisch"};
            scaleDao.Create(scale);

            IDifficultyLevelDao levelDao = new DifficultyLevelDao(_graphClient);
            DifficultyLevel level = new DifficultyLevel() {Name = "7b"};
            levelDao.Create(scale, level);

            IVariationDao variationDao = new VariationDao(_graphClient);
            Variation variation = new Variation() {Name = "Ein Weg der Route1 als 7b"};
            Variation created = variationDao.Create(variation, route, level);

            IList<Variation> variationsOnRoute = variationDao.GetAllOn(route);
            Assert.AreEqual(1, variationsOnRoute.Count);
            Assert.AreEqual(variation.Name, variationsOnRoute.First().Name);
            Assert.AreEqual(variation.Id, variationsOnRoute.First().Id);
            Assert.AreEqual(created.Id, variationsOnRoute.First().Id);
        }
开发者ID:gitter-badger,项目名称:SummitLog,代码行数:28,代码来源:VariationDaoTest.cs


示例13: createCoutryFromDALCoutry

 internal static Country createCoutryFromDALCoutry(CarpoolingDAL.Coutry co)
 {
     Country nc = new Country();
     nc.Id = co.idCoutry;
     nc.Name = co.name;
     return nc;
 }
开发者ID:diegoffline,项目名称:carpooling13,代码行数:7,代码来源:RepositoryUtility.cs


示例14: SCountry

 private SCountry(HttpContextBase context, Country country, Culture culture = Culture.En)
 {
     Id = country.Id;
     Name = country.GetName(culture);
     Image = DefineImagePath(context, country.Image);
     Rating = country.Rating;
 }
开发者ID:Reidan94,项目名称:ITouristDashboard,代码行数:7,代码来源:SCountry.cs


示例15: UpdateCountry

        public void UpdateCountry(Country country, int byUserId)
        {
            OleDbConnection connection = new OleDbConnection(DatabaseData.Instance.AccessConnectionString);
            using (connection)
            {
                connection.Open();
                try
                {
                    OleDbCommand command = new OleDbCommand(@"Update Country set MonthYearStarts=1,
                         [email protected], [email protected], [email protected] WHERE ID = @id", connection);
                    command.Parameters.Add(new OleDbParameter("@updatedby", byUserId));
                    command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@updatedat", DateTime.Now));
                    command.Parameters.Add(new OleDbParameter("@TaskForceName", country.TaskForceName));
                    command.Parameters.Add(new OleDbParameter("@id", country.Id));
                    command.ExecuteNonQuery();

                    command = new OleDbCommand(@"Update AdminLevels set [email protected], [email protected], [email protected] WHERE ID = @id", connection);
                    command.Parameters.Add(new OleDbParameter("@DisplayName", country.Name));
                    command.Parameters.Add(new OleDbParameter("@updatedby", byUserId));
                    command.Parameters.Add(OleDbUtil.CreateDateTimeOleDbParameter("@updatedat", DateTime.Now));
                    command.Parameters.Add(new OleDbParameter("@id", country.Id));
                    command.ExecuteNonQuery();
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
开发者ID:ericjohnolson,项目名称:NadaNtd,代码行数:29,代码来源:DemoRepository.cs


示例16: is_satisfied_by

 public bool is_satisfied_by(Quantity item_quantity, Country country)
 {
     if (item_quantity.contains_more_than(quantity_threshold))
         return false;
     else
         return true;
 }
开发者ID:elbandit,项目名称:PPPDDD,代码行数:7,代码来源:OverseasSellingPolicy.cs


示例17: IsEqualTo

        /// <summary>
        /// Determines whether the country instance is equal to the specified other country instance.
        /// </summary>
        /// <param name="country">The country instance.</param>
        /// <param name="other">The other country instance to be compared to.</param>
        /// <returns>True, if both countries are equal; otherwise, false.</returns>
        public static bool IsEqualTo(this Country? country, Country? other)
        {
            if(country == null)
                return other == null;

            return other != null && country.Value.IsEqualTo(other.Value);
        }
开发者ID:eithery,项目名称:core,代码行数:13,代码来源:CountryExtensions.cs


示例18: should_return_country

            public static void should_return_country()
            {
                //arrange
                Team team2 = null;
                UnitOfWork.Do(uow =>
                {
                    var country1 = new Country { Name = "USA", Language = "English" };
                    uow.Repo<Country>().Insert(country1);

                    var country2 = new Country { Name = "Mexico", Language = "Spanish" };
                    uow.Repo<Country>().Insert(country2);

                    Team team1 = new Team() { Name = "Super", Description = "SuperBg", Country = country1 };
                    uow.Repo<Team>().Insert(team1);

                    team2 = new Team() { Name = "Awesome", Description = "AwesomeBg", Country = country2 };
                    uow.Repo<Team>().Insert(team2);
                });

                UnitOfWork.Do(uow =>
                {
                    //act
                    var result = uow.Repo<Team>().AsQueryable().Include(t => t.Country).First(t => t.Country.Name == "Mexico");

                    //assert
                    result.Id.Should().Be(team2.Id);
                    result.Name.Should().Be("Awesome");
                    result.Description.Should().Be("AwesomeBg");
                    result.Country.Name.Should().Be("Mexico");
                });
            }
开发者ID:malylemire1,项目名称:Antler,代码行数:31,代码来源:CommonDomainSpecs.cs


示例19: ScenarioPassengerDemand

 public ScenarioPassengerDemand(double factor, DateTime enddate, Country country, Airport airport)
 {
     this.Country = country;
     this.Factor = factor;
     this.EndDate = enddate;
     this.Airport = airport;
 }
开发者ID:tehknox,项目名称:tap-desktop,代码行数:7,代码来源:ScenarioPassengerDemand.cs


示例20: GetCurrentBasket_should_throw_when_the_default_country_is_not_in_the_database

        public void GetCurrentBasket_should_throw_when_the_default_country_is_not_in_the_database()
        {
            var country = new Country { Name = "France" }; // expect the default country to be UK.
            countryRepository.Stub(r => r.GetAll()).Return(new[] { country }.AsQueryable());

            basketService.GetCurrentBasketForCurrentUser();
        }
开发者ID:somlea-george,项目名称:sutekishop,代码行数:7,代码来源:BasketServiceTests.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Course类代码示例发布时间:2022-05-24
下一篇:
C# CounterType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap