コード例 #1
0
    /// <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.v201308.TeamService);

      try {
        // Create an array to store local team objects.
        Team[] teams = new Team[5];

        for (int i = 0; i < 5; i++) {
          Team team = new Team();
          team.name = "Team #" + i;
          team.hasAllCompanies = false;
          team.hasAllInventory = false;
          teams[i] = team;
        }

        // Create the teams on the server.
        teams = teamService.createTeams(teams);

        if (teams != null && teams.Length > 0) {
          foreach (Team newTeam in teams) {
            Console.WriteLine("A team with ID \"{0}\", and name \"{1}\" was created.",
                newTeam.id, newTeam.name);
          }
        } else {
          Console.WriteLine("No teams created.");
        }
      } catch (Exception ex) {
        Console.WriteLine("Failed to create teams. Exception says \"{0}\"", ex.Message);
      }
    }
コード例 #2
0
 public virtual Team updateTeam(Team team)
 {
     object[] results = this.Invoke("updateTeam", new object[] { team });
       return ((Team) (results[0]));
 }