private void SelectionChanged(ContactTypeVM contacttypevm)
        {
            if (SelectedType == null) return;
            if (ShowCancel == "Visible") CancelUpdateContactType(this);
            _oldType = SelectedType.Copy();

            contacttypevm.ShowEdit = "Visible";
            contacttypevm.ShowCancel = "Hidden";
            contacttypevm.ShowSave = "Hidden";
            Enabled = false;
        }
        private void SaveUpdateContactType(ContactTypeVM contacttypevm)
        {
            if (!SelectedType.IsValid())
                return;
            // Save Changes
            if (_oldType == null)
            {
                // Insert into db
                SelectedType.ID = ContactpersonType.AddContactpersonType(SelectedType);
            }
            else
            {
                // Update db
                ContactpersonType.UpdateContactpersonType(SelectedType);
            }

            // Update GUI
            contacttypevm.ShowEdit = "Visible";
            contacttypevm.ShowCancel = "Hidden";
            contacttypevm.ShowSave = "Hidden";
            Enabled = false;
        }
 private void EditContactType(ContactTypeVM contacttypevm)
 {
     contacttypevm.ShowEdit = "Hidden";
     contacttypevm.ShowCancel = "Visible";
     contacttypevm.ShowSave = "Visible";
     contacttypevm.Enabled = true;
 }
        private void DeleteContactType(ContactTypeVM contacttypevm)
        {
            if (SelectedType == null) return;

            ContactpersonType.DeleteContactpersonType(SelectedType);

            SelectedType = new ContactpersonType();
            Enabled = true;
            ShowEdit = "Hidden";
            ShowCancel = "Hidden";
            ShowSave = "Visible";
        }
        private void CancelUpdateContactType(ContactTypeVM contacttypevm)
        {
            // Reset person
            _changeNotify = false;
            SelectedType = _oldType;

            contacttypevm.ShowEdit = "Visible";
            contacttypevm.ShowCancel = "Hidden";
            contacttypevm.ShowSave = "Hidden";
            Enabled = false;
        }
 private void AddContactType(ContactTypeVM contacttypevm)
 {
     SelectedType = new ContactpersonType();
     _oldType = null;
     contacttypevm.ShowEdit = "Hidden";
     contacttypevm.ShowCancel = "Visible";
     contacttypevm.ShowSave = "Visible";
     contacttypevm.Enabled = true;
 }