private void FillGrid() { getBusineesLayer = new BusinessLayer(); var list = getBusineesLayer.GetAll(); gcListe.DataSource = list; }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> #region Buton click olayları private void btnSave_Click(object sender, EventArgs e) { try { if (!FormControl()) { return; } getData = new Model() { ID = _Id, CARIKOD = eCariKod.Text, CARIISIM = eCariIsim.Text, ADRES = eAdres.Text, IL = eIl.Text, ILCE = eIlce.Text, ULKEKODU = eUlkeKodu1.Text, TELEFON = eTelefon.Text, FAX = eFax.Text, VERGIDAIRESI = ddVergiDairesi.Text, VERGINO = eVergiNo.Text, TCNO = eTCno.Text, POSTAKODU = ePostaKodu.Text, TIP = rgTip.SelectedIndex == -1 ? 0 : rgTip.SelectedIndex + 1, EMAIL = eEmail.Text, WEBADRESI = eWebAdresi.Text }; if (_Id == 0) { getBusineesLayer = new BusinessLayer(); getBusineesLayer.Save(getData); MessageBox.Show("Kayıt başarılı"); } else { getBusineesLayer = new BusinessLayer(); getBusineesLayer.Update(getData); MessageBox.Show("Güncelleme başarılı"); } } catch (Exception ex) { throw new Exception(ex.Message.ToString()); } FillGrid(); }
private void btnDelete_Click(object sender, EventArgs e) { try { getData = new Model() //silinecek veri { ID = _Id }; getBusineesLayer = new BusinessLayer(); getBusineesLayer.Delete(getData); Temizle(); MessageBox.Show("Silme işlemi başarılı"); } catch (Exception ex) { throw new Exception(ex.Message.ToString());; } FillGrid(); //listeyi günceller }