Ejemplo n.º 1
0
        private void SaveKunde()
        {
            if (IsEditingProcess == true)
            {
                SelectedKunde.VorName            = VorName;
                SelectedKunde.NachName           = NachName;
                SelectedKunde.Geburtsdatum       = Geburtsdatum;
                SelectedKunde.EMail              = EMail;
                SelectedKunde.Strasse            = Strasse;
                SelectedKunde.PLZ                = PLZ;
                SelectedKunde.Ort                = Ort;
                SelectedKunde.Land               = Land;
                SelectedKunde.IsBusinessCustomer = IsBusinessCustomer;
                SelectedKunde.IsVisible          = IsVisible;

                dh.UpdateCustomer(SelectedKunde);
                SelectedKunde    = null;
                IsEditingProcess = false;
            }
            else
            {
                SharedCity  customerCity = new SharedCity(PLZ, Ort);
                SharedKunde newCustomer  = new SharedKunde()
                {
                    KundenId           = Guid.NewGuid(),
                    VorName            = VorName,
                    NachName           = NachName,
                    Geburtsdatum       = Geburtsdatum,
                    EMail              = EMail,
                    Strasse            = Strasse,
                    PLZ                = PLZ,
                    Ort                = Ort,
                    Land               = Land,
                    IsBusinessCustomer = IsBusinessCustomer,
                    IsVisible          = IsVisible,
                    Passwort           = Passwort
                };

                if (IsBusinessCustomer == true && UID != null)
                {
                    dh.AddBusinessCustomer(newCustomer, UID);
                }
                else
                {
                    dh.AddCusomter(newCustomer);
                }
            }

            RefreshCustomers();

            VorName            = "";
            NachName           = "";
            Geburtsdatum       = DateTime.MinValue;
            EMail              = "";
            Strasse            = "";
            PLZ                = 0;
            Ort                = "";
            Land               = "";
            Passwort           = "";
            IsVisible          = false;
            IsBusinessCustomer = false;
            UID                = "";
        }