private void FrmSorular_Load(object sender, EventArgs e) { dt = DataSqlQuestion.SoruSayi(oturumid); sorusayisi = (dt.Rows[0]["SoruSirasi"].ToInt32()); //Random rastgele = new Random(); //SoruSira = rastgele.Next(); SoruGetir(); }
void SoruGetir() { if (SoruSira <= sorusayisi) { dt = DataSqlQuestion.GetSoruGetir(oturumid, SoruSira); //Random rastgele = new Random(); //SoruSira = rastgele.Next(); if (dt.Rows.Count > 0) { SoruID = dt.Rows[0]["SoruID"].ToInt32(); txtSoru.Text = dt.Rows[0]["SoruAdi"].ToString(); puan = dt.Rows[0]["Puan"].ToInt32(); if (dt.Rows[0]["SoruTuru"].ToBoolean()) { soruturu = 1; //bosluk grupSecenekler.Visible = false; lblUyarı.Visible = true; dt = DataSqlQuestion.GetBoslukGetir(SoruID); txtBosluk.Visible = true; //txtBosluk.Text = dt.Rows[0]["Bosluk"].ToString(); dogruCevap = txtBosluk.Text; } else { soruturu = 0; grupSecenekler.Visible = true; lblUyarı.Visible = false; dt = DataSqlQuestion.GetSecenekGetir(SoruID); txtA.Text = dt.Rows[0]["A"].ToString(); txtB.Text = dt.Rows[0]["B"].ToString(); txtC.Text = dt.Rows[0]["C"].ToString(); txtD.Text = dt.Rows[0]["D"].ToString(); txtE.Text = dt.Rows[0]["E"].ToString(); } lblSoruSirasi.Text = SoruSira.ToString(); } else { MessageBox.Show("Test Bitti"); SoruSira = 1; } } if (SoruSira > sorusayisi) { grupSecenekler.Visible = false; txtBosluk.Visible = false; txtSoru.Visible = false; lblUyarı.Visible = false; MessageBox.Show("Puanınız" + toplamPuan); } }
private void btnSil_Click(object sender, EventArgs e) { int id = gridViewOturum.GetFocusedRowCellValue(OturumID).ToInt32(); DataSqlQuestion.SetOturumSil(id); //DataSqlQuestion.SetOturumGuncelle(); MessageBox.Show("Oturumunuz Başarıyla Silindi"); Refresh(); }
private void btnSoruyaGit_Click(object sender, EventArgs e) { int sorusirasi = txtSıra.Text.ToInt32(); btnKaydet.Text = "GÜNCELLE"; guncelle = 1; //dt = DataSqlQuestion.GetSoruGetir(Oturum, sorusirasi); //txtSıra.Text = sorusirasi.ToString(); if (dt.Rows.Count > 0) { SoruID = dt.Rows[0]["SoruID"].ToInt32(); txtSoru.Text = dt.Rows[0]["SoruAdi"].ToString(); txtPuan.Text = dt.Rows[0]["Puan"].ToString(); if (dt.Rows[0]["SoruTuru"].ToBoolean()) { //bosluk grupSecenekler.Visible = false; radioSecenek.Checked = false; radioBosluk.Checked = false; txtSıra.Text = sorusirasi.ToString(); dt = DataSqlQuestion.GetSecenekGetir(SoruID); txtB.Text = dt.Rows[0]["Bosluk"].ToString(); } else { grupSecenekler.Visible = true; radioSecenek.Checked = true; radioBosluk.Checked = false; txtSıra.Text = sorusirasi.ToString(); dt = DataSqlQuestion.GetSecenekGetir(SoruID); txtA.Text = dt.Rows[0]["A"].ToString(); txtB.Text = dt.Rows[0]["B"].ToString(); txtC.Text = dt.Rows[0]["C"].ToString(); txtD.Text = dt.Rows[0]["D"].ToString(); txtE.Text = dt.Rows[0]["E"].ToString(); } } else { MessageBox.Show("Böyle bir soru yoktur"); } /* txtA.Text = ""; * txtB.Text = dt.Rows[0]["SoruSirasi"].ToString()""; * txtC.Text = ""; * txtD.Text = ""; * txtE.Text = ""; * txtPuan.Text = "";*/ }
private void btnCikis_Click(object sender, EventArgs e) { { DialogResult cikis = new DialogResult(); cikis = MessageBox.Show("Çıkış Yapmak İstiyor Musunuz?", "Uyarı", MessageBoxButtons.YesNo); if (cikis == DialogResult.Yes) { FrmGiris Anasayfa = new FrmGiris(); Anasayfa.Show(); this.Hide(); } DataSqlQuestion.NotlariEkle(oturumid, Sessions.KullaniciID, toplamPuan); } }
void Refresh() { dt = DataSqlQuestion.SoruSayi(Oturum); if (dt.Rows.Count > 0) { txtSıra.Text = (dt.Rows[0]["SoruSirasi"].ToInt32() + 1).ToString(); SoruSıra = txtSıra.Text.ToInt32(); } else { SoruSıra = 1; txtSıra.Text = SoruSıra.ToString(); } dt = DataSqlQuestion.ToplamPuan(Oturum); lblPuan.Text = dt.Rows[0]["Puan"].ToString(); }
private void btnOturumGirs_Click(object sender, EventArgs e) { dt = DataSqlQuestion.OgrenciOturum(txtOturumAdi.Text); //TextBoxdan girilen oturum adı sorgudaki oturum adı ile aynı mı? if (dt.Rows.Count > 0) { int id = dt.Rows[0]["OturumID"].ToInt32(); DateTime sure = dt.Rows[0]["Sure"].ToDateTime(); FrmSorular Frm = new FrmSorular(id, sure); Frm.Show(); this.Hide(); } else { MessageBox.Show("Böyle Bir Oturum Bulanamadı."); } }
private void btn_Kaydet_Click(object sender, EventArgs e) { if (txtOgrenciKullanici.Text == "" || txtOgrenciSifre.Text == "") { MessageBox.Show("Boş bıraktığınız alanları doldurunuz"); } else { Model.Values.Ogrenci ogrc = new Model.Values.Ogrenci() { OgrenciAdi = txtOgrenciKullanici.Text, OgrenciSoyadi = txtSoyadi.Text, Sifre = txtOgrenciSifre.Text, }; DataSqlQuestion.OgrenciEkle(ogrc); MessageBox.Show("Kayıt Başarılı"); txtOgrenciKullanici.Text = ""; txtSoyadi.Text = ""; txtOgrenciSifre.Text = ""; } }
private void btnKaydet_Click(object sender, EventArgs e) { if (txtKullaniciAdi.Text == "" || txtSifre.Text == "") { MessageBox.Show("Boş bıraktığınız alanları doldurunuz"); } else { /* * Model.Elif.Urun urun = new Model.Elif.Urun() * { * Barcode = txtBarcode.Text, * BirimFiyati = txtFiyat.Text.ToDouble(), * BirimID = cmbBirim.SelectedValue.ToInt32(), * Doviz = cmbDoviz.Text, * Fiyat = txtFiyat.Text.ToDouble(), * KDVFiyat = KDVFiyat.Text.ToDouble(), * KDVID = cmbKDV.SelectedValue.ToInt32(), * Miktar = txtMiktar.Text.ToDouble(), * UrunAdi = txtUrunAd.Text, * tutar = tutar.ToDouble(), * * * }; * DataAcces.UrunAdd(urun); */ Model.Values.Ogretmen ogrt = new Model.Values.Ogretmen() { OgretmenAdi = txtKullaniciAdi.Text, OgretmenSoyadi = txtSoyadi.Text, Sifre = txtSifre.Text, }; DataSqlQuestion.OgretmenEkle(ogrt); MessageBox.Show("Kayıt Başarılı"); txtKullaniciAdi.Text = ""; txtSoyadi.Text = ""; txtSifre.Text = ""; } }
private void btnOlustur_Click(object sender, EventArgs e) { if (txtOtrAdi.Text == "" || txtOtrSifre.Text == "") { MessageBox.Show("Boş Bıraktığınız Alanları Doldurunuz"); } else if (dateBaslangic.ToDateTime() > dateBitis.ToDateTime()) { MessageBox.Show("Tarih alanlarını kontrol ediniz"); } else { /* string Start = Convert.ToDateTime(dateEdit1.EditValue).ToString("yyyy-MM-dd"); * string Finish = Convert.ToDateTime(dateEdit2.EditValue).ToString("yyyy-MM-dd") + " " + "23:59:59";*/ Model.Values.Oturum otr = new Model.Values.Oturum() { OturumAdi = txtOtrAdi.Text, OturumSifre = txtOtrSifre.Text, OturumBaslangicTarihi = Convert.ToDateTime(dateBaslangic.EditValue).ToString("yyyy-MM-dd"), OturumBitisTarihi = Convert.ToDateTime(dateBitis.EditValue).ToString("yyyy-MM-dd") + " " + "23:59:59", OturumSuresi = Convert.ToDateTime(timeOturum.EditValue).ToString("HH:mm:ss"), }; try { DataSqlQuestion.SetOturumEkle(otr); MessageBox.Show("Kayıt Başarılı"); txtOtrAdi.Text = ""; txtOtrSifre.Text = ""; dateBaslangic.EditValue = DateTime.Now.ToShortDateString(); dateBitis.EditValue = DateTime.Now.ToShortDateString(); timeOturum.EditValue = "00:00:00"; } catch (Exception ex) { MessageBox.Show(" " + ex); } } }
void Refresh() { gridControl1.DataSource = DataSqlQuestion.GetExcellListesi(oturumid); }
//Buton olayına hangi radio buton seçili ise private void btnKaydet_Click(object sender, EventArgs e) { if (radioSecenek.Checked == true) { radioBosluk.Checked = false; if (txtA.Text == " " || txtB.Text == " " || txtC.Text == " " || txtD.Text == " " || txtE.Text == " ") { MessageBox.Show("Boş bıraktığınız seçenekler var"); } else if (txtPuan.Text == "") { MessageBox.Show("Puan alanını doldurunuz"); } else { Model.Values.Soru Soru = new Model.Values.Soru { SoruAdi = txtSoru.Text, Puan = txtPuan.Text.ToInt32(), SoruSirasi = txtSıra.Text.ToInt32(), SecenekA = txtA.Text, SecenekB = txtB.Text, SecenekC = txtC.Text, SecenekD = txtD.Text, SecenekE = txtE.Text, SoruTuru = false, //SoruID = 1, }; /*SELECT * FROM tblSoru ORDER BY SoruID DESC LIMIT 1*/ if (guncelle == 0) { DataSqlQuestion.SetSoruEkle(Soru, Oturum); btnKaydet.Text = "KAYDET"; dt = DataSqlQuestion.SetSoruID(Oturum); SoruID = dt.Rows[0]["SoruID"].ToInt32(); DataSqlQuestion.SetSecenekEkle(Soru, SoruID); if (radioA.Checked) { secenek = true; DataSqlQuestion.SetDogru(txtA.Text, SoruID); } else if (radioB.Checked) { secenek = true; DataSqlQuestion.SetDogru(txtB.Text, SoruID); } else if (radioC.Checked) { secenek = true; DataSqlQuestion.SetDogru(txtC.Text, SoruID); } else if (radioD.Checked) { secenek = true; DataSqlQuestion.SetDogru(txtD.Text, SoruID); } else if (radioE.Checked) { secenek = true; DataSqlQuestion.SetDogru(txtE.Text, SoruID); } if (secenek == false) { MessageBox.Show("Doğru cevabı seçiniz."); } else { txtA.Text = ""; txtB.Text = ""; txtC.Text = ""; txtD.Text = ""; txtE.Text = ""; txtSoru.Text = ""; txtPuan.Text = ""; txtSıra.Text = (dt.Rows[0]["SoruSirasi"].ToInt32() + 1).ToString(); } } else { DataSqlQuestion.SetSoruGuncelle(SoruID, Soru); txtA.Text = ""; txtB.Text = ""; txtC.Text = ""; txtD.Text = ""; txtE.Text = ""; txtSoru.Text = ""; grupSecenekler.Visible = false; radioBosluk.Checked = false; radioSecenek.Checked = false; txtPuan.Text = ""; txtSıra.Text = (dt.Rows[0]["SoruSirasi"].ToInt32() + 1).ToString(); } } } else if (radioBosluk.Checked == true) { radioSecenek.Checked = false; if (txtBosluk.Text == " ") { MessageBox.Show("Boş bıraktığınız alanı doldurunuz."); } else if (txtPuan.Text == "") { MessageBox.Show("Puan alanını doldurunuz"); } else { Model.Values.Soru Soru = new Model.Values.Soru { SoruAdi = txtSoru.Text, Puan = txtPuan.Text.ToInt32(), SoruSirasi = txtSıra.Text.ToInt32(), Bosluk = txtBosluk.Text, SoruTuru = true, //SoruID = 1, }; if (guncelle == 0) { DataSqlQuestion.SetSoruEkle(Soru, Oturum); btnKaydet.Text = "KAYDET"; dt = DataSqlQuestion.SetSoruID(Oturum); SoruID = dt.Rows[0]["SoruID"].ToInt32(); DataSqlQuestion.SetBoslukEkle(txtBosluk.Text, SoruID); //txtBosluk.Text = ""; txtPuan.Text = ""; txtSıra.Text = (dt.Rows[0]["SoruSirasi"].ToInt32() + 1).ToString(); if (txtBosluk.Text != "") { DataSqlQuestion.SetDogru(txtBosluk.Text, SoruID); txtBosluk.Text = ""; txtSoru.Text = ""; grupSecenekler.Visible = false; radioBosluk.Checked = false; radioSecenek.Checked = false; txtPuan.Text = ""; txtSıra.Text = (dt.Rows[0]["SoruSirasi"].ToInt32() + 1).ToString(); } } } } else { MessageBox.Show("Bir seçenek seçiniz"); } Refresh(); }
private void BtnGiris_Click(object sender, EventArgs e) { if (txtAdi.Text == "" || txtSifre.Text == "") { MessageBox.Show("Bu alanları boş geçmeyiniz."); } else { if (b == 1) { Sessions.YetkiID = 1; kAdi = txtAdi.Text; Sifre = txtSifre.Text; dt = DataSqlQuestion.GetYoneticiKontrol(kAdi, Sifre); if (dt.Rows.Count > 0) { Sessions.KullaniciID = dt.Rows[0]["YoneticiID"].ToInt32(); FrmYonetici Frm = new FrmYonetici(); Frm.Show(); this.Hide(); } else { MessageBox.Show("Kullanıcı Bulunamadı"); } } else if (b == 2) { Sessions.YetkiID = 2; //dt = DataSqlQuestion.GetYetki(b); kAdi = txtAdi.Text; Sifre = txtSifre.Text; dt = DataSqlQuestion.GetOgretmenKontrol(kAdi, Sifre); if (dt.Rows.Count > 0) { Sessions.KullaniciID = dt.Rows[0]["OgretmenID"].ToInt32(); FrmOgretmenEkran Frm = new FrmOgretmenEkran(); Frm.Show(); this.Hide(); } else { MessageBox.Show("Kullanıcı Bulunamadı"); } } else { Sessions.YetkiID = 3; //dt = DataSqlQuestion.GetYetki(b); kAdi = txtAdi.Text; Sifre = txtSifre.Text; dt = DataSqlQuestion.GetOgrenciKontrol(kAdi, Sifre); if (dt.Rows.Count > 0) { Sessions.KullaniciID = dt.Rows[0]["OgrenciID"].ToInt32(); FrmOgrenciGiris Frm = new FrmOgrenciGiris(); Frm.Show(); this.Hide(); } else { MessageBox.Show("Kullanıcı Bulunamadı"); } } } }
//Kullanıcıdan girilen cevapların veritabanı ile karşılaştırılması void cevapgonder() { if (soruturu == 1) { dogruCevap = txtBosluk.Text; dt = DataSqlQuestion.BoslukDogruCevabiGonder(SoruID, dogruCevap); if (dt.Rows.Count > 0) { dogruCevap = dt.Rows[0]["BCevap"].ToString(); //sonuc(); MessageBox.Show("DOĞRU"); toplamPuan = toplamPuan + puan; } } else { if (radioA.Checked == true) { dogruCevap = txtA.Text; dt = DataSqlQuestion.DogruCevabiGonder(SoruID, dogruCevap); if (dt.Rows.Count > 0) { dogruCevap = dt.Rows[0]["Cevap"].ToString(); toplamPuan = toplamPuan + puan; MessageBox.Show("A DOĞRU"); } else { MessageBox.Show("Yanlışşş"); } //dt = DataSqlQuestion.SecenekliDogruCevabiGonder(SoruID, dogruCevap); //dogruCevap = (dt.Rows[0]["Cevap"].ToString()); //dogruCevap = txtA.Text; //DataSqlQuestion.SecenekliDogruCevabiGonder(SoruID, dogruCevap); //if (dogruCevap == txtA.Text) // MessageBox.Show("A DOĞRU"); //else // MessageBox.Show("Yanlıi"); //dogruCevap = txtA.Text; //MessageBox.Show("A DOĞRU"); } else if (radioB.Checked == true) { dogruCevap = txtB.Text; dt = DataSqlQuestion.DogruCevabiGonder(SoruID, dogruCevap); if (dt.Rows.Count > 0) { string dogrucevap = dt.Rows[0]["Cevap"].ToString(); //sonuc(); toplamPuan = toplamPuan + puan; MessageBox.Show("B DOĞRU"); } else { MessageBox.Show("Yanlışşş"); } } else if (radioC.Checked == true) { dogruCevap = txtC.Text; dt = DataSqlQuestion.DogruCevabiGonder(SoruID, dogruCevap); if (dt.Rows.Count > 0) { dogruCevap = dt.Rows[0]["Cevap"].ToString(); //sonuc(); toplamPuan = toplamPuan + puan; MessageBox.Show("C DOĞRU"); } else { MessageBox.Show("Yanlışşş"); } } else if (radioD.Checked == true) { dogruCevap = txtD.Text; dt = DataSqlQuestion.DogruCevabiGonder(SoruID, dogruCevap); if (dt.Rows.Count > 0) { string dogrucevap = dt.Rows[0]["Cevap"].ToString(); //sonuc(); toplamPuan = toplamPuan + puan; MessageBox.Show("D DOĞRU"); } else { MessageBox.Show("Yanlışşş"); } } else if (radioE.Checked == true) { dogruCevap = txtE.Text; dt = DataSqlQuestion.DogruCevabiGonder(SoruID, dogruCevap); if (dt.Rows.Count > 0) { string dogrucevap = dt.Rows[0]["Cevap"].ToString(); //sonuc(); toplamPuan = toplamPuan + puan; MessageBox.Show("E DOĞRU"); } else { MessageBox.Show("Yanlışşş"); } } } }
void Refresh() { gridContOturum.DataSource = DataSqlQuestion.GetOturumList(); }