private void olustur_btn_Click(object sender, EventArgs e) { sesCalmaClassBLL.PlayClickSound(); konuBLL = new KonuBLL(); konuAnlatimiBLL = new KonuAnlatimiBLL(); int grammarSayisi = konuAnlatimiBLL.GetAllByExpression(x => x.Grammar_KonuId == (int)konuSecme_cmb.SelectedValue).Count; konuBLL = new KonuBLL() { GuncellenecekKonuId = (int)konuSecme_cmb.SelectedValue, GrammarSayisi = grammarSayisi + 1 }; konuAnlatimiBLL = new KonuAnlatimiBLL() { Icerik = icerik_txt.Text, KonuId = (int)konuSecme_cmb.SelectedValue, ResimYolu = resimYolu }; bool basariliMi = konuAnlatimiBLL.AddData(); string dosyaIsmi = konuBLL.GetDataByExpression(x => x.Id == (int)konuSecme_cmb.SelectedValue).Konu_Ismi + "_" + konuAnlatimiBLL.GetAllByExpression().Last().Id; if (openDoluMu) { resimYolu = konuAnlatimiBLL.AddPicture(open.FileName, (int)konuSecme_cmb.SelectedValue, dosyaIsmi); } konuAnlatimiBLL = new KonuAnlatimiBLL() { Icerik = icerik_txt.Text, KonuId = (int)konuSecme_cmb.SelectedValue, ResimYolu = resimYolu, GuncellenecekKonuAnlatimiId = konuAnlatimiBLL.GetAllByExpression().Last().Id }; if (konuAnlatimiBLL.UpdateData() && konuBLL.UpdateData() && basariliMi) { MessageBox.Show("başarılı"); } else { MessageBox.Show("başarısız"); } }
private void TesteSoruEklemeFrm_Closing(object sender, EventArgs e) { sesCalmaClassBLL.PlayClickSound(); this.Show(); soruBLL = new SoruBLL(); konuBLL = new KonuBLL(); SoruIdler = testeSoruEklemeFrm.SoruIdler; List <int> soruKonuIdler = new List <int>(); List <string> konuIsimler = new List <string>(); int f = 0; int g = 0; int y = 0; for (int i = 0; i < SoruIdler.Count; i++) { f = SoruIdler[i]; soruKonuIdler.Add(soruBLL.GetDataByExpression(x => x.Id == f).Soru_KonuId); g = soruKonuIdler[i]; konuIsimler.Add(konuBLL.GetDataByExpression(x => x.Id == g).Konu_Ismi); } for (int i = 0; i < SoruIdler.Count; i++) { y = SoruIdler[i]; eklenenSoruUC = new EklenenSoruUC(); eklenenSoruUC.konu_lbl.Text = konuIsimler[i]; eklenenSoruUC.KonuId = soruKonuIdler[i]; eklenenSoruUC.Icerik = soruBLL.GetDataByExpression(x => x.Id == y).Soru_Icerik; eklenenSoruUC.SinavId = soruBLL.GetDataByExpression(x => x.Id == y).Soru_SinavId; eklenenSoruUC.soruSirasi_lbl.Text = (testEkleUC.eklenenSorular_flwpnl.Controls.Count + 1).ToString(); eklenenSoruUC.ozellikler_btn.Visible = true; eklenenSoruUC.sil_btn.Visible = true; testEkleUC.eklenenSorular_flwpnl.Controls.Add(eklenenSoruUC); } }