private void resimEkle_btn_Click(object sender, EventArgs e) { sesCalmaClassBLL.PlayClickSound(); open = new OpenFileDialog(); open.Filter = "Image Files(*.jpeg;*.bmp;*.png;*.jpg)|*.jpeg;*.bmp;*.png;*.jpg"; konuAnlatimiBLL = new KonuAnlatimiBLL(); openDoluMu = open.ShowDialog() == DialogResult.OK; }
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"); } }