本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例4: CanAddCountriesToCollection
public void CanAddCountriesToCollection()
{
var c = new Country("MEE");
var collection = new CountryCollection();
collection.Add(c);
Assert.That(collection.Count(), Is.EqualTo(1));
}
示例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
示例6: GetCountryByID
public static Country GetCountryByID(int id)
{
Country country = new Country();
SqlCountryProvider sqlCountryProvider = new SqlCountryProvider();
country = sqlCountryProvider.GetCountryByID(id);
return country;
}
示例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;
}
示例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();
}
示例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;
}
示例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; }
}
示例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;
}
}
}
示例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);
}
示例13: createCoutryFromDALCoutry
internal static Country createCoutryFromDALCoutry(CarpoolingDAL.Coutry co)
{
Country nc = new Country();
nc.Id = co.idCoutry;
nc.Name = co.name;
return nc;
}
示例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;
}
示例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;
}
}
}