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); } } }
protected void find(table search_table, int index, string value) { search_table.Reset(); int n = search_table.get_columns().Count; foreach (table_record record in search_table) { if (record[index].get_value() == value) { string[] arg = record.get_values(); result.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); } }
protected void find() { table_student.instanse().Reset(); foreach (table_record student_record in table_student.instanse()) { bool _2 = false; bool _3 = false; bool _4 = false; bool _5 = false; foreach (table_record record in table_academic_progress.instanse()) { if (student_record[0].get_value() == record[0].get_absolute_value()) { if (record[2].get_value() == "зачет" && record[3].get_value() == "не зачет") { _2 = true; break; } else if (record[2].get_value() == "экзамен" && record[3].get_value() == "2") { _2 = true; break; } else if (record[2].get_value() == "экзамен" && record[3].get_value() == "3") { _3 = true; } else if (record[2].get_value() == "экзамен" && record[3].get_value() == "4") { _4 = true; } else if (record[2].get_value() == "экзамен" && record[3].get_value() == "5") { _5 = true; } } } table_academic_progress.instanse().Reset(); if (add_check(_2, _3, _4, _5)) { string[] arg = student_record.get_values(); result.add_record(arg); } } table_student.instanse().Reset(); }
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); } } }