本文整理汇总了C#中DataAccess.SaveTeamTournamentAssignment方法的典型用法代码示例。如果您正苦于以下问题:C# DataAccess.SaveTeamTournamentAssignment方法的具体用法?C# DataAccess.SaveTeamTournamentAssignment怎么用?C# DataAccess.SaveTeamTournamentAssignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataAccess
的用法示例。
在下文中一共展示了DataAccess.SaveTeamTournamentAssignment方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TeamSubmit_SelectAddSelectDeleteSelect_OK
public void TeamSubmit_SelectAddSelectDeleteSelect_OK()
{
using (System.Transactions.TransactionScope updateTransaction =
new System.Transactions.TransactionScope())
{
string connectionString = GetConnectionstring();
DataAccess d2 = new DataAccess(connectionString);
Team team = new Team();
team.ID = -1;
team.TeamName = "blabla";
team.TeamMembers = "asdf";
team.Password = "xxx";
team.IsAdmin = false;
d2.SaveTeam(team);
Tournament t = new Tournament();
t.Id = -1;
t.Name = "TESTING";
d2.SaveTournament(t);
Assignment a = new Assignment();
a.AssignmentId = -1;
a.AssignmentName = "ASSIGNMENT";
d2.SaveAssignment(a);
TournamentAssignment ta = new TournamentAssignment();
ta.TournamentAssignmentId = -1;
ta.TournamentId = t.Id;
ta.AssignmentId = a.AssignmentId;
ta.AssignmentOrder = 1;
ta.Points1 = 100;
ta.Points2 = 50;
ta.Points3 = 25;
ta.Active = false;
d2.SaveTournamentAssignment(ta);
TeamTournamentAssignment tta = new TeamTournamentAssignment();
tta.TeamTournamentAssignmentId = -1;
tta.TeamId = team.ID;
tta.TournamentAssignmentId = ta.TournamentAssignmentId;
d2.SaveTeamTournamentAssignment(tta);
Submit submit = new Submit();
submit.ID = -1;
submit.TeamTournamentAssignmentId = (int)tta.TeamTournamentAssignmentId;
submit.TeamId = team.ID;
byte[] uploadstream = new byte[2] {1,2};
submit.UploadStream = uploadstream;
submit.FileName = "somename.cs";
d2.InsertTeamSubmit(submit);
Assert.AreNotEqual(submit.ID, -1);
List<Submit> submits = d2.GetTeamSubmitsForAssignment(submit.TeamTournamentAssignmentId);
Assert.AreEqual(submits.Count, 1);
//getbyid
Submit byId = d2.GetTeamSubmitById(submit.ID);
Assert.AreEqual(byId.ID,submit.ID);
d2.DeleteTeamSubmit(submit.ID);
List<Submit> submitsAfterDelete = d2.GetTeamSubmitsForAssignment(submit.TeamTournamentAssignmentId);
Assert.AreEqual(0, submitsAfterDelete.Count);
}
}
示例2: TeamTournamentAssignment_SelectAddSelectDeleteSelect_OK
public void TeamTournamentAssignment_SelectAddSelectDeleteSelect_OK()
{
using (System.Transactions.TransactionScope updateTransaction =
new System.Transactions.TransactionScope())
{
string connectionString = GetConnectionstring();
DataAccess d2 = new DataAccess(connectionString);
Team team = new Team();
team.ID = -1;
team.TeamName = "blabla";
team.TeamMembers = "asdf";
team.Password = "xxx";
team.IsAdmin=false;
d2.SaveTeam(team);
Tournament t = new Tournament();
t.Id = -1;
t.Name = "TESTING";
d2.SaveTournament(t);
Assignment a = new Assignment();
a.AssignmentId = -1;
a.AssignmentName = "ASSIGNMENT";
d2.SaveAssignment(a);
TournamentAssignment ta = new TournamentAssignment();
ta.TournamentAssignmentId = -1;
ta.TournamentId = t.Id;
ta.AssignmentId = a.AssignmentId;
ta.AssignmentOrder = 1;
ta.Points1 = 100;
ta.Points2 = 50;
ta.Points3 = 25;
ta.Active = false;
d2.SaveTournamentAssignment(ta);
List<TeamTournamentAssignment> ttaBefore = d2.GetTeamTournamentAssignmentsForTeam(ta.TournamentId, team.ID);
Assert.AreNotEqual(ttaBefore.Count, 0);
TeamTournamentAssignment tta = new TeamTournamentAssignment();
tta.TeamTournamentAssignmentId = -1;
tta.TeamId = team.ID;
tta.TournamentAssignmentId = ta.TournamentAssignmentId;
d2.SaveTeamTournamentAssignment(tta);
//id should be set
Assert.AreNotEqual(tta.TeamTournamentAssignmentId, -1);
List<TeamTournamentAssignment> ttaAfterSave = d2.GetTeamTournamentAssignmentsForTeam(ta.TournamentId, team.ID);
Assert.AreEqual(ttaAfterSave.Count, 1);
TeamTournamentAssignment ttaById = d2.GetTeamTournamentAssignmentById((int)tta.TeamTournamentAssignmentId);
Assert.AreEqual(tta.TeamId, ttaById.TeamId);
d2.DeleteTeamTournamentAssignment((int)tta.TeamTournamentAssignmentId);
List<TeamTournamentAssignment> ttaAfterDelete = d2.GetTeamTournamentAssignmentsForTeam(ta.TournamentId, team.ID);
// Assert.AreEqual(ttaAfterDelete.Count, 0);
}
}