<< 目次を表示 >> ページ位置: API・アドイン・スクリプト > API > サンプルコード > プロジェクトに対するさまざまな操作 |
プロジェクトに定義されたさまざまな情報を追加・削除する例です。
class RepositoryExtrasOperationSample
{
public void RepositoryExtras(EA.Repository repository)
{
// プロジェクトの問題点
EA.ProjectIssues newProjectIssue = (EA.ProjectIssues)repository.Issues.AddNew("Problem", "Category");
newProjectIssue.Update();
repository.Issues.Refresh();
for (short i = 0; i < repository.Issues.Count; i++)
{
EA.ProjectIssues projectIssue = repository.Issues.GetAt(i);
Console.WriteLine(projectIssue.Name);
if (projectIssue.Name == "Problem")
{
repository.Issues.DeleteAt(i, true);
Console.WriteLine("Delete Issue");
break;
}
}
// プロジェクトのToDo
EA.Task newProjectTask = (EA.Task)repository.Tasks.AddNew("Task 1", "Task type");
newProjectTask.Update();
repository.Tasks.Refresh();
for (short i = 0; i < repository.Tasks.Count; i++)
{
EA.Task projectTask = repository.Tasks.GetAt(i);
Console.WriteLine(projectTask.Name);
if (projectTask.Name == "Task 1")
{
repository.Tasks.DeleteAt(i, true);
Console.WriteLine("Delete Task");
break;
}
}
// プロジェクトの用語集
EA.Term newTerm = (EA.Term)repository.Terms.AddNew("Term 1", "business");
newTerm.Update();
repository.Terms.Refresh();
for (short i = 0; i < repository.Terms.Count; i++)
{
EA.Term term = repository.Terms.GetAt(i);
Console.WriteLine(term.Term);
if (term.Term == "Term 1")
{
repository.Terms.DeleteAt(i, true);
Console.WriteLine("Delete Term");
break;
}
}
// 作者
EA.Author newAuthor = (EA.Author)repository.Authors.AddNew("Joe B", "Writer");
newAuthor.Update();
repository.Authors.Refresh();
for (short i = 0; i < repository.Authors.Count; i++)
{
EA.Author author = repository.Authors.GetAt(i);
Console.WriteLine(author.Name);
if (author.Name == "Joe B")
{
repository.Authors.DeleteAt(i, true);
Console.WriteLine("Delete Author");
break;
}
}
// 顧客
EA.Client newClient = (EA.Client)repository.Clients.AddNew("Joe Sphere", "Client");
newClient.Organization = "Company A";
newClient.Update();
repository.Clients.Refresh();
for (short i = 0; i < repository.Clients.Count; i++)
{
EA.Client client = repository.Clients.GetAt(i);
Console.WriteLine(client.Name);
if (client.Name == "Joe Sphere")
{
repository.Clients.DeleteAt(i, true);
Console.WriteLine("Delete Client");
break;
}
}
// リソース
EA.ProjectResource newProjectResource = (EA.ProjectResource)repository.Resources.AddNew("Joe Worker", "Resource");
newProjectResource.Update();
repository.Resources.Refresh();
for (short i = 0; i < repository.Resources.Count; i++)
{
EA.ProjectResource projectResource = repository.Resources.GetAt(i);
Console.WriteLine(projectResource.Name);
if (projectResource.Name == "Joe Worker")
{
repository.Resources.DeleteAt(i, true);
Console.WriteLine("Delete Resource");
break;
}
}
}
}