public ContactPersonenViewModel()
 {
     ContactList = Contactperson.GetContactPersons();
     TypeList = ContactpersonType.GetTypes();
     AddControls = "Visible";
     EditControls = "Hidden";
     CloseVis = "Hidden";
     WindowHeight = 600;
     FormContact = new Contactperson();
     ContactTypeAdd = new ContactpersonType();
 }
Exemplo n.º 2
0
        void type_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
        {
            ContactpersonType type = sender as ContactpersonType;

            if (type.IsValid())
            {
                if (type.ID != null)
                {
                    try
                    {
                        if (!type.Update())
                        {
                            throw new Exception("Could not update contacttype");
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        MessageBox.Show("Kon contacttype niet updaten naar de database");
                    }
                }
                else
                {
                    try
                    {
                        if (!type.Insert())
                        {
                            throw new Exception("Could not insert contacttype");
                        }
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(ex.Message);
                        MessageBox.Show("Kon contacttype niet in de database steken");
                    }
                }
            }
        }
 private void TypeAddShow()
 {
     AddType = "Visible";
     ContactTypeAdd = new ContactpersonType();
 }
 private void EditTypeOpslaan()
 {
     ContactpersonType.EditType(SelectedType, ContactTypeAdd.Name);
     AddTypeVis = "Hidden";
     TypeList = ContactpersonType.GetTypes();
     ContactTypeAdd = new ContactpersonType();
 }
 private void ContactTypeToevoegen()
 {
     ContactpersonType.AddContact(ContactTypeAdd.Name);
     AddType = "Hidden";
     TypeList = ContactpersonType.GetTypes();
     ContactTypeAdd = new ContactpersonType();
 }
 private void AddTypeOpslaan()
 {
     ContactpersonType.AddContact(ContactTypeAdd.Name);
     AddTypeVis = "Hidden";
     TypeList = ContactpersonType.GetTypes();
     ContactTypeAdd = new ContactpersonType();
 }
 private void AddTypeControl()
 {
     AddTypeVis = "Visible";
     EditTypeKnop = "Hidden";
     AddTypeKnop = "Visible";
     ContactTypeAdd = new ContactpersonType();
 }
Exemplo n.º 8
0
 //Method om het type toe te voegen in de database
 private void AddContactpersonType()
 {
     int affected = ContactpersonType.AddContactPersonType(ContactpersonType);
     if (affected == 1)
     {
         ContactpersonTypes.Add(ContactpersonType);
         //ContactpersonTypes = ContactpersonType.GetContactpersonTypes();
         ContactpersonType = new ContactpersonType();
         int LastIndex = ContactpersonTypes.Count - 1;
         SelectedContactpersonType = ContactpersonTypes[LastIndex];
     }
 }
Exemplo n.º 9
0
 //Constructor, initialiseren van de properties
 public CTypesVM()
 {
     ContactpersonTypes = ContactpersonType.GetContactpersonTypes();
     SelectedContactpersonType = ContactpersonTypes[0];
     ContactpersonType = new ContactpersonType();
 }
Exemplo n.º 10
0
 //Method om de veranderingen aan het type naar de database te schrijven
 private void EditContactpersonType()
 {
     //Controle of het wel al bestaat
     if (SelectedContactpersonType.Id != null)
     {
         int affected = ContactpersonType.EditContactPersonType(SelectedContactpersonType);
         int index = ContactpersonTypes.IndexOf(SelectedContactpersonType);
         ContactpersonTypes.Add(ContactpersonType);
         //ContactpersonTypes = ContactpersonType.GetContactpersonTypes();
         SelectedContactpersonType = ContactpersonTypes[index];
         if (affected == 1)
         {
             Console.WriteLine("Succesvol aangepast in de database!");
             ModernDialog.ShowMessage("Het type is aangepast in de database.", "Aanpassen", MessageBoxButton.OK);
         }
     }
 }
Exemplo n.º 11
0
 public ContactpersonVM()
 {
     _contactpersonList     = Contactperson.GetContactpersons();
     _contactpersonTypeList = ContactpersonType.GetContactpersonTypes();
     SelectedContactperson  = new Contactperson();
 }