Пример #1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            Question added = new Question();

            added.Question_ = questionAdd.Text;
            added.Set_Answers(ans1Add.Text, ans2Add.Text, ans3Add.Text, ans4Add.Text);
            _changed = true;

            if (_list.Size == 15)
                maxQuests.Visible = true;
            else
            {
                AddE(added);
                RefreshDialog();
            }
        }
Пример #2
0
        public void Load(QuestionList list)
        {
            _list = list;
            _list.Clear();

            Question tmp;

            string QuestExpression = "SELECT * from mainTable";

            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                  connection.Open();

                  SqlCommand command = new SqlCommand(QuestExpression, connection);
                  SqlDataReader reader = command.ExecuteReader();

                  if (reader.HasRows)
                  {
                      while (reader.Read())
                      {
                          tmp = new Question();
                          tmp.Question_ = reader.GetString(1);
                          tmp.Set_Answers(reader.GetString(2), reader.GetString(3), reader.GetString(4), reader.GetString(5));
                          list.Add(tmp);
                      }
                  }
            }
        }
Пример #3
0
        private void editButton_Click(object sender, EventArgs e)
        {
            Question edited = new Question();

            edited.Question_ = questionEdit.Text;
            edited.Set_Answers(ans1Edit.Text, ans2Edit.Text, ans3Edit.Text, ans4Edit.Text);
            _changed = true;

            if (questListEdit.SelectedIndex >= 0)
                EditE(edited, questListEdit.SelectedIndex);

            RefreshDialog();
        }