Esempio n. 1
0
        void KayitSil()
        {
            try {
                DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                if (re == DialogResult.Yes)
                {
                    ListViewItem item     = listView1.SelectedItems[0];
                    string       stokKodu = item.SubItems[clStokKodu.DisplayIndex].Text;
                    if (string.IsNullOrEmpty(stokKodu))
                    {
                        MessageBox.Show("stok seçiniz");
                        return;
                    }
                    Stok stok = managerStk.GetById(stokKodu, true);
                    managerStk.BeginTransaction();
                    managerStk.Delete(stok);
                    managerStk.CommitTransaction();

                    LoadStok();
                }
            } catch (Exception exc) {
                LogWrite.Write(exc);
                MessageBox.Show(exc.Message);
            }
        }
Esempio n. 2
0
        void KayitSil()
        {
            DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

            if (re == DialogResult.Yes)
            {
                try {
                    Stok stok = managerStk.GetById(txtStokKodu.Text, true);
                    managerStk.BeginTransaction();
                    managerStk.Delete(stok);
                    YeniKayit();
                } catch (Exception) {
                } finally {
                    try {
                        managerStk.CommitTransaction();
                    } catch (Exception exc) {
                        MessageBox.Show(exc.Message);
                        LogWrite.Write(exc);
                    }
                }
            }
        }