本文整理汇总了C#中Race.AddPass方法的典型用法代码示例。如果您正苦于以下问题:C# Race.AddPass方法的具体用法?C# Race.AddPass怎么用?C# Race.AddPass使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Race
的用法示例。
在下文中一共展示了Race.AddPass方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BuildRace
public void BuildRace(Race race)
{
race.Name = _year;
MySqlConnection conn = new MySqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings[_conn].ConnectionString);
conn.Open();
// Adding supers
var cmd = new MySqlCommand(@"select startNumber, cardid, firstname, surname, personClassCode, ifnull(companyClass, 0) as companyClass, phoneNumber from " + _year + "_person where superwife = 1 and deleted = 0 and startnumber is not null and cardid is not null", conn);
var data = cmd.ExecuteReader();
while (data.Read())
{
var p = new Participant()
{
Startnumber = data.GetInt32("startNumber"),
EmitID = int.Parse(data.GetString("cardid")),
Name = data.GetString("firstname") + " " + data.GetString("surname"),
Telephone = new List<String>() { data.GetString("phoneNumber") },
Classes = new List<ParticipantClass>() { race.Classes.Find(x => x.Id.Equals(data.GetString("personClassCode"))) },
IsTeam = false,
IsSuper = true,
IsCompany = data.GetInt32("companyClass").Equals(1)
};
if (p.IsCompany)
{
p.Classes.Add(race.Classes.Find(x => x.Id.Equals(data.GetString("personClassCode").Substring(0, 2) + "BED")));
p.Classes.Add(race.Classes.Find(x => x.Id.Equals("BED")));
}
race.AddParticipant(p);
}
data.Close();
// Adding teams
cmd = new MySqlCommand(@"SELECT t.startNumber, t.cardid, t.name, t.teamClassCode, t.companyClass, p.firstname, p.surname, p.phoneNumber, p.sprintNumber FROM " + _year + "_team t inner join " + _year + "_person p on t.id = p.teamid where t.deleted = 0 and t.startNumber is not null and t.cardid is not null order by t.startNumber, p.sprintNumber", conn);
data = cmd.ExecuteReader();
data.Read();
bool moreData = true;
do
{
var p = new Participant()
{
Startnumber = data.GetInt32("startNumber"),
EmitID = int.Parse(data.GetString("cardid")),
Name = data.GetString("name"),
Telephone = new List<String>() { data.GetString("phoneNumber").Replace(" ", "") },
Classes = new List<ParticipantClass> { race.Classes.Find(x => x.Id.Equals(data.GetString("teamClassCode"))) },
IsTeam = true,
IsSuper = false,
IsCompany = data.GetInt32("companyClass").Equals(1)
};
if (p.IsCompany)
{
p.Classes.Add(race.Classes.Find(x => x.Id.Equals(data.GetString("teamClassCode").Substring(0, 2) + "BED")));
p.Classes.Add(race.Classes.Find(x => x.Id.Equals("BED")));
}
// Add medlemmer
while (moreData && data.GetInt32("startNumber").Equals(p.Startnumber))
{
p.TeamMembers.Add(data.GetString("firstName") + " " + data.GetString("surname"));
if (!String.IsNullOrEmpty(data.GetString("phoneNumber")))
p.Telephone.Add(data.GetString("phoneNumber").Replace(" ", ""));
moreData = data.Read();
}
p.Telephone = p.Telephone.Distinct().ToList<String>();
race.AddParticipant(p);
} while (moreData);
data.Close();
conn.Close();
foreach (Participant p in race.Participants)
race.AddPass(new EmitData()
{
BoxId = 1,
Id = p.EmitID,
Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 14, 0)
});
}
示例2: BuildRace
//.........这里部分代码省略.........
p.Classes.Add(race.Classes.Find(x => x.Id.Equals(data.GetString("personClassCode").Substring(0, 2) + "BED")));
p.Classes.Add(race.Classes.Find(x => x.Id.Equals("BED")));
}
if (!data.IsDBNull(data.GetOrdinal("companyName")) && !String.IsNullOrWhiteSpace(data.GetString("companyName")))
{
var cn = data.GetString("companyName");
if (cn.StartsWith("SVV"))
cn = "SVV";
if (!race.Classes.Exists(x => x.Id.Equals(cn)))
race.Classes.Add(new ParticipantClass() { Id = cn, Official = false, Name = cn, Sequence = race.Classes.Count + 1 });
p.Classes.Add(race.Classes.Find(x => x.Id.Equals(cn)));
}
race.AddParticipant(p);
}
data.Close();
// Adding teams
cmd = new MySqlCommand(@"SELECT t.startNumber, t.chipNumber, t.name, t.teamClassCode, t.companyClass, p.firstname, p.surname, p.phoneNumber, p.sprintNumber FROM kop_team t inner join kop_person p on t.id = p.teamid where t.deleted = 0 and t.startNumber is not null and t.chipNumber is not null order by t.startNumber, p.sprintNumber", conn);
data = cmd.ExecuteReader();
data.Read();
bool moreData = true;
do
{
var p = new Participant()
{
Startnumber = data.GetInt32("startNumber"),
EmitID = int.Parse(data.GetString("chipNumber")),
Name = data.GetString("name"),
Telephone = new List<String>() { data.GetString("phoneNumber").Replace(" ", "") },
Classes = new List<ParticipantClass> { race.Classes.Find(x => x.Id.Equals(data.GetString("teamClassCode"))) },
IsTeam = true,
IsSuper = false,
IsCompany = data.GetInt32("companyClass").Equals(1)
};
if (p.IsCompany)
{
p.Classes.Add(race.Classes.Find(x => x.Id.Equals(data.GetString("teamClassCode").Substring(0, 2) + "BED")));
p.Classes.Add(race.Classes.Find(x => x.Id.Equals("BED")));
}
if (p.Name.StartsWith("SVV"))
{
String cn = "SVV";
if (!race.Classes.Exists(x => x.Id.Equals(cn)))
race.Classes.Add(new ParticipantClass() { Id = cn, Official = false, Name = cn, Sequence = race.Classes.Count + 1 });
p.Classes.Add(race.Classes.Find(x => x.Id.Equals(cn)));
}
// Add medlemmer
while (moreData && data.GetInt32("startNumber").Equals(p.Startnumber))
{
p.TeamMembers.Add(data.GetString("firstName") + " " + data.GetString("surname"));
if (!String.IsNullOrEmpty(data.GetString("phoneNumber")))
p.Telephone.Add(data.GetString("phoneNumber").Replace(" ", ""));
moreData = data.Read();
}
p.Telephone = p.Telephone.Distinct().ToList<String>();
race.AddParticipant(p);
} while (moreData);
data.Close();
conn.Close();
// Add testers
foreach (int testId in Testers)
{
var parTest = new Participant()
{
Startnumber = testId,
EmitID = testId,
Name = "Test " + testId.ToString(),
Telephone = new List<String>() { "95116354", "95246298", "", "41530965", "48021455" },
Classes = new List<ParticipantClass>() { race.Classes.Find(x => x.Id.Equals("TEST")) },
IsTeam = true,
TeamMembers = new List<String>() {"Rune Kjørlaug", "Petter Stenstavold", "Erlend Klakegg Bergheim", "Even Østvold"},
IsSuper = false,
IsCompany = false
};
race.AddParticipant(parTest);
}
race.Testers = Testers;
foreach (Participant p in race.Participants)
race.AddPass(new EmitData()
{
BoxId = 1,
Id = p.EmitID,
Time = new DateTime(2016, 4, 16, 13, 14, 0)
});
}
示例3: BuildRace
//.........这里部分代码省略.........
race.TimeStations.Add(new TimeStation()
{
Id = data.GetInt32(data.GetOrdinal("id")),
Name = data.GetString(data.GetOrdinal("name")),
Official = data.GetInt32(data.GetOrdinal("official")).Equals(1),
Sequence = data.GetInt32(data.GetOrdinal("sequence"))
});
}
data.Close();
// Read klasser
cmd = new SqlCommand(@"SELECT code, name FROM kop_personClass union SELECT code, name FROM kop_teamClass", conn);
data = cmd.ExecuteReader();
while (data.Read())
{
race.Classes.Add(new ParticipantClass() {
Id = data.GetString(data.GetOrdinal("code")),
Name = data.GetString(data.GetOrdinal("name")),
Sequence = 1
});
}
data.Close();
// Add static classes
var companyClass = new ParticipantClass { Id = "BED", Name = "Bedriftsklasse", Sequence = 100 };
var testClass = new ParticipantClass { Id = "TEST", Name = "Testklasse", Sequence = 101 };
race.Classes.Add(companyClass);
race.Classes.Add(testClass);
// Adding supers
cmd = new SqlCommand(@"select startNumber, chipNumber, firstname, surname, personClassCode, phoneNumber from kop_person where superwife = 1 and deleted = 0 and startnumber is not null and chipnumber is not null", conn);
data = cmd.ExecuteReader();
while (data.Read())
{
race.AddParticipant(new Participant()
{
Startnumber = data.GetInt32(data.GetOrdinal("startNumber")),
EmitID = int.Parse(data.GetString(data.GetOrdinal("chipNumber"))),
Name = data.GetString(data.GetOrdinal("firstname")) + " " + data.GetString(data.GetOrdinal("surname")),
Telephone = new List<String>() {data.GetString(data.GetOrdinal("phoneNumber"))},
Classes = new List<ParticipantClass>() {race.Classes.Find(x => x.Id.Equals(data.GetString(data.GetOrdinal("personClassCode"))))},
IsTeam = false,
IsSuper = true,
IsCompany = false
});
}
data.Close();
cmd = new SqlCommand(@"SELECT t.startNumber, t.chipNumber, t.name, t.teamClassCode, t.companyClass, p.firstname, p.surname, p.phoneNumber, p.sprintNumber FROM kop_team t inner join kop_person p on t.id = p.teamid where t.deleted = 0 and t.startNumber is not null and t.chipNumber is not null order by t.startNumber, p.sprintNumber", conn);
data = cmd.ExecuteReader();
data.Read();
bool moreData = true;
do
{
var p = new Participant()
{
Startnumber = data.GetInt32(data.GetOrdinal("startNumber")),
EmitID = int.Parse(data.GetString(data.GetOrdinal("chipNumber"))),
Name = data.GetString(data.GetOrdinal("name")),
Telephone = new List<String>() {data.GetString(data.GetOrdinal("phoneNumber"))},
Classes = new List<ParticipantClass> {race.Classes.Find(x => x.Id.Equals(data.GetString(data.GetOrdinal("teamClassCode"))))},
IsTeam = true,
IsSuper = false,
IsCompany = data.GetInt32(data.GetOrdinal("companyClass")).Equals(1)
};
if (p.IsCompany)
p.Classes.Add(companyClass);
// Add medlemmer
while (moreData && data.GetInt32(data.GetOrdinal("startNumber")).Equals(p.Startnumber))
{
p.TeamMembers.Add(data.GetString(data.GetOrdinal("firstName")) + " " + data.GetString(data.GetOrdinal("surname")));
if (!String.IsNullOrEmpty(data.GetString(data.GetOrdinal("phoneNumber"))))
p.Telephone.Add(data.GetString(data.GetOrdinal("phoneNumber")));
moreData = data.Read();
}
race.AddParticipant(p);
} while (moreData);
data.Close();
conn.Close();
foreach (Participant p in race.Participants)
race.AddPass(new EmitData()
{
BoxId = -1,
Id = p.EmitID,
Time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 13, 14, 0)
});
}