<%@ Page language="c#" Codebehind="ProjectSample.aspx.cs" AutoEventWireup="false" Inherits="WebProjectSample.ProjectSample" %> WebForm1 <% if (create) { //if no name or description, show text boxes for name and description, and a submit button if (null == name || null == description) { %> <% } else //create a project and print out the project id { name = (null == name) ? "ExampleProject" : name; description = (null == description) ? "ExampleProjectDescription" : description; //create the project Plumtree.Remote.PRC.Collaboration.Project.IProjectManager projectManager = GetProjectManager(Request, Response); Plumtree.Remote.PRC.Collaboration.Project.IProject project = projectManager.CreateProject(name, description); //if you want to set additional properties, make sure that store() is called or the changes will not be persisted. //for example: /* project.setStatus(ProjectStatus.NOT_STARTED); project.setStartDate(new Date()); */ //call store before asking for the id. project.Store(); %> <% } } if (remove) { //if no project ID, add a text box for projectID, and a submit button if (projectID == -1) { %> <% } else { //remove the project Plumtree.Remote.PRC.Collaboration.Project.IProjectManager projectManager = GetProjectManager(Request, Response); Plumtree.Remote.PRC.Collaboration.Project.IProject project = projectManager.GetProject(projectID); //squawk if the project could not be retrieved if (null == project) { %> <% } else { //remove projectManager.RemoveProject(project); %> <% } } } if (search) { //if no search text, add a text box for search text, and a submit button if (null == searchText) { %> <% } else { //perform the search Plumtree.Remote.PRC.Collaboration.Project.IProjectManager projectManager = GetProjectManager(Request, Response); Plumtree.Remote.PRC.Collaboration.Project.IProjectFilter projectFilter = projectManager.CreateProjectFilter(); //hard-code the max results to 10 projectFilter.MaximumResults = 10; //set the query projectFilter.NameSearchText = searchText; //execute the search and print out the results Plumtree.Remote.PRC.Collaboration.Project.IProject[] projects = projectManager.QueryProjects(projectFilter); if (projects.Length > 0) { %> <% for (int i = 0; i < projects.Length; i++) { Plumtree.Remote.PRC.Collaboration.Project.IProject project = projects[i]; %> <% } } else { Response.Write("No projects found using search query of " + searchText); } } } %>
Project Name: "/>
Project Description: "/>
<% Response.Write("ID of newly created project is " + project.ID); %>
Project ID: "/>
<%Response.Write("Unable to retrieve project with ID of " + projectID);%>
<%Response.Write("Project with id of " + projectID + " removed.");%>
Search Text: "/>
Search Results
Project Name Project ID
<%Response.Write(project.Name);%> <%Response.Write(project.ID);%>