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


C# Country类代码示例

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


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


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