示例#1
0
        private void dgvKunden_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Kunde lKunde = CurrentKunde;

            if (lKunde != null)
            {
                using (FormEditKunde tEditKunde = new FormEditKunde(lKunde))
                {
                    DialogResult lResult = tEditKunde.ShowDialog();
                    if (lResult == DialogResult.OK)
                    {
                        if (tEditKunde.Kunde == null)
                        {
                            _Database.Kunden.Remove(tEditKunde.Kunde);
                        }
                        else
                        {
                            _Database.Kunden.Remove(tEditKunde.Kunde);
                            _Database.Kunden.Add(tEditKunde.Kunde);
                        }
                        _Changed = true;
                        RefreshView();
                    }
                }
            }
        }
示例#2
0
 private void btnNew_Click(object sender, System.EventArgs e)
 {
     using (FormEditKunde tEditKunde = new FormEditKunde())
     {
         DialogResult lResult = tEditKunde.ShowDialog();
         if (lResult == DialogResult.OK)
         {
             tEditKunde.Kunde.Id = _Database.LastKundenID() + 1;
             _Database.Kunden.Add(tEditKunde.Kunde);
             _Changed = true;
             RefreshView();
         }
     }
 }