Beispiel #1
0
        private void cmdJawab_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Lock this answer?", "Confirmation", MessageBoxButtons.YesNo) == DialogResult.No)
            {
                return;
            }

            answered = true;

            if (_soal.Soal_Jenis == "MULTIPLE")
            {
                Soal_Pilihan_Multiple spm = (Soal_Pilihan_Multiple)lbJawabGanda.SelectedItem;
                if (spm.spm_pilihanbenar)
                {
                    this.DialogResult = DialogResult.Yes;
                    MessageBox.Show("Correct!");
                }
            }
            else
            {
                if (_soal.Soal_Jawab.Trim() == txtJawab.Text.Trim())
                {
                    this.DialogResult = DialogResult.Yes;
                    MessageBox.Show("Correct!");
                }
            }
            if (this.DialogResult == DialogResult.None)
            {
                MessageBox.Show("Wrong answer!");
            }
            Close();
        }
Beispiel #2
0
        public int Insert(Soal_Pilihan_Multiple spm)
        {
            int           result = 0;
            StringBuilder sb     = new StringBuilder();

            sb.Append(" insert into soal_pilihan_multiple (soal_id, spm_pilihan, spm_pilihanbenar) ");
            sb.Append(" values ( ");
            sb.Append("  @soal_id,  @spm_pilihan, @spm_pilihanbenar ");
            sb.Append("  ) ");
            _conn.Open();
            using (_conn)
            {
                result = _conn.Execute(sb.ToString(), new { soal_id = spm.soal_id, spm_pilihan = spm.spm_pilihan, spm_pilihanbenar = spm.spm_pilihanbenar });
            }

            return(result);
        }