private async void JoinButton_Clicked(object sender, EventArgs e) { // handles button clicked in login page joinButton.IsEnabled = false; // disable the button to avoid multiple clicks. // checks the input entry is not empty bool isTeamEmpty = string.IsNullOrEmpty(teamEntry.Text); if (isTeamEmpty) { await DisplayAlert("Failure", "Invalid student ID", "Ok"); } else { // sends http request via TeamLogic class for team authentication App.myTeam = await TeamLogic.GetTeam(teamEntry.Text); if (App.myTeam.name != null) //student id query returned a team { Application.Current.Properties["teamID"] = "" + App.myTeam.teamID; await Navigation.PopModalAsync(); } else { await DisplayAlert("Failure", "Student ID not in any teams", "Ok"); } } joinButton.IsEnabled = true; // enable the button. }
public HomeController(PlayerLogic playerlogic, LeagueLogic leaguelogic, TeamLogic teamlogic, StatLogic statLogic) { this.playerlogic = playerlogic; this.leaguelogic = leaguelogic; this.teamlogic = teamlogic; this.statLogic = statLogic; }
private void btnAddTeam_Click(object sender, EventArgs e) { IPlayerManipulations playerLogic = new PlayerLogic(); ITeamManipulations teamLogic = new TeamLogic(); List <PlayerType> players = new List <PlayerType>(); if (tbTeamName.Text != "") { try { for (int i = 0; i < clbPlayers.CheckedItems.Count; i++) { players.Add(playerLogic.GetPlayers()[clbPlayers.Items.IndexOf(clbPlayers.CheckedItems[i])]); } if (players.Count > 0) { teamLogic.AddOrUpdateTeam(new TeamType(tbTeamName.Text, players)); tbTeamName.Text = ""; UpdateTeamList(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: Add Team", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Team needs a name.", "Error: Add Team", MessageBoxButtons.OK, MessageBoxIcon.Error); } UpdateTree(); }
public ActionResult Create() { var _teamLogic = new TeamLogic(); ViewBag.Teams = _teamLogic.GetAll(new BL.Models.Core.Filter()).Output; return(View()); }
private void btnAdd_Click(object sender, EventArgs e) { int teamType = (radFunctionalTeam.Checked == true) ? 1 : 0; TeamLogic tl = new TeamLogic(); Team newTeam = new Team(); newTeam.Name = txtName.Text; newTeam.Description = txtDescription.Text; newTeam.Start = dtpStart.Value; newTeam.End = dtpEnd.Value; newTeam.Type = teamType; if (teamType == 0) { newTeam.TeamsProjects.Add(new TeamProject() { TeamId = newTeam.Id, ProjectId = int.Parse(cbxProjects.SelectedValue.ToString()) }); } if (_teamToUpdate == null) { tl.Add(newTeam, _teamMembers); } else { tl.Update(_teamToUpdate, newTeam, _teamMembers); } Close(); }
public LicenseBO() { userLicenseRequestLogic = new UserLicenseRequestLogic(); licLogic = new UserLicenseLogic(); userLogic = new UserLogic(); _teamLogic = new TeamLogic(); }
private void LoadTeams() { _teams = TeamLogic.Get(); cboTeam.DataSource = _teams; cboTeam.DisplayMember = "Name"; cboTeam.ValueMember = "Id"; }
public ActionResult AddTeamMembers(int?id) { Team team = _db.Teams.Find(id); TeamLogic addMembers = new TeamLogic(); //Return a list of players from TeamMembers call return(null); }
public HttpResponseMessage GetTeambyID([FromBody] TeamParameterModel team) { TeamLogic teamLogic = new TeamLogic(); jsonResult = teamLogic.GetTeambyID(team); returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json"); return(returnResult); }
public HttpResponseMessage MyAllTeam([FromBody] SimpleTeamModel team) { TeamLogic teamLogic = new TeamLogic(); jsonResult = teamLogic.MyAllTeam(team); returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json"); return(returnResult); }
public HttpResponseMessage RemoveUser([FromBody] ApplyTeamParameter2Model para) { TeamLogic teamLogic = new TeamLogic(); jsonResult = teamLogic.RemoveUser(para); returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json"); return(returnResult); }
public HttpResponseMessage SendRecruit([FromBody] RecruitParameterModel para) { TeamLogic teamLogic = new TeamLogic(); jsonResult = teamLogic.SendRecruit(para); returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json"); return(returnResult); }
public HttpResponseMessage Update([FromBody] SimpleTeam2Model para) { TeamLogic teamLogic = new TeamLogic(); jsonResult = teamLogic.Update(para); returnResult.Content = new StringContent(jsonResult, Encoding.UTF8, "application/json"); return(returnResult); }
public void TestOldTeamDrivers() { DriverLogic dl = new DriverLogic(this.driverRepo.Object); TeamLogic tl = new TeamLogic(this.teamRepo.Object); StatLogic s = new StatLogic(tl, dl); List <Team> teams = new List <Team>() { new Team { TID = Guid.NewGuid().ToString(), TName = "Mercedes-AMG Petronas F1 Team", Created = 2010, Country = "Germany", Engine = ESuppliers.Mercedes }, new Team { TID = Guid.NewGuid().ToString(), TName = "Aston Martin Red Bull Racing", Created = 2005, Country = "Austria", Engine = ESuppliers.Honda }, new Team { TID = Guid.NewGuid().ToString(), TName = "Renault DP World F1 Team", Created = 1977, Country = "France", Engine = ESuppliers.Renault }, new Team { TID = Guid.NewGuid().ToString(), TName = "Zengő Motorsport Services KFT", Created = 1996, Country = "Hungary", Engine = ESuppliers.Seat }, }; List <Driver> drivers = new List <Driver>() { new Driver { DID = Guid.NewGuid().ToString(), DName = "Valtteri Bottas", BornYear = 1989, CountryB = "Finland", RaceNumber = 77, TID = teams.ElementAt(0).TID }, new Driver { DID = Guid.NewGuid().ToString(), DName = "Daniel Ricciardo", BornYear = 1989, CountryB = "Australia", RaceNumber = 3, TID = teams.ElementAt(2).TID }, new Driver { DID = Guid.NewGuid().ToString(), DName = "Max Verstappen", BornYear = 1997, CountryB = "Belgium", RaceNumber = 33, TID = teams.ElementAt(1).TID }, new Driver { DID = Guid.NewGuid().ToString(), DName = "Boldizs Bence", BornYear = 1997, CountryB = "Hungary", RaceNumber = 55, TID = teams.ElementAt(3).TID }, new Driver { DID = Guid.NewGuid().ToString(), DName = "Teszt Elek", BornYear = 1990, CountryB = "Test2", RaceNumber = 4, TID = teams.ElementAt(2).TID } }; List <Driver> expected = new List <Driver>(); /*{ * new Driver { DID = drivers[1].DID, DName = "Daniel Ricciardo", BornYear = 1989, CountryB = "Australia", RaceNumber = 3, TID = teams.ElementAt(2).TID }, * new Driver { DID = drivers[4].DID, DName = "Teszt Elek", BornYear = 1990, CountryB = "Test2", RaceNumber = 4, TID = teams.ElementAt(2).TID } * };*/ expected.Add(drivers[1]); expected.Add(drivers[4]); teamRepo.Setup(x => x.Search()).Returns(teams.AsQueryable); driverRepo.Setup(x => x.Search()).Returns(drivers.AsQueryable); var result = s.OldestTeamDrivers(); Assert.That(result, Is.EqualTo(expected)); }
public TeamBO() { userLogic = new UserLogic(); logic = new TeamMemberLogic(); teamLogic = new TeamLogic(); teamLicenseLogic = new TeamLicenseLogic(); userLicLogic = new UserLicenseLogic(); licLogic = new LicenseLogic(); }
private void btnDeleteTeam_Click(object sender, EventArgs e) { if (MessageBox.Show("Jeste li sigurni?", "Upozorenje!", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { TeamLogic tl = new TeamLogic(); tl.Delete(_teamToUpdate); Close(); } }
private void dgvTeams_SelectionChanged(object sender, EventArgs e) { userBindingSource.DataSource = null; if (dgvTeams.CurrentRow != null) { Team t = dgvTeams.CurrentRow.DataBoundItem as Team; TeamLogic tl = new TeamLogic(); userBindingSource.DataSource = tl.GetTeamMembers(t); } }
private void UpdateTeamList() { ITeamManipulations teamLogic = new TeamLogic(); clTeamTeams.Items.Clear(); foreach (TeamType t in teamLogic.GetTeams()) { clTeamTeams.Items.Add($"Name: {t.Name} - Members: {t.Members.Count}"); } }
public IActionResult Edit(int id) { var teamLogic = new TeamLogic(); Team geselecteerdTeam = teamLogic.TeamOphalenMetID(id); if (geselecteerdTeam == null) { return(NotFound()); } return(View(geselecteerdTeam)); }
public void TeamInitialize() { testTeam = new TeamLogic(); var user = new UserLogic(); var user2 = new UserLogic(); users.Add(user); users.Add(user2); testTeam.Id = 1; testTeam.Name = "testName"; testTeam.Metadata = "testData"; testTeam.Users = users; }
public ActionResult Create(GameCreateModel parameters) { var _teamLogic = new TeamLogic(); ViewBag.Teams = _teamLogic.GetAll(new BL.Models.Core.Filter()).Output; var opResult = _gameLogic.Add(parameters); if (opResult.IsSuccess) { return(RedirectToAction("index")); } return(View(parameters)); }
// GET: Teams/Details/5 public ActionResult Details(int?id) { TeamLogic t = new TeamLogic(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Team team = _db.Teams.Find(id); if (team == null) { return(HttpNotFound()); } return(View(team)); }
public void TestTeamOfBestLeague() { LeagueLogic ll = new LeagueLogic(this.leagueRepo.Object); TeamLogic tl = new TeamLogic(this.teamRepo.Object); StatLogic s = new StatLogic(tl, ll); List <League> leagues = new List <League>() { new League() { LID = Guid.NewGuid().ToString(), Name = "Formula 1 (F1)", Rating = 8, Homology = true, RaceTypes = RaceType.circuit }, new League() { LID = Guid.NewGuid().ToString(), Name = "World Touring Car Championship (WTCC)", Rating = 7, Homology = false, RaceTypes = RaceType.circuit }, }; List <Team> teams = new List <Team>() { new Team { TID = Guid.NewGuid().ToString(), TName = "Mercedes-AMG Petronas F1 Team", Created = 2010, Country = "Germany", Engine = ESuppliers.Mercedes, LID = leagues.ElementAt(0).LID }, new Team { TID = Guid.NewGuid().ToString(), TName = "Aston Martin Red Bull Racing", Created = 2005, Country = "Austria", Engine = ESuppliers.Honda, LID = leagues.ElementAt(0).LID }, new Team { TID = Guid.NewGuid().ToString(), TName = "Renault DP World F1 Team", Created = 1977, Country = "France", Engine = ESuppliers.Renault, LID = leagues.ElementAt(0).LID }, new Team { TID = Guid.NewGuid().ToString(), TName = "Zengő Motorsport Services KFT", Created = 1996, Country = "Hungary", Engine = ESuppliers.Seat, LID = leagues.ElementAt(1).LID }, }; List <Team> expected = new List <Team>(); expected.Add(teams[1]); expected.Add(teams[0]); expected.Add(teams[2]); leagueRepo.Setup(x => x.Search()).Returns(leagues.AsQueryable); teamRepo.Setup(x => x.Search()).Returns(teams.AsQueryable); var result = s.TeamOfBestLeague(); Assert.That(result, Is.EqualTo(expected)); }
public void UpdateTeamTEST() { //ARRANGE Mock <IRepository <Team> > teamrepo = new Mock <IRepository <Team> >(); Team team = new Team { TeamID = "Juventus", City = "Torino" }; teamrepo.Setup(repo => repo.Update(It.IsAny <string>(), It.IsAny <Team>())); TeamLogic teamlogic = new TeamLogic(teamrepo.Object); //Act teamlogic.UpdateTeam(team.TeamID, team); teamrepo.Verify(repo => repo.Update(team.TeamID, team), Times.Once); }
public void TestUpdateTeam() { TeamLogic t = new TeamLogic(this.teamRepo.Object); Team newt = new Team() { TID = Guid.NewGuid().ToString(), TName = "TestTeam", Created = 1999, Country = "TestCountry", Engine = ESuppliers.Audi, LID = Guid.NewGuid().ToString() }; teamRepo.Setup(x => x.Update(newt.TID, It.IsAny <Team>())); t.UpdateTeam(newt.TID, newt); teamRepo.Verify(x => x.Update(newt.TID, It.IsAny <Team>()), Times.Once); }
public void TeamLogic() { Mock <IUnitOfWork> uow = new Mock <IUnitOfWork>(); Mock <ITeamRepository> repo = new Mock <ITeamRepository>(); TeamLogic logic = new TeamLogic(uow.Object, repo.Object); var team = new Team(); var sequence = new MockSequence(); repo.InSequence(sequence).Setup(r => r.Create(team)); repo.InSequence(sequence).Setup(r => r.Update(team)); repo.InSequence(sequence).Setup(r => r.Get(team.Id)); logic.Create(team); logic.Update(team); logic.Get(team.Id); }
public TeamDetails GetteamDetails(int id) { TeamLogic teamLogic = new TeamLogic(); TeamDetails dtls = new TeamDetails(); var team = teamLogic.GetTeamById(id); if (team != null) { dtls.Team = new Team(); dtls.Team.AdminId = team.AdminId; dtls.Team.AdminUser = team.AdminUser; dtls.Team.Id = team.Id; dtls.Team.Name = team.Name; if (team.TeamMembers.Count > 0) { dtls.PendinigUsers = team.TeamMembers.Where(s => s.InviteeStatus == InviteStatus.Pending.ToString()).ToList(); dtls.AcceptedUsers = team.TeamMembers.Where(s => s.InviteeStatus == InviteStatus.Accepted.ToString()).ToList(); dtls.AcceptedUsers.Add(new TeamMember() { InviteeEmail = team.AdminUser.Email, InviteeStatus = InviteStatus.Accepted.ToString(), InviteeUserId = team.AdminUser.UserId, InviteeUser = team.AdminUser, IsAdmin = true }); } else { dtls.AcceptedUsers.Add(new TeamMember() { InviteeEmail = team.AdminUser.Email, InviteeStatus = InviteStatus.Accepted.ToString(), InviteeUserId = team.AdminUser.UserId, InviteeUser = team.AdminUser, IsAdmin = true }); } } return(dtls); }
public IActionResult Details(int id) { var teamLogic = new TeamLogic(); Team geselecteerdTeam = teamLogic.TeamOphalenMetID(id); //.SingleOrDefault(o => o.Name == id); // there should be only one! /*if (geselecteerdTeam == null) * { * return NotFound(); * } * else * { * geselecteerdTeam.CurriculumEigenaarNaam = * teamLogic.CurriculumEigenaarNaamMetCurriculumEigenaarId(geselecteerdTeam.CurriculumEigenaarID); * geselecteerdTeam.TeamleiderNaam = teamLogic.TeamleiderNaamMetTeamleiderId(geselecteerdTeam.TeamleiderID); * }*/ return(View(geselecteerdTeam)); // Team selectedTeamteam = _teamLogic.TeamsOphalen() }
private void frmAddTeam_Load(object sender, EventArgs e) { List <User> _committeeMembersCopy = UserLogic.GetCommitteMembers(); ProjectLogic pl = new ProjectLogic(); cbxProjects.DataSource = pl.Get(); cbxProjects.DisplayMember = "Name"; cbxProjects.ValueMember = "Id"; if (_teamToUpdate != null) { TeamLogic tl = new TeamLogic(); _teamMembers = tl.GetTeamMembers(_teamToUpdate); _committeeMembers = _committeeMembersCopy.Except(_teamMembers, new UserListEqualityComparer()).ToList(); ShowTeamMembers(); txtName.Text = _teamToUpdate.Name; txtDescription.Text = _teamToUpdate.Description; dtpStart.Value = _teamToUpdate.Start; dtpEnd.Value = _teamToUpdate.End; if (_teamToUpdate.Type == 0) { radProjectTeam.Checked = true; cbxProjects.SelectedValue = (_teamToUpdate.TeamsProjects.First()).ProjectId; } else { radFunctionalTeam.Checked = true; } } else { _committeeMembers = _committeeMembersCopy; } ShowCommitteeMembers(); }
private void btnAddTeamMatch_Click(object sender, EventArgs e) { IMatchManipulations matchLogic = new MatchLogic(); ITeamManipulations teamLogic = new TeamLogic(); IGameManipulations gameLogic = new GameLogic(); try { List <TeamType> teams = new List <TeamType>(); MatchCategories cat = (MatchCategories)Enum.Parse(typeof(MatchCategories), downUpTeamCat.SelectedItem.ToString()); GameType game = gameLogic.GetGames()[downUpTeamGame.SelectedIndex]; List <int> scores = new List <int>(); string[] parts = tbTeamScores.Text.Split(','); foreach (string s in parts) { scores.Add(int.Parse(s)); } for (int i = 0; i < clTeamTeams.CheckedItems.Count; i++) { teams.Add(teamLogic.GetTeams()[clTeamTeams.Items.IndexOf(clTeamTeams.CheckedItems[i])]); } if ((teams.Count > 0) && (teams.Count == scores.Count)) { matchLogic.AddOrUpdateTeamMatch(new TeamMatch(cat, game, teams, scores)); tbTeamScores.Text = ""; } else { MessageBox.Show("Invalid scores.", "Error: Add Match", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error: Add Match", MessageBoxButtons.OK, MessageBoxIcon.Error); } UpdateTree(); }
public void TestListAllTeams() { TeamLogic t = new TeamLogic(this.teamRepo.Object); List <Team> newT = new List <Team>() { new Team { LID = Guid.NewGuid().ToString(), TID = Guid.NewGuid().ToString(), TName = "TestTeam", Created = 1995, Country = "TestC", Engine = ESuppliers.Audi }, new Team { LID = Guid.NewGuid().ToString(), TID = Guid.NewGuid().ToString(), TName = "TestTeam2", Created = 1995, Country = "TestC2", Engine = ESuppliers.Mercedes } }; List <Team> expectedoutput = new List <Team>() { newT[0], newT[1] }; teamRepo.Setup(x => x.Search()).Returns(newT.AsQueryable()); var output = t.GetAllTeam(); Assert.That(output, Is.EquivalentTo(expectedoutput)); Assert.That(output.Count, Is.EqualTo(expectedoutput.Count)); }