Exemple #1
0
        public void openCopyDialog()
        {
            if (SelectedKontakt != null)
            {
                int eValue = (int)SelectedKontakt.Sex;
                EditCreateWindow editCreateWindow = new EditCreateWindow("Kopieren eines Kontaktes", SelectedKontakt.DisplayName, SelectedKontakt.Surname, SelectedKontakt.Name, SelectedKontakt.Title, SelectedKontakt.Address.Street, SelectedKontakt.Address.HouseNoumber, SelectedKontakt.Address.PostalCode, SelectedKontakt.Address.City, SelectedKontakt.Address.EMail, SelectedKontakt.Address.MobileNr, SelectedKontakt.Address.PhoneNr, SelectedKontakt.Address.FaxNr, SelectedKontakt.Address1.Street, SelectedKontakt.Address1.HouseNoumber, SelectedKontakt.Address1.PostalCode, SelectedKontakt.Address1.City, SelectedKontakt.Address1.EMail, SelectedKontakt.Address1.MobileNr, SelectedKontakt.Address1.PhoneNr, SelectedKontakt.Address1.FaxNr, SelectedKontakt.Address2.Street, SelectedKontakt.Address2.HouseNoumber, SelectedKontakt.Address2.PostalCode, SelectedKontakt.Address2.City, SelectedKontakt.Address2.EMail, SelectedKontakt.Address2.MobileNr, SelectedKontakt.Address2.PhoneNr, SelectedKontakt.Address2.FaxNr);
                editCreateWindow.CBSex.SelectedIndex = eValue;

                if (editCreateWindow.ShowDialog() == true)
                {
                    var check = Kontakte.SingleOrDefault(i => i.DisplayName == editCreateWindow.tbDisplayName.Text);
                    if (check == null)
                    {
                        Kontakte.Add(new Kontakt()
                        {
                            Sex = (Sex)Enum.Parse(typeof(Sex), editCreateWindow.CBSex.Text), DisplayName = editCreateWindow.tbDisplayName.Text, Surname = editCreateWindow.tbSurName.Text, Name = editCreateWindow.tbName.Text, Title = editCreateWindow.tbTitle.Text, Address = new Address {
                                City = editCreateWindow.tbCity.Text, HouseNoumber = editCreateWindow.tbHouseNumber.Text, PostalCode = editCreateWindow.tbPostalCode.Text, Street = editCreateWindow.tbStreet.Text, EMail = editCreateWindow.tbEmail.Text, MobileNr = editCreateWindow.tbMobileNr.Text, PhoneNr = editCreateWindow.tbPhoneNr.Text, FaxNr = editCreateWindow.tbFaxNr.Text
                            }, Address1 = new Address {
                                City = editCreateWindow.tbCity1.Text, HouseNoumber = editCreateWindow.tbHouseNumber1.Text, PostalCode = editCreateWindow.tbPostalCode1.Text, Street = editCreateWindow.tbStreet1.Text, EMail = editCreateWindow.tbEmail1.Text, MobileNr = editCreateWindow.tbMobileNr1.Text, PhoneNr = editCreateWindow.tbPhoneNr1.Text, FaxNr = editCreateWindow.tbFaxNr1.Text
                            }, Address2 = new Address {
                                City = editCreateWindow.tbCity2.Text, HouseNoumber = editCreateWindow.tbHouseNumber2.Text, PostalCode = editCreateWindow.tbPostalCode2.Text, Street = editCreateWindow.tbStreet2.Text, EMail = editCreateWindow.tbEmail2.Text, MobileNr = editCreateWindow.tbMobileNr2.Text, PhoneNr = editCreateWindow.tbPhoneNr2.Text, FaxNr = editCreateWindow.tbFaxNr2.Text
                            }
                        });
                    }
                    else
                    {
                        MessageBox.Show("Es dürfen keine zwei Kontakte mit dem Gleichen Anzeigenamen existieren");
                    }
                }
            }
            else
            {
                MessageBox.Show("Wählen sie einen Kontakt aus");
            }
        }
Exemple #2
0
        public void openCreateDialog()
        {
            EditCreateWindow editCreateWindow = new EditCreateWindow("Hinzufügen eines Kontaktes");

            if (editCreateWindow.ShowDialog() == true)
            {
                var check = Kontakte.SingleOrDefault(i => i.DisplayName == editCreateWindow.tbDisplayName.Text);
                if (check == null)
                {
                    Kontakte.Add(new Kontakt()
                    {
                        Sex = (Sex)Enum.Parse(typeof(Sex), editCreateWindow.CBSex.Text), DisplayName = editCreateWindow.tbDisplayName.Text, Surname = editCreateWindow.tbSurName.Text, Name = editCreateWindow.tbName.Text, Title = editCreateWindow.tbTitle.Text, Address = new Address {
                            City = editCreateWindow.tbCity.Text, HouseNoumber = editCreateWindow.tbHouseNumber.Text, PostalCode = editCreateWindow.tbPostalCode.Text, Street = editCreateWindow.tbStreet.Text, EMail = editCreateWindow.tbEmail.Text, MobileNr = editCreateWindow.tbMobileNr.Text, PhoneNr = editCreateWindow.tbPhoneNr.Text, FaxNr = editCreateWindow.tbFaxNr.Text
                        }, Address1 = new Address {
                            City = editCreateWindow.tbCity1.Text, HouseNoumber = editCreateWindow.tbHouseNumber1.Text, PostalCode = editCreateWindow.tbPostalCode1.Text, Street = editCreateWindow.tbStreet1.Text, EMail = editCreateWindow.tbEmail1.Text, MobileNr = editCreateWindow.tbMobileNr1.Text, PhoneNr = editCreateWindow.tbPhoneNr1.Text, FaxNr = editCreateWindow.tbFaxNr1.Text
                        }, Address2 = new Address {
                            City = editCreateWindow.tbCity2.Text, HouseNoumber = editCreateWindow.tbHouseNumber2.Text, PostalCode = editCreateWindow.tbPostalCode2.Text, Street = editCreateWindow.tbStreet2.Text, EMail = editCreateWindow.tbEmail2.Text, MobileNr = editCreateWindow.tbMobileNr2.Text, PhoneNr = editCreateWindow.tbPhoneNr2.Text, FaxNr = editCreateWindow.tbFaxNr2.Text
                        }
                    });
                }
                else
                {
                    MessageBox.Show("Es dürfen keine zwei Kontakte mit dem Gleichen Anzeigenamen existieren");
                }
            }
        }