Ejemplo n.º 1
0
 public static License Create(SKU sku)
 {
     return new License
     {
         Sku = sku,
         SkuId = sku.SkuId
     };
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor that creates a license based on a provided SKU 
        /// </summary>
        /// <param name="licensedSku">SKU this license is based on</param>
        /// <param name="owner">Owning customer</param>
        /// <param name="purchaser">Purchasing customer</param>
        public License(SKU licensedSku, Customer owner, Customer purchaser)
        {
            this.SkuId = licensedSku.SkuId;
            this.LicenseIssued = DateTime.Now;
            this.PurchasingCustomerId = purchaser.ObjectId;
            this.OwningCustomerId = owner.ObjectId;
            this.OwnerName = owner.Name;

            if (licensedSku.LicenseDuration.HasValue)
            {
                this.LicenseExpires = DateTime.Now.AddMonths(licensedSku.LicenseDuration.Value);
            }
        }
Ejemplo n.º 3
0
        public static SKU Create(PrivateKey privateKey, params Feature[] features)
        {
            SKU sku = new SKU
            {
                SkuId = Guid.NewGuid(),
                SkuFeatures = new List<SkuFeature>(),
                PrivateKey = privateKey,
                PrivateKeyId = privateKey.PrivateKeyId
            };

            foreach (var feature in features)
            {
                sku.SkuFeatures.Add(new SkuFeature
                {
                    Feature = feature,
                    FeatureId = feature.FeatureId,
                    Sku = sku,
                    SkuId = sku.SkuId
                });
            }

            return sku;
        }