public Info(string nameSubject, typeControl typeOfControl, description descriptionOfSubject, int numberOfSemester) { this.nameSubject = nameSubject; this.typeOfControl = typeOfControl; this.descriptionOfSubject = descriptionOfSubject; this.numberOfSemester = numberOfSemester; }
public static DataTable GetTableInfo() { DataTable table = new DataTable("Info"); DataColumn column; //столбцы DataRow row; //строки column = new DataColumn(); column.DataType = typeof(string); column.ColumnName = "nameSubject"; table.Columns.Add(column); column = new DataColumn(); column.DataType = typeof(string); column.ColumnName = "typeOfControl"; table.Columns.Add(column); column = new DataColumn(); column.DataType = typeof(string); column.ColumnName = "description"; table.Columns.Add(column); column = new DataColumn(); column.DataType = typeof(System.Int32); column.ColumnName = "numberOfSemester"; table.Columns.Add(column); typeControl typeOfControl = typeControl.differentialOffset; description descriptionOfSubject = description.informatics; int numberOfSemester = 2; string nameSubject = "Практикум на ЭВМ"; Info info1 = new Info(nameSubject, typeOfControl, descriptionOfSubject, numberOfSemester); typeOfControl = typeControl.exam; descriptionOfSubject = description.maths; numberOfSemester = 2; nameSubject = "Математический анализ"; Info info2 = new Info(nameSubject, typeOfControl, descriptionOfSubject, numberOfSemester); List<Info> info = new List<Info>() { info1, info2 }; for (int i = 0; i < info.Count; i++) { row = table.NewRow(); row["nameSubject"] = info[i].nameSubject.ToString(); row["typeOfControl"] = info[i].typeOfControl.ToString(); row["description"] = info[i].descriptionOfSubject.ToString(); row["numberOfSemester"] = info[i].numberOfSemester; table.Rows.Add(row); } return table; }