Beispiel #1
0
        // Comparison Operators
        //public static bool operator ==(ParentProduct a, ParentProduct b)
        //{
        //    if (ReferenceEquals(a, b))
        //        return true;
        //    return a.Equals(b);
        //}

        //public static bool operator !=(ParentProduct a, ParentProduct b)
        //{
        //    return !(a == b);
        //}

        //public static bool operator ==(ParentProduct a, string b)
        //{
        //    return a.Equals(b);
        //}

        //public static bool operator !=(ParentProduct a, string b)
        //{
        //    return !(a == b);
        //}

        //public static bool operator ==(string a, ParentProduct b)
        //{
        //    return (b == a);
        //}

        //public static bool operator !=(string a, ParentProduct b)
        //{
        //    return !(a == b);
        //}

        // ********************
        // * Member Functions *
        // ********************

        // Update Function
        public bool UpdateData(ParentProduct update)
        {
            if (this == update)
            {
                UpdateData(update);

                MetaTagKeywords = update.MetaTagKeywords;
                Description     = update.Description;
                OnHomePage      = update.OnHomePage;

                // Update Child Products with new data
                foreach (var child in update.ChildProducts)
                {
                    var index = ChildProducts.FindIndex(x => x == child);
                    if (index == -1)
                    {
                        ChildProducts.Add(child);
                    }
                    else
                    {
                        ChildProducts[index].UpdateData(child);
                    }
                }

                return(true);
            }

            return(false);
        }
Beispiel #2
0
 public bool Equals(ParentProduct other)
 {
     if (other == default(ParentProduct))
     {
         return(false);
     }
     return(Equals(other.ID));
 }
Beispiel #3
0
        // ***************
        // * Constructor *
        // ***************

        public ChildProduct(ParentProduct Parent) : base(Parent.ID)
        {
            UpdateData(Parent as Product);
        }