Private Function GetSampleData() As DataSet
Dim theDataSet As New DataSet()
Dim projectKey As String = "projectKey"
Dim theProjects As DataTable = theDataSet.Tables.Add("Projects")
theProjects.Columns.Add("ProjectID")
theProjects.Columns.Add("ProjectKey")
theProjects.Columns.Add("ProjectName")
theProjects.Columns.Add("ProjectStartTime", GetType(DateTime))
' 各プロジェクト メンバーに値を割り当てます
theProjects.Rows.Add(New [Object]() {Guid.NewGuid(), projectKey, "QuarterlyProject", DateTime.Today})
Dim theTasks As DataTable = theDataSet.Tables.Add("Tasks")
theTasks.Columns.Add("TaskID")
theTasks.Columns.Add("ProjectKey")
theTasks.Columns.Add("TaskName")
theTasks.Columns.Add("TaskStartTime", GetType(DateTime))
theTasks.Columns.Add("TaskDuration", GetType(TimeSpan))
theTasks.Columns.Add("ParentTaskID")
theTasks.Columns.Add("Constraint", typeof(object))
theTasks.Columns.Add("TaskPercentComplete")
'Task プロパティは個々のメンバーに対応しています。しかし、データベース領域を節約することができます
'AllProperties を使用し、他のフィールドをバインドせずに、バイナリとしてデータを保存する方法です
theTasks.Columns.Add("AllProperties", typeof(Byte[]))
' 親タスク 1
Dim planningTaskid As Guid = Guid.NewGuid()
' 各タスク メンバーに値を割り当てます
theTasks.Rows.Add(New [Object]() {planningTaskid, projectKey, "Planning", DateTime.Now, TimeSpan.FromDays(5), Nothing,TaskConstraint.StartNoEarlierThan,Nothing})
' 親タスク 1 の子タスク 1
theTasks.Rows.Add(New [Object]() {Guid.NewGuid(), projectKey, "Prepare Budget", DateTime.Now, TimeSpan.FromDays(2), planningTaskid,TaskConstraint.StartNoEarlierThan,100})
' 親タスク 1 の子タスク 2
theTasks.Rows.Add(New [Object]() {Guid.NewGuid(), projectKey, "Allocate Teams", DateTime.Now.AddDays(2), TimeSpan.FromDays(3), planningTaskid, TaskConstraint.StartNoEarlierThan, Nothing})
' 親タスク 2
Dim implementationTaskid As Guid = Guid.NewGuid()
theTasks.Rows.Add(New [Object]() {implementationTaskid, projectKey, "Implementation", DateTime.Now.AddDays(6), TimeSpan.FromDays(16), Nothing, TaskConstraint.StartNoEarlierThan, Nothing})
Dim installationTaskid2 As Guid = Guid.NewGuid()
' 親タスク 2 の子タスク 1
theTasks.Rows.Add(New [Object]() {installationTaskid2, projectKey, "Installations", DateTime.Now.AddDays(6), TimeSpan.FromDays(2), implementationTaskid, TaskConstraint.StartNoEarlierThan, 60})
' 親タスク 2 の子タスク 2
theTasks.Rows.Add(New [Object]() {Guid.NewGuid(), projectKey, "Execution", DateTime.Now.AddDays(8), TimeSpan.FromDays(13), implementationTaskid,TaskConstraint.StartNoEarlierThan,Nothing})
' 親タスク 3
Dim testingTaskid As Guid = Guid.NewGuid()
theTasks.Rows.Add(New [Object]() {testingTaskid, projectKey, "Testing", DateTime.Now.AddDays(23), TimeSpan.FromDays(20), Nothing, TaskConstraint.StartNoEarlierThan,Nothing})
' 親タスク 3 の子タスク 1
theTasks.Rows.Add(New [Object]() {Guid.NewGuid(), projectKey, "TestPhase1", DateTime.Now.AddDays(23), TimeSpan.FromDays(10), testingTaskid,TaskConstraint.StartNoEarlierThan,
20})
' 親タスク 3 の子タスク 2
theTasks.Rows.Add(New [Object]() {Guid.NewGuid(), projectKey, "TestPhase2", DateTime.Now.AddDays(36), TimeSpan.FromDays(9), testingTaskid,TaskConstraint.StartNoEarlierThan,
Nothing})
Return theDataSet
End Function