コード例 #1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listBoxContactPersonNames.SelectedIndex == -1)
            {
                MessageBox.Show("please Select an entry first");
            }

            else if (listBoxContactPersonNames.SelectedIndex >= 0)
            {
                int index = listBoxContactPersonNames.SelectedIndex;
                var form  = new FormContactPersonDetails(Dc, _cEdit.ContactPersons[index]);
                form.ShowDialog();

                RefreshListboxservice();
                RefreshListboxContact();
            }
        }
コード例 #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            Person newP = new Person();

            newP.Id = Person.SetNextFreeId(_allPersons);

            int index = _cEdit.ContactPersons.Count - 1;
            var form  = new FormContactPersonDetails(Dc, newP);

            form.ShowDialog();

            if (!newP.IsEmpty())
            {
                _cEdit.ContactPersons.Add(newP);
                _allPersons.Add(newP);
                RefreshListboxContact();
            }
        }