public StokGC aramaPenceresi(int evraktip) { frm_Arama arama = new frm_Arama(); StokGC sKayit = null; SqlDb db = new SqlDb(cls_settings.connectionString); arama.grdListe.DataSource = GetAll(evraktip); for (int i = 0; i < arama.grdvListe.Columns.Count; i++) { arama.grdvListe.Columns[i].Visible = false; } arama.grdvListe.Columns["StokGCTarih"].Visible = true; arama.grdvListe.Columns["StokGCEvrakNo"].Visible = true; arama.grdvListe.Columns["StokGCMusteriKodu"].Visible = true; arama.grdvListe.Columns["StokGCTarih"].Caption = "TARİH"; arama.grdvListe.Columns["StokGCEvrakNo"].Caption = "EVRAK NO"; arama.grdvListe.Columns["StokGCMusteriKodu"].Caption = "MÜŞTERİ KODU"; arama.Text = "EVRAK LİSTESİ"; if (arama.ShowDialog() == DialogResult.OK) { sKayit = EvrakSatirGetir(arama.kayitNo); } return(sKayit); }
private void btnSira_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e) { StokGC kayit = cls.aramaPenceresi(_GirisCikis); if (kayit != null) { btnSira.Text = kayit.StokGCEvrakNo.ToString(); } }
public StokGC EvrakSatirGetir(int kayitNo) { try { SqlDb db = new SqlDb(cls_settings.connectionString); StokGC kayit = db.StokGCs.SingleOrDefault(S => S.StokGCKayitNo == kayitNo); return(kayit); } catch (Exception ex) { MessageBox.Show("Hata oluştu: " + ex.Message, "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error); return(null); } }
private void grdEvrakView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (e.FocusedRowHandle == grdEvrakView.RowCount - 2 || grdEvrakView.RowCount <= 1) { StokGC kayit = new StokGC(); kayit.StokGCTipi = _GirisCikis; kayit.StokGCEvrakNo = Convert.ToInt32(btnSira.Text); kayit.StokGCTarih = dtETarih.DateTime.Date; kayit.StokGCMusteriKodu = btnMusteriKod.Text; kayit.StokGCMusteriAdresNo = Convert.ToInt32(btnAdresNo.Text); kayit.StokGCSatirNo = grdEvrakView.RowCount - 1; EvrakKayit.Add(kayit); grdEvrak.DataSource = EvrakKayit; grdEvrak.RefreshDataSource(); } }
public void EvrakKaydet(StokGC Gelenkayit) { try { SqlDb db = new SqlDb(cls_settings.connectionString); if (Gelenkayit.StokGCKayitNo > 0) { db.StokGCs.Attach(Gelenkayit, true); } else { db.StokGCs.InsertOnSubmit(Gelenkayit); } db.SubmitChanges(); } catch (Exception ex) { MessageBox.Show("Hata oluştu: " + ex.Message, "Dikkat", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
partial void DeleteStokGC(StokGC instance);
partial void UpdateStokGC(StokGC instance);
partial void InsertStokGC(StokGC instance);
void GridDoldur(int sira, int evraktip) { EvrakKayit = new List <StokGC>(); grdEvrak.DataSource = EvrakKayit; grdEvrak.RefreshDataSource(); StokGC kayit = cls.EvrakSatirGetir(sira, evraktip, 0); if (kayit != null) { tabloOnay = true; yeniEvrak = false; dtETarih.DateTime = Convert.ToDateTime(kayit.StokGCTarih); btnMusteriKod.Text = kayit.StokGCMusteriKodu; Musteriler musteri = clsMusteri.Get(kayit.StokGCMusteriKodu); if (musteri != null) { btnMusteriUnvani.Text = musteri.MusteriUnvani; } btnAdresNo.Text = kayit.StokGCMusteriAdresNo.ToString(); } EvrakKayit = cls.EvrakGetir(sira, evraktip); grdEvrak.DataSource = EvrakKayit; for (int i = 0; i < grdEvrakView.Columns.Count; i++) { grdEvrakView.Columns[i].Visible = false; } grdEvrakView.Columns["StokGCStokKodu"].Caption = "Stok Kodu"; grdEvrakView.Columns["StokGCStokKodu"].Visible = true; grdEvrakView.Columns["StokGCStokKodu"].Width = 150; DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit StokKodColumn = new DevExpress.XtraEditors.Repository.RepositoryItemButtonEdit(); StokKodColumn.ButtonClick += new DevExpress.XtraEditors.Controls.ButtonPressedEventHandler(StokKodColumn_ButtonClick); StokKodColumn.Validating += new CancelEventHandler(StokKodColumn_Validating); grdEvrakView.Columns["StokGCStokKodu"].ColumnEdit = StokKodColumn; grdEvrakView.Columns["StokGCStokKodu"].ColumnEdit.Validating += new CancelEventHandler(StokKodColumn_Validating); grdEvrakView.Columns["StokGCStokMiktari"].Caption = "Miktar"; grdEvrakView.Columns["StokGCStokMiktari"].Visible = true; grdEvrakView.Columns["StokGCStokMiktari"].Width = 150; DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit spnMiktar = new DevExpress.XtraEditors.Repository.RepositoryItemSpinEdit(); spnMiktar.NullText = "0"; spnMiktar.MinValue = 0; grdEvrakView.Columns["StokGCStokMiktari"].ColumnEdit = spnMiktar; grdEvrakView.Columns["StokGCStokMiktari"].ColumnEdit.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; grdEvrakView.Columns["StokGCStokMiktari"].ColumnEdit.DisplayFormat.FormatString = "n2"; grdEvrakView.Columns["StokGCStokFiyati"].Caption = "Birim Fiyat"; grdEvrakView.Columns["StokGCStokFiyati"].Visible = true; grdEvrakView.Columns["StokGCStokFiyati"].Width = 150; grdEvrakView.Columns["StokGCStokFiyati"].ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemCalcEdit(); grdEvrakView.Columns["StokGCStokFiyati"].ColumnEdit.NullText = "0"; grdEvrakView.Columns["StokGCStokFiyati"].ColumnEdit.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; grdEvrakView.Columns["StokGCStokFiyati"].ColumnEdit.DisplayFormat.FormatString = "n2"; grdEvrakView.Columns["StokGCStokFiyati"].ColumnEdit.ReadOnly = true; grdEvrakView.Columns["StokGCStokFiyati"].ColumnEdit = StokKodColumn; grdEvrakView.Columns["StokGCStokTutar"].Caption = "Tutar"; grdEvrakView.Columns["StokGCStokTutar"].Visible = true; grdEvrakView.Columns["StokGCStokTutar"].Width = 150; grdEvrakView.Columns["StokGCStokTutar"].ColumnEdit = new DevExpress.XtraEditors.Repository.RepositoryItemCalcEdit(); grdEvrakView.Columns["StokGCStokTutar"].ColumnEdit.NullText = "0"; grdEvrakView.Columns["StokGCStokTutar"].ColumnEdit.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric; grdEvrakView.Columns["StokGCStokTutar"].ColumnEdit.DisplayFormat.FormatString = "n2"; grdEvrakView.Columns["StokGCStokTutar"].ColumnEdit.ReadOnly = true; grdEvrakView.Columns["StokGCStokKodu"].VisibleIndex = 0; grdEvrakView.Columns["StokGCStokMiktari"].VisibleIndex = 1; grdEvrakView.Columns["StokGCStokFiyati"].VisibleIndex = 2; grdEvrakView.Columns["StokGCStokTutar"].VisibleIndex = 3; grdEvrak.RefreshDataSource(); TutarHesapla(); }