Exemplo n.º 1
0
        void load_test(int id, view_table table)
        {//загрузить тест
            SQLiteConnection DB = new SQLiteConnection(port_db_helper.dbName);

            DB.Open();
            string        id_test = id.ToString();
            SQLiteCommand CMD     = DB.CreateCommand();

            CMD.CommandText = "select * from questions where id_test = " + id_test;
            SQLiteDataReader reader = CMD.ExecuteReader();

            if (reader == null)
            {
                return;
            }

            while (reader.Read())
            {
                table.add_cortege(
                    new question_plus_typeQuest(
                        (string)reader["question"],
                        Int32.Parse(reader["id_type"].ToString()),
                        Int32.Parse(reader["id"].ToString())
                        )
                    );
            }
            DB.Close();
        }
 public void remove_row_from(view_table table)
 {//удаление строки
     foreach (Control el in cols)
     {
         table.parentForm.Controls.Remove(el);
     }
 }
Exemplo n.º 3
0
        void load_test(int id, view_table table)
        {//загрузить тест
            SQLiteConnection DB = new SQLiteConnection(port_db_helper.dbName);

            DB.Open();
            string        id_test = id.ToString();
            SQLiteCommand CMD     = DB.CreateCommand();

            //  CMD.CommandText = "select * from rules, questions where id_test = " + id_test;
            CMD.CommandText = "SELECT * FROM rules, questions WHERE questions.id = rules.id_questions + '0' AND questions.id_test = " + id_test;
            SQLiteDataReader reader = CMD.ExecuteReader();

            if (reader == null)
            {
                return;
            }

            while (reader.Read())
            {
                table.add_cortege(
                    new question_plus_typeQuest(reader)
                    );
            }
            DB.Close();
        }
        public void resize_Window(view_table table)
        {//изменение окна относительно правого нижнего элемента таблицы
            def_cortege last_row = table.rows[table.lenght_arr - 1] as def_cortege;
            Control     last_col = last_row.cols[length - 1] as Control;

            table.parentForm.Width  = last_col.Left + last_col.Width + 2 * table.Pos_margin;
            table.parentForm.Height = last_col.Top + last_col.Height + 2 * table.Pos_margin;
        }
 void upadate()
 {
     if (table_1 != null)
     {
         table_1.destroy_table();
     }
     table_1 = new view_table(15, 170, 23, this);
     load_rules(ID_TEST, table_1);
     table_1.redraw_on_form();
 }
Exemplo n.º 6
0
        //      ::-----::
        //      ::ФОРМА::
        //      ::-----::

        void upadate()
        {
            if (table_1 != null)
            {
                table_1.destroy_table();
            }
            table_1 = new view_table(50, 140, 30, this);
            load_test(ID_TEST, table_1);
            table_1.redraw_on_form();
        }
        void upadate()
        {
            /*
             * ------------------
             * Делаем расчет как у социолога
             * ------------------
             * nedofix(Кликаем) сначала по социологу!!!
             */
            table_sociolog = new view_table(0, 0, 0, this);
            Sociolog1 tmp = new Sociolog1();

            tmp.ID_TEST = ID_TEST;
            tmp.load_test(tmp.ID_TEST, table_sociolog);

            /*
             * ------------------
             * Нарисовали таблицу
             * ------------------
             */

            SQLiteConnection DB  = new SQLiteConnection(port_db_helper.dbName);
            SQLiteCommand    CMD = DB.CreateCommand();

            CMD             = DB.CreateCommand();
            CMD.CommandText = "SELECT * FROM conf_rules";
            DB.Open();
            SQLiteDataReader reader = CMD.ExecuteReader();

            //РАСЧЕТ ВЫВОДОВ
            int i = 1;

            while (reader.Read())
            {
                pod_zacuchenie p = new pod_zacuchenie(reader, i);
                rezultat.Add(p);
                table_1.add_cortege(p);
                if (i == 3)
                {
                    i        = 1;
                    rezultat = new List <pod_zacuchenie>();
                    continue;
                }
                i++;
            }
            DB.Close();
            table_1.redraw_on_form();
        }
        void load_rules(int id_test, view_table table)
        {//загрузить rules
            SQLiteConnection DB = new SQLiteConnection(port_db_helper.dbName);

            DB.Open();
            SQLiteCommand CMD = DB.CreateCommand();

            CMD.CommandText = "SELECT * FROM conf_rules WHERE id_test = " + id_test;
            SQLiteDataReader reader = CMD.ExecuteReader();

            if (reader == null)
            {
                return;
            }
            while (reader.Read())
            {
                table.add_cortege(new question_plus_typeQuest(reader));
            }
            DB.Close();
        }
Exemplo n.º 9
0
        public void load_test(int id, view_table table)
        {//загрузить тест
            SQLiteConnection DB = new SQLiteConnection(port_db_helper.dbName);

            DB.Open();
            string        id_test = id.ToString();
            SQLiteCommand CMD     = DB.CreateCommand();

            CMD.CommandText = "SELECT * FROM rules, questions WHERE questions.id = rules.id_questions  AND questions.id_test = " + id_test;
            SQLiteDataReader reader = CMD.ExecuteReader();

            if (reader == null)
            {
                return;
            }

            while (reader.Read())
            {
                double percent = -1;
                double avg     = -1;

                Int32 question_id = Int32.Parse(reader["id_questions"].ToString());

                Int32 all_cnt    = port_db_helper.get_count_answed_on_question(question_id);
                Int32 type_quest = Int32.Parse(reader["id_type"].ToString());
                if (type_quest == 1) //если это + - то считаем %
                {
                    Int32 cnt_yes = port_db_helper.get_count_answed_yes(question_id);
                    percent = ((float)cnt_yes * 100.0) / (float)all_cnt;
                }
                else //если это 2..5 то считаем среднее
                {
                    avg = port_db_helper.get_avg_answed_2_to_5(question_id);
                }

                table.add_cortege(new question_plus_typeQuest(reader, (int)percent, avg));
            }
            DB.Close();
        }
        public void draw_row_on(int row, view_table table)
        {//рисование строки
            int i = 0;

            foreach (Control el in cols)
            {
                if (i == 0)
                {
                    el.Top  = table.Pos_Y + (row * table.Pos_margin);
                    el.Left = table.Pos_X;
                }
                else
                {
                    Control old = (cols[i - 1] as Control);
                    el.Top  = old.Top;
                    el.Left = old.Left + old.Width + table.Pos_margin;
                }
                table.parentForm.Controls.Add(el);
                i++;
            }
            length = i;
        }
 public Defazingcs()
 {
     InitializeComponent();
     table_1 = new view_table(30, 100, 40, this);
 }
Exemplo n.º 12
0
 public Conf_questions()
 {
     InitializeComponent();
     table_1 = new view_table(50, 140, 30, this);
 }
Exemplo n.º 13
0
 public Expert()
 {
     InitializeComponent();
     table_1 = new view_table(16, 25, 30, this);
 }
Exemplo n.º 14
0
 public Sociolog1()
 {
     InitializeComponent();
     table_1 = new view_table(16, 25, 50, this);
 }