private async Task <LicenseCapabilities> CapabilitiesAsync(LogOnIdentity identity) { SubscriptionLevel level = await SubscriptionLevelAsync(identity).Free(); switch (level) { case SubscriptionLevel.Business: if (await TimeUntilSubscriptionExpiration(identity).Free() > TimeSpan.Zero) { return(BusinessCapabilities); } break; case SubscriptionLevel.Premium: if (await TimeUntilSubscriptionExpiration(identity).Free() > TimeSpan.Zero) { return(PremiumCapabilities); } break; default: break; } return(FreeCapabilities); }
public CreateSubscription(Guid subscriberId, Guid vendorId, SubscriptionLevel level, Guid subscriptionId) { SubscriberId = subscriberId; VendorId = vendorId; Level = level; SubscriptionId = subscriptionId; }
public async Task <IHttpActionResult> Post(SubscriptionRequest subscriptionRequest) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (await tenantPersister.Exists(subscriptionRequest.Email)) { return(Conflict()); } var tenant = new Tenant { Owner = subscriptionRequest.Email, Name = subscriptionRequest.Name, Level = (SubscriptionLevel.GetSupported(subscriptionRequest.Level) ?? SubscriptionLevel.Free).Code, }; await tenantPersister.Create(tenant); var subscription = new Subscription { Id = tenant.Id, Owner = tenant.Owner, Name = tenant.Name, Level = tenant.Level, StateLink = Url.Route("SubscriptionState", new { id = tenant.Id }) }; return(Content(HttpStatusCode.Accepted, subscription)); }
public Subscription( Guid subscriberId, string subscriberName, Guid vendorId, string vendorName, SubscriptionLevel level, Guid subscriptionId) : this() { Raise(new SubscriptionCreated(subscriptionId, subscriberId, subscriberName, vendorId, vendorName, level)); }
public SubscriptionCreated(Guid subscriptionId, Guid subscriberId, string subscriberName, Guid vendorId, string vendorName, SubscriptionLevel level) { SubscriptionId = subscriptionId; SubscriberId = subscriberId; SubscriberName = subscriberName; VendorId = vendorId; VendorName = vendorName; Level = level; }
public string GetSubscriptionLevel(object subscriptionID) { if (subscriptionID.ToString() != "0") { SubscriptionLevel level = DataAccessContextDeluxe.SubscriptionLevelRepository.GetOne(subscriptionID.ToString()); return(level.Level.ToString()); } else { return("0"); } }
private void When(SubscriptionCreated e) { _subscriberId = e.SubscriberId; _subscriberName = e.SubscriberName; _vendorId = e.VendorId; _vendorName = e.VendorName; _level = e.Level; Id = e.SubscriptionId; }
public UserAccount(string userName, SubscriptionLevel level, DateTime expiration, AccountStatus status, Offers offers, IEnumerable <AccountKey> keys) { UserName = userName; SubscriptionLevel = level; LevelExpiration = expiration; AccountKeys = keys.ToList(); AccountStatus = status; Offers = offers; Tag = string.Empty; Signature = string.Empty; AccountSource = AccountSource.Unknown; }
private static bool IsSubscribed(SubscriptionLevel level, ForwardChanged change, int userId) { if (level == SubscriptionLevel.All) { return(true); } if (change.NewForward.User.Id == userId) { return(level == SubscriptionLevel.ToMe || level == SubscriptionLevel.FromOrToMe); } if (change.OldForward.User.Id == userId) { return(level == SubscriptionLevel.FromOrToMe); } return(false); }
private string GetTenantDbName(string level, Guid tenantId) { var realLevel = SubscriptionLevel.GetSupported(level); if (SubscriptionLevel.Free.Equals(realLevel)) { return("FreeShared"); } if (SubscriptionLevel.Basic.Equals(realLevel)) { return("StandardShared"); } if (SubscriptionLevel.Standard.Equals(realLevel)) { return(string.Concat("t", tenantId.ToString("N"))); } return("FreeShared"); }
private string GetTenantDbEdition(string level) { var realLevel = SubscriptionLevel.GetSupported(level); if (SubscriptionLevel.Free.Equals(realLevel)) { return("Basic"); } if (SubscriptionLevel.Basic.Equals(realLevel)) { return("S0"); } if (SubscriptionLevel.Standard.Equals(realLevel)) { return("Basic"); } return("Basic"); }
private static async Task <PlanInformation> GetPlanInformationAsync(LogOnIdentity identity) { IAccountService service = New <LogOnIdentity, IAccountService>(identity); SubscriptionLevel level = await(await service.AccountAsync().Free()).ValidatedLevelAsync(); switch (level) { case SubscriptionLevel.Unknown: case SubscriptionLevel.Free: return(await NoPremiumOrCanTryAsync(service)); case SubscriptionLevel.Business: return(new PlanInformation(PlanState.HasBusiness, await GetDaysLeft(service))); case SubscriptionLevel.Premium: return(new PlanInformation(PlanState.HasPremium, await GetDaysLeft(service))); case SubscriptionLevel.DefinedByServer: case SubscriptionLevel.Undisclosed: default: return(new PlanInformation(PlanState.NoPremium, 0)); } }
public UserAccount(string userName, SubscriptionLevel level, AccountStatus status) : this(userName, level, DateTime.MinValue, status, Offers.None) { }
public when_request_payment_strategy(SubscriptionLevel subscriptionLevel, Type paymentStrategyResult) { _subscriptionLevel = subscriptionLevel; _paymentStrategyResult = paymentStrategyResult; }
public override int GetHashCode() { return(AccountKeys.GetHashCode() ^ UserName.GetHashCode() ^ SubscriptionLevel.GetHashCode() ^ LevelExpiration.GetHashCode() ^ AccountStatus.GetHashCode() ^ AccountKeys.Aggregate(0, (sum, ak) => sum ^ ak.GetHashCode())); }
public when_calculate_subscription_payment(SubscriptionLevel subscriptionLevel, SubscriptionTerm subscriptionTerm, double paymentResult) { _subscriptionLevel = subscriptionLevel; _subscriptionTerm = subscriptionTerm; _paymentResult = paymentResult; }
public UserAccount(string userName, SubscriptionLevel level, DateTime expiration, AccountStatus status, Offers offers) : this(userName, level, expiration, status, offers, new AccountKey[0]) { }
public ChangeSubscriptionLevel(Guid subscriberId, SubscriptionLevel level) { SubscriberId = subscriberId; Level = level; }