Esempio n. 1
0
        public bool StofVerwijderen(Stof teVerwijderenTof)
        {
            bool isGelukt = false;

            try
            {
                List <Stof> TeVerwijderenStoffen = new List <Stof>();
                foreach (Stof stof in this.Stoffen)
                {
                    if (stof == teVerwijderenTof)
                    {
                        TeVerwijderenStoffen.Add(stof);
                    }
                }
                foreach (Stof stof in TeVerwijderenStoffen)
                {
                    if (this.Stoffen.Contains(stof))
                    {
                        this.Stoffen.Remove(stof);
                    }
                }
                isGelukt = true;
            }
            catch (Exception)
            {
                throw new Exception("Kon stof niet verwijderen.");
            }
            return(isGelukt);
        }
Esempio n. 2
0
        public bool StofToevoegen(Stof stof)
        {
            bool isGelukt = false;

            try
            {
                Stoffen.Add(stof);
                isGelukt = true;
            }
            catch (Exception)
            {
                throw new Exception("Kon stof niet toevoegen.");
            }
            return(isGelukt);
        }
Esempio n. 3
0
        public int CompareTo(object obj)
        {
            if (obj == null)
            {
                return(1);
            }
            Stof stof = obj as Stof;

            if (stof == null)
            {
                return(1);
            }
            if (stof.PrijsPerMeter > this.PrijsPerMeter)
            {
                return(1);
            }
            else if (stof.PrijsPerMeter < this.PrijsPerMeter)
            {
                return(-1);
            }
            else
            {
                if (stof.Naam.CompareTo(this.Naam) == 1)
                {
                    return(-1);
                }
                else if (stof.Naam.CompareTo(this.Naam) == -1)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }
        }