/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the TeamService. TeamService teamService = (TeamService) user.GetService(DfpService.v201508.TeamService); // Create a statement to order teams by name. StatementBuilder statementBuilder = new StatementBuilder() .OrderBy("name ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Set default for page. TeamPage page = new TeamPage(); try { do { // Get teams by statement. page = teamService.getTeamsByStatement(statementBuilder.ToStatement()); // Display results. if (page.results != null) { int i = page.startIndex; foreach (Team team in page.results) { Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.", i, team.id, team.name); i++; } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while(statementBuilder.GetOffset() < page.totalResultSetSize); Console.WriteLine("Number of results found: " + page.totalResultSetSize); } catch (Exception e) { Console.WriteLine("Failed to get teams by statement. Exception says \"{0}\"", e.Message); } }
public void InsertTeamPage(TeamPage teamPage) { _teamPageRepository.Insert(teamPage); }
/// <summary> /// Run the code example. /// </summary> public void Run(AdManagerUser user) { using (TeamService teamService = user.GetService <TeamService>()) { // Create a statement to select teams. int pageSize = StatementBuilder.SUGGESTED_PAGE_LIMIT; StatementBuilder statementBuilder = new StatementBuilder().OrderBy("id ASC").Limit(pageSize); // Retrieve a small amount of teams at a time, paging through until all // teams have been retrieved. int totalResultSetSize = 0; do { TeamPage page = teamService.getTeamsByStatement(statementBuilder.ToStatement()); // Print out some information for each team. if (page.results != null) { totalResultSetSize = page.totalResultSetSize; int i = page.startIndex; foreach (Team team in page.results) { Console.WriteLine("{0}) Team with ID {1} and name \"{2}\" was found.", i++, team.id, team.name); } } statementBuilder.IncreaseOffsetBy(pageSize); } while (statementBuilder.GetOffset() < totalResultSetSize); Console.WriteLine("Number of results found: {0}", totalResultSetSize); } }
public void Manager_Can_Rate_TeamMembers_Goal_Below() { HomePage homePage = new HomePage(browser); GoalsPage goalsPage = new GoalsPage(browser); GoalDetailsPage goalDetailsPage = new GoalDetailsPage(browser); TeamPage teamPage = new TeamPage(browser); ActivityFeedPage activityFeedPage = new ActivityFeedPage(browser); homePage.GoTo(); var teamsRatedGoalsBefore = homePage.GetRatedTeamsGoalsCount(); teamPage.GoTo(); teamPage.SelectTeamMember(); goalsPage.SelectUnratedGoal(); goalsPage.Rate(Rating.Below, "Manager's rating below expectation"); activityFeedPage.ExpandActivityFeed(); activityFeedPage.CheckNewUpdates(); Assert.AreEqual("You rated their goal", activityFeedPage.GetFirstCardAction()); Assert.AreEqual(goalDetailsPage.Title, activityFeedPage.GetFirstCardTitle()); homePage.GoTo(); var teamsRatedGoalsAfter = homePage.GetRatedTeamsGoalsCount(); Assert.AreEqual(teamsRatedGoalsBefore + 1, teamsRatedGoalsAfter); activityFeedPage.CloseActivityFeed(); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the TeamService. TeamService teamService = (TeamService)user.GetService(DfpService.v201311.TeamService); // Create a statement to order teams by name. Statement filterStatement = new StatementBuilder("ORDER BY name LIMIT 500").ToStatement(); try { // Get teams by statement. TeamPage page = teamService.getTeamsByStatement(filterStatement); // Display results. if (page.results != null) { int i = page.startIndex; foreach (Team team in page.results) { Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.", i, team.id, team.name); i++; } } Console.WriteLine("Number of results found: " + page.totalResultSetSize); } catch (Exception ex) { Console.WriteLine("Failed to get teams by statement. Exception says \"{0}\"", ex.Message); } }
public IHttpActionResult Post(TeamPageModel model) { if (!ModelState.IsValid || model == null) { return(Response(new { Success = false, Message = "Invalid data" })); } var teamPage = new TeamPage { Description = model.Description, Name = model.Name, TeamPictureId = model.TeamPictureId, CreatedBy = ApplicationContext.Current.CurrentUser.Id, CreatedOn = DateTime.UtcNow, UpdatedOn = DateTime.UtcNow }; //save to db now _teamPageService.Insert(teamPage); return(RespondSuccess(new { TeamPage = teamPage.ToModel(_mediaService) })); }
private void CreateSampleData() { var teamPage = new TeamPage() { CreatedBy = 1, CreatedOn = DateTime.Now, UpdatedBy = 1, UpdatedOn = DateTime.Now, Name = "SkateMob", Description = "SkateMob members are the #1 skaters in the world!", TeamPictureId = 0 }; _socialNetworkService.InsertTeamPage(teamPage); var groupPage = new GroupPage() { Name = "Soldiers", Description = "New and upcoming skaters", PayPalDonateUrl = "" }; _socialNetworkService.InsertGroupPage(groupPage); }
static void AddTeamPage(string username, string teamName) { using (SportsDbContext db = new SportsDbContext()) { int authorId = ( from au in db.Author where au.Username == username select au.AuthorId ) .Single(); TeamPage newTeamPage = new TeamPage { AuthorId = authorId, TeamName = teamName }; db.TeamPage.Add(newTeamPage); db.SaveChanges(); } Console.WriteLine($"Added Team: '{teamName}' which will feature articles from: '{username}'"); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the TeamService. TeamService teamService = (TeamService)user.GetService(DfpService.v201311.TeamService); // Set the ID of the ad unit to add to the teams. String adUnitId = _T("INSERT_AD_UNIT_ID_HERE"); // Create a statement to select first 5 teams that aren't built-in. Statement filterStatement = new StatementBuilder("WHERE id > 0 LIMIT 5").ToStatement(); try { // Get the teams by statement. TeamPage page = teamService.getTeamsByStatement(filterStatement); if (page.results != null) { Team[] teams = page.results; // Update each local team object by adding the ad unit to it. foreach (Team team in teams) { // Don't add ad unit if the team has all inventory already. if (!team.hasAllInventory) { List <String> adUnitIds = new List <String>(); if (team.adUnitIds != null) { adUnitIds.AddRange(team.adUnitIds); } adUnitIds.Add(adUnitId); team.adUnitIds = adUnitIds.ToArray(); } } // Update the teams on the server. teams = teamService.updateTeams(teams); if (teams != null) { foreach (Team team in teams) { Console.WriteLine("A team with ID \"{0}\" and name \"{1}\" was updated.", team.id, team.name); } } else { Console.WriteLine("No teams updated."); } } else { Console.WriteLine("No teams found to update."); } } catch (Exception ex) { Console.WriteLine("Failed to update teams. Exception says \"{0}\"", ex.Message); } }
public void LoadTeamPage() { Frame teamContentFrame = new Frame(); TeamPage teamContent = new TeamPage(); teamContentFrame.Content = teamContent; TeamTab.Content = teamContentFrame; }
public void Manager_Can_Request_Internal_360Feedback() { TeamPage teamPage = new TeamPage(browser); teamPage.GoTo(); teamPage.SelectTeamMember(); teamPage.GoTo360FeedbackSection(); //teamPage.SendInternal360FeedbackRequest(); }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the TeamService. TeamService teamService = (TeamService)user.GetService(DfpService.v201605.TeamService); // Set the ID of the team to update. long teamId = long.Parse(_T("INSERT_TEAM_ID_HERE")); // Set the ID of the ad unit to add to the team. String adUnitId = _T("INSERT_AD_UNIT_ID_HERE"); // Create a statement to select the team. StatementBuilder statementBuilder = new StatementBuilder() .Where("id = :id") .OrderBy("id ASC") .Limit(1) .AddValue("id", teamId); try { // Get the teams by statement. TeamPage page = teamService.getTeamsByStatement(statementBuilder.ToStatement()); Team team = page.results[0]; // Don't add ad unit if the team has all inventory already. if (!team.hasAllInventory) { List <String> adUnitIds = new List <String>(); if (team.adUnitIds != null) { adUnitIds.AddRange(team.adUnitIds); } adUnitIds.Add(adUnitId); team.adUnitIds = adUnitIds.ToArray(); } // Update the teams on the server. Team[] teams = teamService.updateTeams(new Team[] { team }); if (teams != null) { foreach (Team updatedTeam in teams) { Console.WriteLine("A team with ID \"{0}\" and name \"{1}\" was updated.", updatedTeam.id, updatedTeam.name); } } else { Console.WriteLine("No teams updated."); } } catch (Exception e) { Console.WriteLine("Failed to update teams. Exception says \"{0}\"", e.Message); } }
/// <summary> /// Run the code example. /// </summary> public void Run(DfpUser user) { using (TeamService teamService = (TeamService)user.GetService(DfpService.v201805.TeamService)) { // Set the ID of the team to update. long teamId = long.Parse(_T("INSERT_TEAM_ID_HERE")); // Set the ID of the ad unit to add to the team. String adUnitId = _T("INSERT_AD_UNIT_ID_HERE"); // Create a statement to select the team. StatementBuilder statementBuilder = new StatementBuilder() .Where("id = :id") .OrderBy("id ASC") .Limit(1) .AddValue("id", teamId); try { // Get the teams by statement. TeamPage page = teamService.getTeamsByStatement(statementBuilder.ToStatement()); Team team = page.results[0]; team.description = team.description + " - UPDATED"; // Update the teams on the server. Team[] teams = teamService.updateTeams(new Team[] { team }); if (teams != null) { foreach (Team updatedTeam in teams) { Console.WriteLine( "A team with ID \"{0}\" and name \"{1}\" was updated.", updatedTeam.id, updatedTeam.name); } } else { Console.WriteLine("No teams updated."); } } catch (Exception e) { Console.WriteLine("Failed to update teams. Exception says \"{0}\"", e.Message); } } }
public static TeamPagePublicModel ToModel(this TeamPage teamPage, IMediaService mediaService) { var model = new TeamPagePublicModel() { Name = teamPage.Name, Description = teamPage.Description, CreatedOn = teamPage.CreatedOn, UpdatedOn = teamPage.UpdatedOn, TeamPictureUrl = mediaService.GetPictureUrl(teamPage.TeamPictureId), Id = teamPage.Id }; return(model); }
public static TeamPageModel ToEntityModel(this TeamPage teamPage, IMediaService mediaService) { var model = new TeamPageModel() { Id = teamPage.Id, TeamPictureUrl = mediaService.GetPictureUrl(teamPage.TeamPictureId), Name = teamPage.Name, Description = teamPage.Description, CreatedBy = teamPage.CreatedBy, CreatedOn = teamPage.CreatedOn, UpdatedBy = teamPage.UpdatedBy, UpdatedOn = teamPage.UpdatedOn }; return(model); }
public void tc_59940_As_a_Supervisor_User_Manager_I_want_to_see_my_direct_reports_in_Team() { CommonSection.Logout(); _test.Log(Status.Info, "Logout from current account"); LoginPage.LoginAs("ak_learner").WithPassword("").Login(); _test.Log(Status.Info, "login as User Manager"); CommonSection.Manage.Teams(); _test.Log(Status.Info, "Click on Teams from manage"); Assert.IsTrue(TeamPage.IsPeopleCountDisplayed()); _test.Log(Status.Pass, "Verify Employee count is displayed"); Assert.IsTrue(TeamPage.VerifyAvatarIsDisplayed()); _test.Log(Status.Pass, "Verify Employee count is displayed"); Assert.IsTrue(TeamPage.VerifyEmployeeInitialsAreDisplayed()); _test.Log(Status.Pass, "Verify Employee count is displayed"); Assert.IsTrue(TeamPage.VerifyEmployeeNamesAreDisplayed()); _test.Log(Status.Pass, "Verify Employee count is displayed"); }
/// <summary> /// Run the code example. /// </summary> public void Run(DfpUser user) { TeamService teamService = (TeamService)user.GetService(DfpService.v201605.TeamService); // Create a statement to select teams. StatementBuilder statementBuilder = new StatementBuilder() .OrderBy("id ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Retrieve a small amount of teams at a time, paging through // until all teams have been retrieved. TeamPage page = new TeamPage(); try { do { page = teamService.getTeamsByStatement(statementBuilder.ToStatement()); if (page.results != null) { // Print out some information for each team. int i = page.startIndex; foreach (Team team in page.results) { Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.", i++, team.id, team.name); } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.GetOffset() < page.totalResultSetSize); Console.WriteLine("Number of results found: {0}", page.totalResultSetSize); } catch (Exception e) { Console.WriteLine("Failed to get teams. Exception says \"{0}\"", e.Message); } }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the TeamService. TeamService teamService = (TeamService)user.GetService(DfpService.v201403.TeamService); // Set defaults for page and filterStatement. TeamPage page = new TeamPage(); Statement filterStatement = new Statement(); int offset = 0; try { do { // Create a statement to get all teams. filterStatement.query = "LIMIT 500 OFFSET " + offset; // Get teams by statement. page = teamService.getTeamsByStatement(filterStatement); if (page.results != null) { int i = page.startIndex; foreach (Team team in page.results) { Console.WriteLine("{0}) Team with ID \"{1}\", name \"{2}\" was found.", i, team.id, team.name); i++; } } offset += 500; } while (offset < page.totalResultSetSize); Console.WriteLine("Number of results found: " + page.totalResultSetSize); } catch (Exception ex) { Console.WriteLine("Failed to get all teams. Exception says \"{0}\"", ex.Message); } }
/// <summary> /// Run the code example. /// </summary> /// <param name="user">The DFP user object running the code example.</param> public override void Run(DfpUser user) { // Get the TeamService. TeamService teamService = (TeamService)user.GetService(DfpService.v201502.TeamService); // Create a statement to order teams by name. StatementBuilder statementBuilder = new StatementBuilder() .OrderBy("name ASC") .Limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Set default for page. TeamPage page = new TeamPage(); try { do { // Get teams by statement. page = teamService.getTeamsByStatement(statementBuilder.ToStatement()); // Display results. if (page.results != null) { int i = page.startIndex; foreach (Team team in page.results) { Console.WriteLine("{0}) Team with ID \"{1}\" and name \"{2}\" was found.", i, team.id, team.name); i++; } } statementBuilder.IncreaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while(statementBuilder.GetOffset() < page.totalResultSetSize); Console.WriteLine("Number of results found: " + page.totalResultSetSize); } catch (Exception e) { Console.WriteLine("Failed to get teams by statement. Exception says \"{0}\"", e.Message); } }
private void CreateSampleData() { var teamPage = new TeamPage() { CreatedBy = 1, CreatedOn = DateTime.Now, UpdatedBy = 1, UpdatedOn = DateTime.Now, Name = "SkateMob", Description = "SkateMob members are the #1 skaters in the world!", TeamPictureUrl = "" }; _socialNetworkService.InsertTeamPage(teamPage); var groupPage = new GroupPage() { Name = "Soldiers", Description = "New and upcoming skaters", PayPalDonateUrl = "" }; _socialNetworkService.InsertGroupPage(groupPage); }