public static List<DBStudentSubGroup> GetGroups() { DBStudentSubGroup[] t = new DBStudentSubGroup[7]; t[0] = new DBStudentSubGroup(0, "АСОИ121", 1); t[1] = new DBStudentSubGroup(1, "АСОИ121", 2); t[2] = new DBStudentSubGroup(2, "АСОИ122", 1); t[3] = new DBStudentSubGroup(3, "АЭП121", 1); t[4] = new DBStudentSubGroup(4, "АЭП121", 2); t[5] = new DBStudentSubGroup(5, "АЭП122", 1); t[6] = new DBStudentSubGroup(6, "МПК121", 1); return t.ToList(); }
public static List<DBStudentSubGroup> GetGroups(SqlConnection connection) { string commandText = "select IDGroups,NameGroup,NumberSubGroup from SubGroups order by IDGroups Asc "; SqlCommand command = new SqlCommand(commandText, connection); DataTable dtSubGroups = FilingDT(command); DBStudentSubGroup[] studentSubGroups = new DBStudentSubGroup[dtSubGroups.Rows.Count]; for (int rowIndex = 0; rowIndex < dtSubGroups.Rows.Count; rowIndex++) { studentSubGroups[rowIndex] = new DBStudentSubGroup(Convert.ToInt32(dtSubGroups.Rows[rowIndex][0].ToString()), dtSubGroups.Rows[rowIndex][1].ToString().ToUpper(), Convert.ToByte(dtSubGroups.Rows[rowIndex][2].ToString())); } return studentSubGroups.ToList(); }