void CariTabKalemSil() { DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (re == DialogResult.Yes) { try { if (_selectedCahar != null) { CariHareket cahar = mngCariHar.GetById(_selectedCahar.Value, true); BeginTransaction(); mngCariHar.Delete(cahar); KasaHareket kasahar = mngKasaHar.GetById(_selectedKasaHar.Value, true); mngKasaHar.Delete(kasahar); DataGridViewRow dr = dataGridViewCari.SelectedRows[0]; dataGridViewCari.Rows.Remove(dr);; YeniCariTabKalem(); SetKasaGenelGider(); } } catch (Exception) { } finally { try { CommitTransaction(); } catch (Exception exc) { MessageBox.Show(exc.Message); LogWrite.Write(exc); } } } }
public void KasaHareketSil(int cekSenetId, KasaHarTip kasaTip) { bool isBegin = false; try { KasaHareket har = _mngKasaHar.GetByTipAndCekOrSenetId(UserInfo.Sube.Id , kasaTip, cekSenetId); if (har != null) { isBegin = true; _mngKasaHar.BeginTransaction(); _mngKasaHar.Delete(har); } } catch (Exception) { } finally { try { if (isBegin) { _mngKasaHar.CommitTransaction(); } } catch (Exception exc) { MessageBox.Show(exc.Message); LogWrite.Write(exc); } } }
private void btnSil_Click(object sender, EventArgs e) { DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (re == DialogResult.Yes) { try { DataGridViewRow dr = dataGridViewSenet.SelectedRows[0]; if (dr != null) { string subeKodu = UserInfo.Sube.Id; Senet senet = _mngSenet.SingleOrDefault <Senet>(x => x.Id == int.Parse(dr.Cells[clId.Name].Value.ToString())); CariHarTuru tur = senet.SenetTip == SenetTip.Alinan ? CariHarTuru.AlinanSenet : CariHarTuru.VerilenCek; CariHareket cahar = _mngCariHar.GetByCekOrSenetIdAndHareketTuruAndCariKod(UserInfo.Sube.Id, senet.Id, tur, senet.CariKodu); HesapHareket hesap = _mngHesapHar.GetByCekOrSenetIdAndHareketTuru(subeKodu, senet.Id, HesapHareketTuru.SenetTahsil); KasaHareket kasahar = _mngKasaHar.GetByTipAndCekOrSenetId(subeKodu , KasaHarTip.Senet, senet.Id); BeginTransaction(); if (hesap != null) { _mngHesapHar.Delete(hesap); } if (kasahar != null) { _mngKasaHar.Delete(kasahar); } _mngSenet.Delete(senet); _mngCariHar.Delete(cahar); } } catch (Exception exc) { LogWrite.Write(exc); MessageBox.Show(exc.Message); } finally { try { CommitTransaction(); LoadGrid(); } catch (Exception exc) { MessageBox.Show(exc.Message); LogWrite.Write(exc); } } } }
void KayitSil() { DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (re == DialogResult.Yes && _hareketId != null) { try { BeginTransaction(); if (_hareketTuru == HesapHareketTuru.ParaCekme || _hareketTuru == HesapHareketTuru.ParaYatirma) { KasaHareket kasahar = mngKasaHar.GetById(_kasaHarId.Value, false); mngKasaHar.Delete(kasahar); } else { CariHareket ch = mngCariHar.GetById(_cariHarId.Value, true); mngCariHar.Delete(ch); } HesapHareket hh = mngHesap.GetById(_hareketId.Value, true); mngHesap.Delete(hh); DataGridViewRow dr = dataGridView1.SelectedRows[0]; dataGridView1.Rows.Remove(dr);; YeniKayit(); } catch (Exception exc) { LogWrite.Write(exc); MessageBox.Show(exc.Message); } finally { try { CommitTransaction(); } catch (Exception exc) { LogWrite.Write(exc); MessageBox.Show(exc.Message); } } } }