void student(DataGridView data_grid, table source_table) { source_table.clear(); for (int i = 0, n_raw = data_grid.RowCount - 1; i < n_raw; ++i) { bool error = false; string[] arg = new string[data_grid.ColumnCount]; for (int j = 0, n_columns = data_grid.ColumnCount; j < n_columns; ++j) { if (j == 4) { string key = table_group.instanse().find(Convert.ToString(data_grid[j, i].Value), 1, 0); if (key != "%undef%") { arg[j] = key; } else { error = true; } } else { arg[j] = Convert.ToString(data_grid[j, i].Value); } } if (!error) { source_table.add_record(arg); } } }
void faculty(DataGridView data_grid, table source_table) { source_table.clear(); for (int i = 0, n_raw = data_grid.RowCount - 1; i < n_raw; ++i) { string[] arg = new string[data_grid.ColumnCount]; for (int j = 0, n_columns = data_grid.ColumnCount; j < n_columns; ++j) { arg[j] = Convert.ToString(data_grid[j, i].Value); } source_table.add_record(arg); } }
private void read(string file_name, table new_table) { new_table.clear(); FileStream file = new FileStream(file_name, FileMode.Open, FileAccess.Read); StreamReader reader = new StreamReader(file); string str; while ((str = reader.ReadLine()) != null) { string[] elements = str.Split(';'); if (elements.Count <string>() > 1) { new_table.add_record(elements); } } }
void academic_progress(DataGridView data_grid, table source_table) { source_table.clear(); for (int i = 0, n_raw = data_grid.RowCount - 1; i < n_raw; ++i) { bool error = false; string[] arg = new string[data_grid.ColumnCount]; for (int j = 0, n_columns = data_grid.ColumnCount; j < n_columns; ++j) { //if (j == 0) { // string key = table_student.instanse().find(Convert.ToString(data_grid[j, i].Value), 1, 0); // if (key != "%undef%") arg[j] = key; // else error = true; //} if (j == 1) { string key = table_subject.instanse().find(Convert.ToString(data_grid[j, i].Value), 1, 0); if (key != "%undef%") { arg[j] = key; } else { error = true; } } //else if (j == 5) { // string key = table_teacher.instanse().find(Convert.ToString(data_grid[j, i].Value), 1, 0); // if (key != "%undef%") arg[j] = key; // else error = true; //} else { arg[j] = Convert.ToString(data_grid[j, i].Value); } } if (!error) { source_table.add_record(arg); } } }