Exemplo n.º 1
0
        /// <summary>
        /// This object returns a clone of this product instance.  It was built because
        /// we couldn't properly serialize a child in the web role inheriting from the shared classes.
        /// </summary>
        /// <returns></returns>
        public ProductInstance Clone()
        {
            ProductInstance clonedProductInstance = new ProductInstance();

            clonedProductInstance.Id = this.Id;
            clonedProductInstance.FKParentInstance = this.FKParentInstance;
            clonedProductInstance.FKProject        = this.FKProject;
            clonedProductInstance.FKRoom           = this.FKRoom;
            clonedProductInstance.Rating           = this.Rating;
            clonedProductInstance.ProductTypeGUID  = this.ProductTypeGUID;
            return(clonedProductInstance);
        }
Exemplo n.º 2
0
        public int ProductInstancesIndexOrAdd(ProductInstance productInstance)
        {
            if (productInstance == null || productInstance.Id == 0)
            {
                return(-1);
            }
            //  Create our projects list if it doesn't exist
            if (this.ProductInstances == null)
            {
                this.ProductInstances = new List <ProductInstance>();
            }

            if (!this.ProductInstances.Any(item => item.Id == productInstance.Id))
            {
                this.ProductInstances.Add(productInstance);
            }
            return(this.ProductInstances.FindIndex(p => p.Id == productInstance.Id));
        }