void OnZuordnenOhneAlternative(string guid)
        {
            var item       = OhneAlternative.First(teil => teil.Guid == guid);
            var komponente = VergleichsListe.First(teil => teil.Guid == guid);

            if (item != null && komponente != null && SelectedKomponente != null)
            {
                komponente.AlternativeHersteller   = SelectedKomponente.AlternativeHersteller;
                komponente.AlternativeBeschreibung = SelectedKomponente.AlternativeBeschreibung;
                komponente.AlternativeGroesse      = SelectedKomponente.AlternativeGroesse;
                komponente.AlternativeJahr         = SelectedKomponente.AlternativeJahr;
                komponente.AlternativeGewicht      = SelectedKomponente.AlternativeGewicht;
                komponente.AlternativeVorhanden    = true;

                OhneAlternative.Remove(item);

                var ohneZuordnung = OhneKomponente.First(teil => teil.Guid == SelectedKomponente.Guid);
                if (ohneZuordnung != null)
                {
                    OhneKomponente.Remove(ohneZuordnung);
                }

                VergleichsListe.Remove(SelectedKomponente);
                SelectedKomponente = VergleichsListe.First(teil => teil.Guid == guid);
            }
        }
        void OnZuordnenOhneKomponente(string guid)
        {
            var item       = OhneKomponente.First(teil => teil.Guid == guid);
            var komponente = VergleichsListe.First(teil => teil.Guid == guid);

            if (item != null && komponente != null && SelectedKomponente != null)
            {
                SelectedKomponente.AlternativeHersteller   = komponente.AlternativeHersteller;
                SelectedKomponente.AlternativeBeschreibung = komponente.AlternativeBeschreibung;
                SelectedKomponente.AlternativeGroesse      = komponente.AlternativeGroesse;
                SelectedKomponente.AlternativeJahr         = komponente.AlternativeJahr;
                SelectedKomponente.AlternativeGewicht      = komponente.AlternativeGewicht;
                SelectedKomponente.AlternativeVorhanden    = true;

                if (AlternativeBearbeiten)
                {
                    NeuerHersteller  = komponente.AlternativeHersteller;
                    NeueBeschreibung = komponente.AlternativeBeschreibung;
                    NeueGroesse      = komponente.AlternativeGroesse;
                    NeuesJahr        = komponente.AlternativeJahr;
                    NeuesGewicht     = SelectedKomponente.AlternativeGewicht;
                }
                OhneKomponente.Remove(item);

                var ohneZuordnung = OhneAlternative.First(teil => teil.Guid == SelectedKomponente.Guid);
                if (ohneZuordnung != null)
                {
                    OhneAlternative.Remove(ohneZuordnung);
                }

                VergleichsListe.Remove(komponente);
            }
        }
        private void OnTauschen()
        {
            SelectedKomponente.Komponente              = NeueKomponente;
            SelectedKomponente.AlternativeHersteller   = NeuerHersteller;
            SelectedKomponente.AlternativeBeschreibung = NeueBeschreibung;
            SelectedKomponente.AlternativeGroesse      = NeueGroesse;
            SelectedKomponente.AlternativeJahr         = NeuesJahr;
            SelectedKomponente.AlternativeGewicht      = NeuesGewicht;
            SelectedKomponente.AlternativeVorhanden    = true;

            var ohneAlternative = OhneAlternative.FirstOrDefault(teil => teil.Guid == SelectedKomponente.Guid);

            if (ohneAlternative != null)
            {
                OhneAlternative.Remove(ohneAlternative);
            }

            var ohneZuordnung = OhneKomponente.FirstOrDefault(teil => teil.Guid == SelectedKomponente.Guid);

            if (ohneZuordnung != null)
            {
                ohneZuordnung.Komponente  = SelectedKomponente.Komponente;
                ohneZuordnung.Alternative = SelectedKomponente.AlternativeName;
                ohneZuordnung.Gewicht     = NeuesGewicht;
            }
        }
        private void ZeileLoeschen(string guid, bool nurAlternative)
        {
            var teil = VergleichsListe.First(item => item.Guid == guid);

            if (teil != null)
            {
                if (nurAlternative)
                {
                    var ohneZuordnung = new OhneZuordnungViewModel
                    {
                        Guid         = teil.Guid,
                        Komponente   = teil.Komponente,
                        Beschreibung = teil.Beschreibung,
                        Gewicht      = teil.Gewicht,
                        Differenz    = -teil.Gewicht,
                        Alternative  = teil.AlternativeName
                    };
                    ohneZuordnung.ZuordnenAction = OnZuordnenOhneAlternative;
                    OhneAlternative.Add(ohneZuordnung);
                }
                else
                {
                    VergleichsListe.Remove(teil);

                    var ohneKomponente = OhneKomponente.FirstOrDefault(item => item.Guid == guid);
                    if (ohneKomponente != null)
                    {
                        OhneKomponente.Remove(ohneKomponente);
                    }
                }

                NeuerHersteller  = "";
                NeueBeschreibung = "";
                NeueGroesse      = "";
                NeuesJahr        = "";
                NeuesGewicht     = 0;
                UpdateProperty("GesamtDifferenz");
                UpdateProperty("GesamtGewichtAlternativen");
            }
        }
        private void TauschenRestekiste(string guid)
        {
            var restteil = Restekiste.First(teil => teil.Guid == guid);

            if (restteil != null)
            {
                SelectedKomponente.AlternativeVorhanden    = true;
                SelectedKomponente.AlternativeHersteller   = restteil.Hersteller;
                SelectedKomponente.AlternativeBeschreibung = restteil.Beschreibung;
                SelectedKomponente.AlternativeGroesse      = restteil.Groesse;
                SelectedKomponente.AlternativeJahr         = restteil.Jahr;
                SelectedKomponente.AlternativeGewicht      = restteil.Gewicht;
                UpdateProperty("GesamtDifferenz");
                UpdateProperty("GesamtGewichtAlternativen");
                Restekiste.Remove(restteil);

                if (AlternativeBearbeiten)
                {
                    NeuerHersteller  = restteil.Hersteller;
                    NeueBeschreibung = restteil.Beschreibung;
                    NeueGroesse      = restteil.Groesse;
                    NeuesJahr        = restteil.Jahr;
                    NeuesGewicht     = restteil.Gewicht;
                }

                var ohneAlternative = OhneAlternative.FirstOrDefault(teil => teil.Guid == SelectedKomponente.Guid);
                if (ohneAlternative != null)
                {
                    OhneAlternative.Remove(ohneAlternative);
                }

                var ohneZuordnung = OhneKomponente.FirstOrDefault(teil => teil.Guid == SelectedKomponente.Guid);
                if (ohneZuordnung != null)
                {
                    ohneZuordnung.Komponente  = SelectedKomponente.Komponente;
                    ohneZuordnung.Alternative = SelectedKomponente.AlternativeName;
                    ohneZuordnung.Gewicht     = restteil.Gewicht;
                }
            }
        }
        private void TauschenGewichtsdatenbank(string hersteller,
                                               string beschreibung,
                                               string groesse,
                                               string jahr,
                                               int gewicht)
        {
            SelectedKomponente.AlternativeVorhanden    = true;
            SelectedKomponente.AlternativeHersteller   = hersteller;
            SelectedKomponente.AlternativeBeschreibung = beschreibung;
            SelectedKomponente.AlternativeGroesse      = groesse;
            SelectedKomponente.AlternativeJahr         = jahr;
            SelectedKomponente.AlternativeGewicht      = gewicht;
            UpdateProperty("GesamtDifferenz");
            UpdateProperty("GesamtGewichtAlternativen");

            if (AlternativeBearbeiten)
            {
                NeuerHersteller  = hersteller;
                NeueBeschreibung = beschreibung;
                NeueGroesse      = groesse;
                NeuesJahr        = jahr;
                NeuesGewicht     = gewicht;
            }

            var ohneAlternative = OhneAlternative.FirstOrDefault(teil => teil.Guid == SelectedKomponente.Guid);

            if (ohneAlternative != null)
            {
                OhneAlternative.Remove(ohneAlternative);
            }

            var ohneZuordnung = OhneKomponente.FirstOrDefault(teil => teil.Guid == SelectedKomponente.Guid);

            if (ohneZuordnung != null)
            {
                ohneZuordnung.Komponente  = SelectedKomponente.Komponente;
                ohneZuordnung.Alternative = SelectedKomponente.AlternativeName;
                ohneZuordnung.Gewicht     = gewicht;
            }
        }