预订演示
前页 后页

Repository Extras

These are examples of code for accessing repository collections for system-level information.

Sub RepositoryExtras

     Dim o as object

     Dim idx as integer

     'issues

     o = m_Repository.Issues.AddNew("Problem","Type")

     If(o.Update=false) Then

          Console.WriteLine (o.GetLastError())

     End if

     o = nothing

     m_Repository.Issues.Refresh

     For idx = 0 to m_Repository.Issues.Count-1

          Console.Writeline(m_Repository.Issues.GetAt(idx).Name)

          If(m_Repository.Issues.GetAt(idx).Name = "Problem") then

               m_Repository.Issues.DeleteAt(idx,false)

               Console.WriteLine("Delete Issues")

          End if

     Next

     ''tasks

     o = m_Repository.Tasks.AddNew("Task 1","Task type")

     If(o.Update=false) Then

          Console.WriteLine ("error - " + o.GetLastError())

     End if

     o = nothing

     m_Repository.Tasks.Refresh

     For idx = 0 to m_Repository.Tasks.Count-1

          Console.Writeline(m_Repository.Tasks.GetAt(idx).Name)

          If(m_Repository.Tasks.GetAt(idx).Name = "Task 1") then

               m_Repository.Tasks.DeleteAt(idx,false)

               Console.WriteLine("Delete Tasks")

          End if

     Next

     ''glossary

     o = m_Repository.Terms.AddNew("Term 1","business")

     If(o.Update=false) Then

          Console.WriteLine ("error - " + o.GetLastError())

     End if

     o = nothing

     m_Repository.Terms.Refresh

     For idx = 0 to m_Repository.Terms.Count-1

          Console.Writeline(m_Repository.Terms.GetAt(idx).Term)

          If(m_Repository.Terms.GetAt(idx).Term = "Term 1") then

               m_Repository.Terms.DeleteAt(idx,false)

               Console.WriteLine("Delete Terms")

          End if

     Next

     'authors

     o = m_Repository.Authors.AddNew("Joe B","Writer")

     If(o.Update=false) Then

          Console.WriteLine (o.GetLastError())

     End if

     o = nothing

     m_Repository.Authors.Refresh

     For idx = 0 to m_Repository.authors.Count-1

          Console.Writeline(m_Repository.Authors.GetAt(idx).Name)

          If(m_Repository.authors.GetAt(idx).Name = "Joe B") then

               m_Repository.authors.DeleteAt(idx,false)

               Console.WriteLine("Delete Authors")

          End if

     Next

     o = m_Repository.Clients.AddNew("Joe Sphere","Client")

     If(o.Update=false) Then

          Console.WriteLine (o.GetLastError())

     End if

     o = nothing

     m_Repository.Clients.Refresh

     For idx = 0 to m_Repository.Clients.Count-1

          Console.Writeline(m_Repository.Clients.GetAt(idx).Name)

          If(m_Repository.Clients.GetAt(idx).Name = "Joe Sphere") then

               m_Repository.Clients.DeleteAt(idx,false)

               Console.WriteLine("Delete Clients")

          End if

     Next

     o = m_Repository.Resources.AddNew("Joe Worker","Resource")

     If(o.Update=false) Then

          Console.WriteLine (o.GetLastError())

     End if

     o = nothing

     m_Repository.Resources.Refresh

     For idx = 0 to m_Repository.Resources.Count-1

          Console.Writeline(m_Repository.Resources.GetAt(idx).Name)

          If(m_Repository.Resources.GetAt(idx).Name = "Joe Worker") then

               m_Repository.Resources.DeleteAt(idx,false)

               Console.WriteLine("Delete Resources")

          End if

     Next

End Sub