示例#1
0
        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);
                }
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
        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);
                }
            }
        }
示例#4
0
        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);
                }
            }
        }