Ejemplo n.º 1
0
 public static SaveResult Update(SubscriptionPlan subscriptionPlan)
 {
     return(subscriptionPlan.Save());
 }
Ejemplo n.º 2
0
 public static SaveResult Insert(SubscriptionPlan subscriptionPlan)
 {
     return(subscriptionPlan.Save());
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Copies the product to the specified category.
        /// </summary>
        /// <param name="categoryId">if ZERO then will copy the product with the categories as the orignal product have </param>
        /// <param name="copyName">Name to use for the copied product</param>
        public void SaveCopy(int categoryId, string copyName)
        {
            if (string.IsNullOrEmpty(copyName))
            {
                this.Name = "Copy of " + this.Name;
            }
            else
            {
                this.Name = copyName;
            }
            CopyChildren();
            //make sure related products and upsell products
            //are loaded before resetting product id to 0
            RelatedProductCollection         relatedProds            = this.RelatedProducts;
            UpsellProductCollection          upsellProds             = this.UpsellProducts;
            SubscriptionPlan                 subplan                 = this.SubscriptionPlan;
            ProductProductTemplateCollection productProductTemplates = this.ProductProductTemplates;

            // KEEP THE ORIGNAL PRODUCTS CATEGORIES IN A NEW LIST
            List <int> pcats = new List <int>();

            pcats.AddRange(this.Categories);

            this.ProductId = 0;
            this.Save();

            // RELOAD THE LIST, SO THAT IT CAN PROPERLY BE SAVED
            // THIS IS FOR PRODUCTS WE ARE COPYING WITH FULL CATEGORY DETAILS
            this.Categories.Load(this.ProductId);

            if (categoryId > 0)
            {
                this.Categories.Add(categoryId);
            }
            else
            {
                this.Categories.AddRange(pcats);
            }
            this.Categories.ProductId = this.ProductId;

            this.Categories.Save();

            foreach (RelatedProduct prod in relatedProds)
            {
                prod.ProductId = this.ProductId;
                prod.Save();
            }

            foreach (UpsellProduct upsell in upsellProds)
            {
                upsell.ProductId = this.ProductId;
                upsell.Save();
            }
            if (subplan != null)
            {
                subplan.ProductId = this.ProductId;
                subplan.Save();
            }
            foreach (ProductProductTemplate productProductTemplate in productProductTemplates)
            {
                productProductTemplate.ProductId = this.ProductId;
                productProductTemplate.Save();
            }
        }