Exemple #1
0
 void SetData()
 {
     try {
         OzelGelirGider ozel = _mngOzel.GetById(_kod, false);
         txtKod.Text      = ozel.Id;
         txtIsim.Text     = ozel.Ismi;
         txtKdvOrani.Text = ozel.KdvOrani.GetValueOrDefault().ToString();
         txtIsim.Focus();
         txtKod.Enabled = false;
     } catch (Exception exc) {
         MessageBox.Show(exc.Message);
         LogWrite.Write(exc);
     }
 }
Exemple #2
0
 private void btnSil_Click(object sender, EventArgs e)
 {
     try {
         DialogResult re = MessageBox.Show("Kayıt Silinsin mi?", "Dikkat", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
         if (re == DialogResult.Yes)
         {
             DataGridViewRow dr   = dataGridView1.CurrentRow;
             string          kod  = dr.Cells[clId.Name].Value.ToStringOrEmpty();
             OzelGelirGider  ozel = _mngOzelGelirGider.GetById(kod, false);
             if (ozel != null)
             {
                 _mngOzelGelirGider.BeginTransaction();
                 _mngOzelGelirGider.Delete(ozel);
                 _mngOzelGelirGider.CommitTransaction();
                 LoadGrid();
             }
         }
     } catch (Exception exc) {
         MessageBox.Show(exc.Message);
         LogWrite.Write(exc);
     }
 }
Exemple #3
0
        void Kaydet()
        {
            try {
                OzelGelirGider ozel = null;
                if (!string.IsNullOrEmpty(_kod))
                {
                    ozel = _mngOzel.GetById(_kod, false);
                }
                else
                {
                    ozel    = new OzelGelirGider();
                    ozel.Id = txtKod.Text;
                }
                if (ozel == null)
                {
                    ozel    = new OzelGelirGider();
                    ozel.Id = txtKod.Text;
                }
                ozel.Ismi       = txtIsim.Text;
                ozel.KdvOrani   = txtKdvOrani.Text.ParseNullable <double>(x => double.Parse(x));
                ozel.GelirGider = _gelirGider;
                _mngOzel.BeginTransaction();
                _mngOzel.SaveOrUpdate(ozel);

                this.Close();
            } catch (Exception exc) {
                MessageBox.Show(exc.Message);
                LogWrite.Write(exc);
            } finally {
                try {
                    _mngOzel.CommitTransaction();
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }