protected void CariKaydet(string cariKodu) { try { Cari cari = new Cari(); cari.Id = cariKodu; cari.CariIsim = cariKodu; cari.KayitTarih = DateTime.Now; cari.Sube = UserInfo.Sube; cari.CariTip = BulcariTip(); mngCari.BeginTransaction(); mngCari.Save(cari); } catch (Exception exc) { LogWrite.Write(exc); MessageBox.Show(exc.Message); } finally { try { mngCari.CommitTransaction(); } catch (Exception exc) { LogWrite.Write(exc); MessageBox.Show(exc.Message); } } }
void Kaydet() { try { if (string.IsNullOrEmpty(txtCariKodu.Text)) { MessageBox.Show("cari kodu boş olamaz"); txtCariKodu.Focus(); } Cari cari = mngCari.GetById(txtCariKodu.Text, false); if (cari == null) { cari = new Cari(); cari.KayitTarih = DateTime.Today; } cari.Id = txtCariKodu.Text; cari.CariIsim = txtCariIsim.Text; if (Char.IsDigit(txtTel.Text[1])) { cari.CariTel = txtTel.Text; } if (Char.IsDigit(txtCepTel.Text[1])) { cari.CepTel = txtCepTel.Text; } cari.CariAdres = txtCariAdres.Text; cari.CariTel = txtTel.Text; cari.CepTel = txtCepTel.Text; cari.VergiDairesi = txtVergiDairesi.Text; cari.VergiNumarasi = txtVergiNumarasi.Text; //if (rbAliciSatici.Checked) // cari.CariTip = "AS"; //else if (rbAlici.Checked) // cari.CariTip = "A"; //else // cari.CariTip = "S"; cari.CariTip = "A"; cari.Sube = UserInfo.Sube; mngCari.BeginTransaction(); cari = mngCari.Save(cari); if (this.Owner is frmDirekSatisVeresiye) { frmDirekSatisVeresiye frm = (frmDirekSatisVeresiye)this.Owner; frm.txtCariKodu.Text = cari.Id; } if (this.Owner is frmDirektSatis) { frmDirektSatis frm = (frmDirektSatis)this.Owner; frm.KasaCariKodu = cari.Id; frm.SatisYap = true; } this.Close(); } catch (Exception) { } finally { try { mngCari.CommitTransaction(); } catch (Exception exc) { MessageBox.Show(exc.Message); LogWrite.Write(exc); } } //finally { CommitTransaction(); } }