本文整理汇总了C#中Province类的典型用法代码示例。如果您正苦于以下问题:C# Province类的具体用法?C# Province怎么用?C# Province使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Province类属于命名空间,在下文中一共展示了Province类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyHistory
private void ApplyHistory( Province prov )
{
prov.History.Sort( m_dateComparer );
foreach( EventOption ev in prov.History )
{
if ( ev.Date.Year > m_options.StartDate )
break;
foreach( Option op in ev.SubOptions )
{
if( op.GetIDString == "culture" )
{
if ( !prov.CustomFlags.ContainsKey( "old_cul" ) )
prov.CustomFlags["old_cul"] = prov.Culture;
prov.Culture = ( (StringOption)op ).GetValue;
} else if( op.GetIDString == "religion" )
{
if( !prov.CustomFlags.ContainsKey( "old_rel" ) )
prov.CustomFlags["old_rel"] = prov.Religion;
prov.Religion = ( (StringOption)op ).GetValue;
}
}
}
}
示例2: addProvince
public static bool addProvince(Province province, string connString)
{
#region code
bool rs = false;
using (SqlConnection conn = new SqlConnection(connString))
{
try
{
conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "sony_sp_add_province";
cmd.Parameters.AddWithValue("@province", province.SProvince);
cmd.Parameters.AddWithValue("@provinceOrder", province.ProvinceOrder);
SqlParameter returnVal = new SqlParameter("@returnVal", SqlDbType.Int);
returnVal.Direction = ParameterDirection.Output;
cmd.Parameters.Add(returnVal);
cmd.ExecuteNonQuery();
rs = ((int)cmd.Parameters["@returnVal"].Value != 0);
}
}
catch (Exception ex)
{
WriteLog("", "Add Province Error: " + ex.Message, connString);
return false;
}
}
return rs;
#endregion
}
示例3: InitDataBase
public void InitDataBase(string connectionString)
{
using (var ctx = new Context(connectionString))
{
if (ctx.Database.Exists())
ctx.Database.Delete();
ctx.Database.Initialize(true);
List<Province> entityProwinces = new List<Province>();
foreach (var province in ProvinceData.GetProvinces())
{
var prow = new Province { Code = province.Code, Name = province.Name };
ctx.Provinces.Add(prow);
ctx.SaveChanges();
entityProwinces.Add(prow);
}
BulkUploadToSql bulk =
BulkUploadToSql.Load(
HomeData.GetHomes()
.Select(
i =>
new Bulk.Home
{
AddTime = DateTime.Now,
BuildYear = i.BuildYear,
City = i.City,
Description = i.Description,
Price = i.Price,
Surface = i.Surface,
ProvinceId = entityProwinces.Single(j => j.Code == i.HomeProvince.Code).Id
}), "Home", 10000, connectionString);
bulk.Flush();
}
}
示例4: GetProvinces
public static List<Province> GetProvinces()
{
List<Province> provinces = new List<Province>();
SqlConnection connection = TravelExpertsDB.GetConnection();
string query = "SELECT ProvId, ProvName, ProvCode " +
" FROM Provinces";
SqlCommand command = new SqlCommand( query, connection);
try
{
connection.Open();
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
Province province = new Province();
province.ProvId = Convert.ToInt32(reader["ProvId"]);
province.ProvName = reader["ProvName"].ToString();
province.ProvCode = reader["ProvCode"].ToString();
provinces.Add(province);
}
}
catch (SqlException ex)
{
throw ex;
}
finally
{
connection.Close();
}
return provinces;
}
示例5: GetUrlCategorie
/// <summary>
/// Restituisce l'url della categoria
/// </summary>
public static string GetUrlCategorie(Categorie categorie, Regioni regioni = null, Province province = null)
{
string link = string.Empty;
while (categorie != null)
{
link = categorie.Url + "/" + link;
categorie = categorie.Prec;
}
if (province != null)
{
//Se finisce con lo slash /
if (link.EndsWith("/")) link = link.Remove(link.Length - 1);
if (!string.IsNullOrEmpty(link)) link += ".";
return "/annunci/" + link.ToLower() + province.Regioni.Url.ToLower() + "." + province.Url.ToLower();
}
if (regioni != null)
{
//Se finisce con lo slash /
if (link.EndsWith("/")) link = link.Remove(link.Length - 1);
if (!string.IsNullOrEmpty(link)) link += ".";
return "/annunci/" + link.ToLower() + regioni.Url.ToLower();
}
return "/annunci/" + link.ToLower();
}
示例6: ButtonSalvaClick
protected void ButtonSalvaClick(object sender, EventArgs e)
{
if (__ListBox_Regioni.SelectedIndex != -1)
{
if (!string.IsNullOrEmpty(__ListBox_Regioni.SelectedValue) && !string.IsNullOrEmpty(__TextBox_Provincia.Text))
{
var regione = Regioni.GetItem(Regioni.KeyColumnsEnum.Id, int.Parse(__ListBox_Regioni.SelectedValue));
if (regione == null)
{
MessageBox("Selezionare una regione");
return;
}
var provincia = Province.GetItem(Province.KeyColumnsEnum.Id, __ListBox_Province.SelectedValue);
if (provincia == null) provincia = new Province();
provincia.Provincia = __TextBox_Provincia.Text;
provincia.Url = __TextBox_Url.Text;
provincia.Regioni = regione;
if (!Province.Save(out Avviso, ref provincia))
{
MessageBox(Avviso);
return;
}
__TextBox_Provincia.Text = string.Empty;
__TextBox_Url.Text = string.Empty;
CaricaProvince();
}
}
else MessageBox("Seleziona una voce dall'elenco di sinistra");
}
示例7: StartScout
//public Noble(Color nC, string n) : this(nC, n, 4, 3, 0, 10, 10, 10, 10) { }
public IEnumerator StartScout(Province p, int aP, int mP, int pP)
{
int adminPointsUsed = aP, militaryPointsUsed = mP, politicalPointsUsed = pP;
if (adminPointsUsed > administrativePointsLeft) adminPointsUsed = administrativePointsLeft;
else if (adminPointsUsed < 0) adminPointsUsed = 0;
if (militaryPointsUsed > militaryPointsLeft) militaryPointsUsed = militaryPointsLeft;
else if (militaryPointsUsed < 0) militaryPointsUsed = 0;
if (politicalPointsUsed > politicalPointsLeft) politicalPointsUsed = politicalPointsLeft;
else if (politicalPointsUsed < 0) politicalPointsUsed = 0;
if (scouting.IndexOf(p.provinceName) < 0 && politicalPointsUsed >= 1)
{
administrativePointsLeft -= adminPointsUsed;
militaryPointsLeft -= militaryPointsUsed;
politicalPointsLeft -= politicalPointsUsed;
scouting.Add(p.provinceName);
yield return new WaitForSeconds(scoutTime / (adminPointsUsed + militaryPointsUsed + politicalPointsUsed));
ScoutLand(p);
scouting.Remove(p.provinceName);
administrativePointsLeft += adminPointsUsed;
militaryPointsLeft += militaryPointsUsed;
politicalPointsLeft += politicalPointsUsed;
}
}
示例8: alignAgentsIntoRows
/// <summary>
/// Agent is parented to agents aka. the province he is in.
/// His position is at province pivot.
/// We adjust his local coordinate, because we take into account he is in Britain.
/// No sense to adjust his world space coord.
/// </summary>
private void alignAgentsIntoRows(int agentCount, Agent agent, Province province)
{
//TODO test purpose
agent.transform.localPosition = Vector3.zero;
Vector3 positionRelativeToBritainProvincePivot = new Vector3(2f, 1f, 0f);//for Britain only
agent.transform.localPosition = agent.transform.localPosition + positionRelativeToBritainProvincePivot + (0.4f) * (agentCount % 4) * Vector3.right + (0.4f) * (agentCount / 4) * Vector3.down;
}
示例9: DeleteProvince
public void DeleteProvince(Province province)
{
if (province == null)
throw new ArgumentNullException("province");
using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings[this.ConnectionStringName].ConnectionString))
{
connection.Open();
var command = new SqlCommand("usp_DeleteProvince", connection)
{
CommandType = System.Data.CommandType.StoredProcedure
};
command.Parameters.Add(new SqlParameter
{
Direction = ParameterDirection.Input,
IsNullable = true,
ParameterName = "@ID",
SqlDbType = SqlDbType.UniqueIdentifier,
SqlValue = province.ID
});
command.ExecuteNonQuery();
}
}
示例10: District
public District(decimal latitude, decimal longitude)
{
Latitude = latitude;
Longitude = longitude;
Id = string.Empty;
DistrictName = string.Empty;
Province = new Province();
}
示例11: isLocationInProvince
public bool isLocationInProvince(Province province)
{
if(province == null) {
return false;
}
return this.province.descriptor.provinceName.Equals(province.descriptor.provinceName);
}
示例12: CreateProvince
public Province CreateProvince(ProvinceInitData initData)
{
var province = new Province();
province.DisplayName = initData.DisplayName;
Provinces.Add(province);
province.Init(this);
return province;
}
示例13: GetAccounts
public static List<Account> GetAccounts(
string name,
int gender,
string bloodType,
int birthYear,
int birthMonth,
int birthDate,
City hometownCity,
Province homwtownProvince,
City resideCity,
Province resideProvince,
ClassInfo classInfo,
Grade grade,
Major major,
College college,
University university,
string code,
bool? hasAvatar,
string nickName,
bool? isProtected,
int minViewCount,
int maxViewCount,
bool? isPublic,
int minYear,
int maxYear,
string interest,
PagingInfo pagingInfo)
{
return provider.GetAccounts(
name,
gender,
bloodType,
birthYear,
birthMonth,
birthDate,
hometownCity,
homwtownProvince,
resideCity,
resideProvince,
classInfo,
grade,
major,
college,
university,
code,
hasAvatar,
nickName,
isProtected,
minViewCount,
maxViewCount,
isPublic,
minYear,
maxYear,
interest,
pagingInfo);
}
示例14: SupportMoveOrder
/// <summary>Creates a new <see cref="SupportMoveOrder"/> instance.
/// </summary>
/// <param name="unit">The <see cref="Unit"/> that this order concerns.</param>
/// <param name="supportedUnit">Supported <see cref="Unit"/>.</param>
/// <param name="targetProvince">Target <see cref="Province"/>.</param>
public SupportMoveOrder(Unit unit, Unit supportedUnit, Province targetProvince)
: base(OrderType.SupportMove, unit)
{
if( supportedUnit == null )
{
throw new ArgumentNullException("supportedUnit");
}
this.supportedUnit = supportedUnit;
this.targetProvince = targetProvince;
}
示例15: createAgent
private Agent createAgent(Province province)
{
Mover agentMover = GetMover();
Agent createdAgent = AgentFactory.Instance.Build(StringGenerator.getRandomName(), StringGenerator.getRandomSurname(), StringGenerator.getRandomPortraitName());
agentMover.AddAgentToProvince(createdAgent, province);
Notifier.Instance.notify(EventFactory.Build("Agent created", createdAgent.descriptor.name.ToUpper()));
return createdAgent;
}