Imports System
Imports System.Data
Imports DayPilot.Utils

''' <summary>
''' Summary description for DataGenerator
''' </summary>
Public Class DataGeneratorMonth
	Public Shared Function GetData() As DataTable
		Dim dt As DataTable
		dt = New DataTable()
		dt.Columns.Add("start", GetType(Date))
		dt.Columns.Add("end", GetType(Date))
		dt.Columns.Add("name", GetType(String))
		dt.Columns.Add("id", GetType(String))
		dt.Columns.Add("column", GetType(String))
		dt.Columns.Add("color", GetType(String))

		Dim dr As DataRow

		dr = dt.NewRow()
		dr("id") = 1
		dr("start") = Date.Today.AddDays(-30)
		dr("end") = Date.Today.AddDays(-28)
		dr("name") = "Event 1"
		dr("column") = "A"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 2
		dr("start") = Date.Today.AddDays(-21)
		dr("end") = Date.Today.AddDays(-19)
		dr("name") = "Event 2"
		dr("column") = "A"
		dr("color") = "green"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 3
		dr("start") = Date.Today.AddDays(-15)
		dr("end") = Date.Today.AddDays(-13)
		dr("name") = "Event 3"
		dr("column") = "A"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 4
		dr("start") = Date.Today.AddDays(-8).AddHours(10)
		dr("end") = Date.Today.AddDays(-6).AddHours(15)
		dr("name") = "Sales Dept. Meeting Once Again"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 5
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(1)
		dr("name") = "Event 4"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 6
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(1)
		dr("name") = "Event 6"
		dr("column") = "C"
		dt.Rows.Add(dr)


		dr = dt.NewRow()
		dr("id") = 7
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(2)
		dr("name") = "Unicode test: 公曆 (requires Unicode fonts on the client side)"
		dr("color") = "red"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 8
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(1)
		dr("name") = "Event 8"
		dr("column") = "C"
		dr("color") = "green"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 11
		dr("start") = Date.Today.AddDays(8)
		dr("end") = Date.Today.AddDays(15)
		dr("name") = "Event 11"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 12
		dr("start") = Date.Today.AddDays(-2)
		dr("end") = Date.Today
		dr("name") = "Event 12"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 13
		dr("start") = Date.Today.AddDays(-7)
		dr("end") = Date.Today
		dr("name") = "Event 13"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 14
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(1)
		dr("name") = "Event 14"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 15
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(2)
		dr("name") = "Event 15"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dt.PrimaryKey = New DataColumn() { dt.Columns("id") }

		Return dt

	End Function

	Public Shared Function GetDataGantt() As DataTable
		Dim dt As DataTable
		dt = New DataTable()
		dt.Columns.Add("start", GetType(Date))
		dt.Columns.Add("end", GetType(Date))
		dt.Columns.Add("name", GetType(String))
		dt.Columns.Add("id", GetType(String))
		dt.Columns.Add("column", GetType(String))
		dt.Columns.Add("color", GetType(String))

		Dim dr As DataRow

		dr = dt.NewRow()
		dr("id") = 1
		dr("start") = Date.Today
		dr("end") = Date.Today.AddDays(1)
		dr("name") = "Event 1"
		dr("column") = "A"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 2
		dr("start") = Date.Today.AddDays(1)
		dr("end") = Date.Today.AddDays(4)
		dr("name") = "Event 2"
		dr("column") = "A"
		dr("color") = "green"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 3
		dr("start") = Date.Today.AddDays(4)
		dr("end") = Date.Today.AddDays(5)
		dr("name") = "Event 3"
		dr("column") = "A"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 4
		dr("start") = Date.Today.AddDays(5)
		dr("end") = Date.Today.AddDays(7)
		dr("name") = "Event 4"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 5
		dr("start") = Date.Today.AddDays(7)
		dr("end") = Date.Today.AddDays(15)
		dr("name") = "Event 4"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dt.PrimaryKey = New DataColumn() { dt.Columns("id") }

		Return dt

	End Function


	Public Shared Function GetDataLarge() As DataTable
		Dim dt As DataTable
		dt = New DataTable()
		dt.Columns.Add("start", GetType(Date))
		dt.Columns.Add("end", GetType(Date))
		dt.Columns.Add("name", GetType(String))
		dt.Columns.Add("id", GetType(String))
		dt.Columns.Add("column", GetType(String))
		dt.Columns.Add("allday", GetType(Boolean))

		Dim dr As DataRow

		For i As Integer = 0 To 299
			dr = dt.NewRow()
			dr("id") = i + 1000
			dr("start") = Convert.ToDateTime("15:50").AddDays(i)
			dr("end") = Convert.ToDateTime("15:50").AddDays(i)
			dr("name") = "Event 1"
			dr("column") = "D"
			dt.Rows.Add(dr)
		Next i

		For i As Integer = 0 To 299
			dr = dt.NewRow()
			dr("id") = i + 2000
			dr("start") = Convert.ToDateTime("15:50").AddDays(i)
			dr("end") = Convert.ToDateTime("15:50").AddDays(i)
			dr("name") = "Event 1"
			dr("column") = "G"
			dt.Rows.Add(dr)
		Next i

		For i As Integer = 0 To 299
			dr = dt.NewRow()
			dr("id") = i + 3000
			dr("start") = Convert.ToDateTime("15:50").AddDays(i)
			dr("end") = Convert.ToDateTime("15:50").AddDays(i)
			dr("name") = "Event 1"
			dr("column") = "I"
			dt.Rows.Add(dr)
		Next i

		dr = dt.NewRow()
		dr("id") = 2
		dr("start") = Convert.ToDateTime("16:00")
		dr("end") = Convert.ToDateTime("17:00")
		dr("name") = "Event 2"
		dr("column") = "A"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 3
		dr("start") = Convert.ToDateTime("14:15").AddDays(1)
		dr("end") = Convert.ToDateTime("18:45").AddDays(1)
		dr("name") = "Event 3"
		dr("column") = "A"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 4
		dr("start") = Convert.ToDateTime("16:30")
		dr("end") = Convert.ToDateTime("17:30")
		dr("name") = "Sales Dept. Meeting Once Again"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 5
		dr("start") = Convert.ToDateTime("8:00")
		dr("end") = Convert.ToDateTime("9:00")
		dr("name") = "Event4asdfasdfasdfadfasdfasdf"
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 6
		dr("start") = Convert.ToDateTime("14:00")
		dr("end") = Convert.ToDateTime("10:00").AddDays(1)
		dr("name") = "Event 6"
		dr("column") = "C"
		dt.Rows.Add(dr)


		dr = dt.NewRow()
		dr("id") = 7
		dr("start") = Convert.ToDateTime("11:00")
		dr("end") = Convert.ToDateTime("13:14")
		dr("name") = "Unicode test: 公曆"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 8
		dr("start") = Convert.ToDateTime("13:14").AddDays(-1)
		dr("end") = Convert.ToDateTime("14:05").AddDays(-1)
		dr("name") = "Event 8"
		dr("column") = "C"
		dt.Rows.Add(dr)


		dr = dt.NewRow()
		dr("id") = 9
		dr("start") = Convert.ToDateTime("13:14").AddDays(7)
		dr("end") = Convert.ToDateTime("14:05").AddDays(7)
		dr("name") = "Event 9"
		dr("column") = "C"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 10
		dr("start") = Convert.ToDateTime("13:14").AddDays(-7)
		dr("end") = Convert.ToDateTime("14:05").AddDays(-7)
		dr("name") = "Event 10"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 11
		dr("start") = Convert.ToDateTime("00:00").AddDays(8)
		dr("end") = Convert.ToDateTime("00:00").AddDays(15)
		dr("name") = "Event 11"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 12
		dr("start") = Convert.ToDateTime("00:00")
		dr("end") = Convert.ToDateTime("00:00").AddDays(1)
		dr("name") = "Event 12"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 13
		dr("start") = Date.Now
		dr("end") = Date.Now.AddDays(1)
		dr("name") = "Event 13."
		dr("column") = "B"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 14
		dr("start") = Convert.ToDateTime("7:45:00")
		dr("end") = Convert.ToDateTime("8:30:00")
		dr("name") = "Event 14"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 15
		dr("start") = Convert.ToDateTime("23:30:00")
		dr("end") = Convert.ToDateTime("00:15:00").AddDays(1)
		dr("name") = "Event 15"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dr = dt.NewRow()
		dr("id") = 16
		dr("start") = Convert.ToDateTime("8:30:00").AddDays(1)
		dr("end") = Convert.ToDateTime("9:00:00").AddDays(3)
		dr("name") = "Event 16"
		dr("column") = "D"
		dt.Rows.Add(dr)


		dr = dt.NewRow()
		dr("id") = 17
		dr("start") = Convert.ToDateTime("8:00:00").AddDays(1)
		dr("end") = Convert.ToDateTime("8:00:01").AddDays(1)
		dr("name") = "Event 17"
		dr("column") = "D"
		dt.Rows.Add(dr)

		dt.PrimaryKey = New DataColumn() { dt.Columns("id") }

		Return dt

	End Function

	Public Shared Function GetDataBigOnePerDay() As DataTable
		Dim dt As DataTable
		dt = New DataTable()
		dt.Columns.Add("start", GetType(Date))
		dt.Columns.Add("end", GetType(Date))
		dt.Columns.Add("name", GetType(String))
		dt.Columns.Add("id", GetType(String))
		dt.Columns.Add("column", GetType(String))
		dt.Columns.Add("allday", GetType(Boolean))
		dt.Columns.Add("color", GetType(String))

		Dim dr As DataRow

		Dim start As New Date(Date.Today.Year, 1, 1)
		Dim days As Integer = Year.Days(start.Year)
		Dim resources As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

		For i As Integer = 0 To days - 1
			For r As Integer = 0 To resources.Length - 1
				dr = dt.NewRow()
				dr("id") = Guid.NewGuid().ToString()
				dr("start") = start.AddDays(i)
				dr("end") = start.AddDays(i + 1)
				dr("name") = "Event"
				dr("column") = resources.Chars(r)
				dt.Rows.Add(dr)
			Next r
		Next i

		dt.PrimaryKey = New DataColumn() { dt.Columns("id") }

		Return dt

	End Function

End Class
