public static List<DBClassRoomType> GetRoomTypes() { DBClassRoomType[] t = new DBClassRoomType[8]; t[0] = new DBClassRoomType(0, "Лекция"); t[1] = new DBClassRoomType(1, "Практика"); t[2] = new DBClassRoomType(2, "Лабораторная-комп"); t[3] = new DBClassRoomType(3, "Лабораторная-физ"); t[4] = new DBClassRoomType(4, "Лабораторная-эл"); t[5] = new DBClassRoomType(5, "СпортЗал"); t[6] = new DBClassRoomType(6, "Выездная"); t[7] = new DBClassRoomType(7, "Особая"); return t.ToList(); }
public static List<DBClassRoomType> GetRoomTypes(SqlConnection connection) { string commandText = "select IDTypes, Description from Types order by IDTypes asc"; SqlCommand command = new SqlCommand(commandText, connection); DataTable dtRoomTypes = FilingDT(command); DBClassRoomType[] сlassRoomsTypes = new DBClassRoomType[dtRoomTypes.Rows.Count]; for (int rowIndex = 0; rowIndex < dtRoomTypes.Rows.Count; rowIndex++) { сlassRoomsTypes[rowIndex] = new DBClassRoomType(Convert.ToInt32(dtRoomTypes.Rows[rowIndex][0].ToString()), dtRoomTypes.Rows[rowIndex][1].ToString()); } return сlassRoomsTypes.ToList(); }