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);
                }
            }
        }
Exemple #2
0
        private void display(table table_for_display)
        {
            clear_data_grid();

            if (table_for_display.get_name() == "Студент")
            {
                rating_view.Enabled = true;
            }
            else
            {
                rating_view.Enabled = false;
            }

            if (table_for_display.get_name() != "Запрос успеваемости")
            {
                label_for_student.Text = "";
            }

            List <string> columns_name = table_for_display.get_columns();

            current_table = table_for_display;
            int column_width = (data_grid.Width - 70) / columns_name.Count();

            int index = 1;

            foreach (string name in columns_name)
            {
                var column = new DataGridViewColumn();
                column.HeaderText = name;
                if (index == columns_name.Count())
                {
                    column.Width = column_width + (data_grid.Width - column_width * index);
                }
                else
                {
                    column.Width = column_width;
                }
                //column.ReadOnly = true;
                column.Name         = name;
                column.Frozen       = true;
                column.CellTemplate = new DataGridViewTextBoxCell();
                column.SortMode     = DataGridViewColumnSortMode.Programmatic;
                data_grid.Columns.Add(column);
                ++index;
            }

            int index_raw = 0;

            table_for_display.Reset();
            foreach (table_record record in table_for_display)
            {
                data_grid.Rows.Add();
                int index_column = 0;

                foreach (table_field field in record)
                {
                    data_grid[index_column++, index_raw].Value = field.get_value();
                }

                ++index_raw;
            }
        }