Beispiel #1
0
        public void refresh(Button button)
        {
            if (id < rep.ListId().Count())
            {
                zaman--;
                quiz             = rep.Search(rep.ListId()[id]);
                txtQuestion.Text = quiz.question;
                A.Text           = "A) " + quiz.A;
                B.Text           = "B) " + quiz.B;
                C.Text           = "C) " + quiz.C;
                D.Text           = "D) " + quiz.D;
                button.BackColor = Color.Black;
                lblTime.Text     = "";
                lblTime.Visible  = true;
                id++;


                if (id > 6)
                {
                    timer1.Enabled  = false;
                    lblTime.Visible = false;
                }
            }

            else
            {
                wait.Stop();
                this.Hide();
                this.Close();
            }
        }
Beispiel #2
0
 public void refresh()
 {
     quiz             = rep.Search(rep.ListId()[id]);
     txtQuestion.Text = quiz.question;
     A.Text           = "A) " + quiz.A;
     B.Text           = "B) " + quiz.B;
     C.Text           = "C) " + quiz.C;
     D.Text           = "D) " + quiz.D;
     lblTime.Text     = "30";
     id++;
 }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (dtgvQuiz.SelectedRows.Count <= 0)
     {
         MessageBox.Show("Lütfen silmek istediğiniz bir satırı seçiniz", "Silme İşlemi");
         return;
     }
     else
     {
         MyQuiz entity = (MyQuiz)dtgvQuiz.SelectedRows[0].DataBoundItem;
         rep.Delete(entity.Id);
         refreshQuiz();
     }
 }
Beispiel #4
0
 public FrmQuiz()
 {
     id = 0;
     InitializeComponent();
     rep     = new MyQuizRepository();
     quiz    = new MyQuiz();
     cikis   = new DialogResult();
     wait    = new SoundPlayer("wait.wav");
     correct = new SoundPlayer("correct.wav");
     wrong   = new SoundPlayer("wrong.wav");
     wait.Play();
     zaman          = 30;
     timer1.Enabled = true;
     refresh();
 }
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (dtgvQuiz.SelectedRows.Count <= 0)
     {
         MessageBox.Show("Lütfen düzeltmek istediğiniz bir satırı seçiniz", "Güncelleme İşlemi");
         return;
     }
     else
     {
         MyQuiz entity             = (MyQuiz)dtgvQuiz.SelectedRows[0].DataBoundItem;
         FrmAdminPanelQuizEdit frm = new FrmAdminPanelQuizEdit(entity);
         frm.ShowDialog();
         refreshQuiz();
     }
 }
 public FrmAdminPanelQuizEdit(MyQuiz entity)
 {
     InitializeComponent();
     rep = new MyQuizRepository();
     cmb = new List <int>();
     List();
     comboBox1.DataSource   = cmb;
     comboBox1.SelectedItem = entity.level;
     txtQuestion.Text       = entity.question;
     txtA.Text          = entity.A;
     txtB.Text          = entity.B;
     txtC.Text          = entity.C;
     txtD.Text          = entity.D;
     txtTrueAnswer.Text = entity.trueAnswer;
     id = entity.Id;
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            MyQuiz entity = new MyQuiz();

            entity.question   = txtQuestion.Text;
            entity.A          = txtA.Text;
            entity.B          = txtB.Text;
            entity.C          = txtC.Text;
            entity.D          = txtD.Text;
            entity.trueAnswer = txtTrueAnswer.Text;
            entity.level      = Convert.ToInt32(comboBox1.SelectedValue);

            if (id == -1)
            {
                rep.Insert(entity);
            }

            else
            {
                entity.Id = id;
                rep.Update(entity);
            }
            Close();
        }