public frmStokListe(FTIRSIP ftirsip, string fisNo)
 {
     InitializeComponent();
     mngFac     = new ManagerFactory(Engine.GetConString(), Engine.GetSqlServerType());
     mngStokHar = mngFac.GetStokHareketManager();
     try {
         dataGridView1.AutoGenerateColumns = false;
         IList <StokHarRpr> rpr = mngStokHar.GetByFisNoAndSubeKodu(fisNo, UserInfo.Sube.Id, ftirsip);
         dataGridView1.DataSource = rpr;
         dataGridView1.Columns[clTutar.Name].DefaultCellStyle.Format = "F2";
     } catch (Exception exc) {
         MessageBox.Show(exc.Message);
         LogWrite.Write(exc);
     }
 }
        void KalemKaydet()
        {
            bool isBegin = false;

            try
            {
                StokHareket sh = null;
                if (_selectedStokHarId != null)
                {
                    sh = mngSth.GetById(_selectedStokHarId.Value, false);
                }
                if (sh == null)
                {
                    sh = new StokHareket();
                }
                if (_currentStok == null)
                {
                    _currentStok = mngStk.GetBySubeAndBarkod1(UserInfo.Sube.Id, txtBarkod.Text);
                }
                if (_currentStok == null)
                {
                    _currentStok = mngStk.GetById(txtBarkod.Text, false);
                }

                if (_currentStok == null)
                {
                    return;
                }
                sh.Stok          = _currentStok;
                sh.BirimFiyat    = txtSatisFiyat.Text.ParseNullable <double>(x => double.Parse(x));
                sh.HareketBirim  = _currentStok.AnaBirim;
                sh.HareketMiktar = txtMiktar.Text.ParseStruct <double>(x => double.Parse(x));
                sh.GCMiktar      = txtMiktar.Text.ParseStruct <double>(x => double.Parse(x));
                sh.StharGckod    = StokHareket.DetermineGCKodu(FTIRSIP.SatisFat);
                sh.StharHtur     = StokHareket.DetermineHarTur(FatNoTip.Fatura);
                sh.FTIRSIP       = FTIRSIP.DirektSatis;
                sh.Tarih         = DateTime.Today;
                sh.Sube          = UserInfo.Sube;
                sh.FisNo         = _fisNo;
                sh.DirektSatis   = "E";
                sh.Kdv           = _currentStok.SatisKdvOrani;
                isBegin          = true;
                mngSth.BeginTransaction();
                mngSth.SaveOrUpdate(sh);

                listeStok = mngSth.GetByFisNoAndSubeKodu(_fisNo, UserInfo.Sube.Id, FTIRSIP.DirektSatis);
                YeniKalem();
                LoadGrid();

                txtMiktar.Text = "1";
            }
            catch (Exception)
            {
            } finally {
                try {
                    if (isBegin)
                    {
                        mngSth.CommitTransaction();
                    }
                } catch (Exception exc) {
                    MessageBox.Show(exc.Message);
                    LogWrite.Write(exc);
                }
            }
        }