Welcome to mirror list, hosted at ThFree Co, Russian Federation.

GHDataSources.cs « utils « MainsoftWebApp « mainsoft « Test « System.Web « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 25d275223a7c09a0a2059c43e3b7fc98f18fc18e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
using System;
using System.Data;
using System.Collections;

namespace GHTTests
{
	/// <summary>
	/// Summary description for GHDataSources.
	/// </summary>
	public class GHDataSources
	{
		public GHDataSources()
		{
			//
			// TODO: Add constructor logic here
			//
		}
		public static Array DSArray()
		{
			return new string[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten" } ;
		}
		
		public static ArrayList DSArrayHash()
		{
			ArrayList list1 = new ArrayList();
			ArrayList list3 = DSArrayList();
			IEnumerator enumerator1 = list3.GetEnumerator();
			while (enumerator1.MoveNext())
			{
				Hashtable hashtable1 = new Hashtable();
				hashtable1.Add("number", enumerator1.Current.ToString());
				hashtable1.Add("number_up", enumerator1.Current.ToString().ToUpper());
				hashtable1.Add("number_number", enumerator1.Current.ToString() + "_" + enumerator1.Current.ToString());
				list1.Add(hashtable1);
			}
			return list1;
		}
		
		public static ArrayList DSArrayList()
		{
			ArrayList list1 = new ArrayList();
			list1.Add("one");
			list1.Add("two");
			list1.Add("three");
			list1.Add("four");
			list1.Add("five");
			list1.Add("six");
			list1.Add("seven");
			list1.Add("eight");
			list1.Add("nine");
			list1.Add("ten");
			return list1;
		}

		public static DataTable DSDataTable()
		{
			return DSDataTable(0, 1);
		}
		public static DataTable DSDataTable(int startPage, int pages)
		{
			return DSDataTable(startPage, pages, "");
		}
		public static DataTable DSDataTable(int startPage, int pages, string text)
		{
			return DSDataTable(startPage, pages, text, true);
		}
		public static DataTable DSDataTable(int startPage, int pages, string text, bool numPages)
		{
			DataTable table2 = new DataTable("Customers");
			DataColumn column1 = table2.Columns.Add("ID", typeof(int));
			column1.AllowDBNull = false;
			column1.AutoIncrement = true;
			column1.AutoIncrementSeed = 1;
			column1.AutoIncrementStep = 1;
			column1.Unique = true;
			DataColumn[] columnArray1 = new DataColumn[] { column1 } ;
			table2.PrimaryKey = columnArray1;
			column1 = table2.Columns.Add("Name", typeof(string));
			column1.MaxLength = 100;
			column1.DefaultValue = "nobody";
			column1 = table2.Columns.Add("Company", typeof(string));
			column1.MaxLength = 100;
			column1.DefaultValue = "nonexistent";
			ArrayList list1 = DSArrayList();
			IEnumerator enumerator1 = list1.GetEnumerator();
			for (int i = startPage; i < startPage+pages; i++)
			{
				enumerator1.Reset();
				while (enumerator1.MoveNext())
				{
					string page_num = "";
					if (numPages)
						page_num = i.ToString() + "_";

					DataRow row1 = table2.NewRow();
					row1["Name"] = text + "n_" + page_num + (string)(enumerator1.Current);
					row1["Company"] = text + "c_" + page_num + (string)(enumerator1.Current);
					table2.Rows.Add(row1);
				}
			}
			return table2;
		}

		public static DataSet DSDataSet()
		{
			DataSet set1 = new DataSet("CustOrdersDS");
			DataTable table1 = new DataTable("Customers");
			set1.Tables.Add(table1);
			DataTable table2 = new DataTable("Orders");
			set1.Tables.Add(table2);
			DataColumn column1 = table1.Columns.Add("ID", typeof(int));
			column1.AllowDBNull = false;
			column1.AutoIncrement = true;
			column1.AutoIncrementSeed = 1;
			column1.AutoIncrementStep = 1;
			column1.Unique = true;
			DataColumn[] columnArray1 = new DataColumn[] { column1 } ;
			table1.PrimaryKey = columnArray1;
			column1 = table1.Columns.Add("Name", typeof(string));
			column1.MaxLength = 14;
			column1.DefaultValue = "nobody";
			column1 = table1.Columns.Add("Company", typeof(string));
			column1.MaxLength = 14;
			column1.DefaultValue = "nonexistent";
			ArrayList list1 = DSArrayList();
			IEnumerator enumerator1 = list1.GetEnumerator();
			while (enumerator1.MoveNext())
			{
				DataRow row1 = table1.NewRow();
				row1["Name"] = "n_" + (string)(enumerator1.Current);
				row1["Company"] = "c_" + (string)(enumerator1.Current);
				table1.Rows.Add(row1);
			}
			column1 = table2.Columns.Add("ID", typeof(int));
			column1.AllowDBNull = false;
			column1.AutoIncrement = true;
			column1.AutoIncrementSeed = 1;
			column1.AutoIncrementStep = 1;
			column1.Unique = true;
			table2.Columns.Add("CustID", typeof(int));
			table2.Columns.Add("Date", typeof(DateTime));
			table2.Columns.Add("Total", typeof(decimal));
			int num1 = 1;
			do
			{
				DataRow row2 = table2.NewRow();
				row2["CustID"] = num1;
				row2["Date"] = new DateTime(0x3aac5ed800);
				row2["Total"] = num1 * num1;
				table2.Rows.Add(row2);
				num1++;
			}
			while (num1 <= 10);
			columnArray1 = new DataColumn[] { column1 } ;
			table2.PrimaryKey = columnArray1;
			return set1;
		}


	}
}