public void UpdateSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     SubscriptionPlanOperations.UpdateSubscriptionPlan(subscriptionPlan);
 }
 public SubscriptionPlan AddSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     return SubscriptionPlanOperations.AddSubscriptionPlan(subscriptionPlan);
 }
 public SubscriptionPlan CreateSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     return SubscriptionPlanOperations.CreateSubscriptionPlan(subscriptionPlan);
 }
        /// <summary>
        /// <para>Adds a subscription plan.</para>
        /// </summary>
        /// <param name="subscriptionPlan">A populated subscription plan object.</param>
        /// <returns>Returns a validation result object.</returns>
        internal IValidationResult AddSubscriptionPlan(SubscriptionPlan subscriptionPlan)
        {
            IValidationResult validationResult = new ValidationResult();

            // Validate the new subscription plan.
            validationResult = this.doctrineShipsValidation.SubscriptionPlan(subscriptionPlan);
            if (validationResult.IsValid == true)
            {
                // Add the new subscription plan.
                this.doctrineShipsRepository.CreateSubscriptionPlan(subscriptionPlan);
                this.doctrineShipsRepository.Save();

                // Log the addition.
                logger.LogMessage("Subscription Plan '" + subscriptionPlan.Name + "' Successfully Added.", 2, "Message", MethodBase.GetCurrentMethod().Name);
            }

            return validationResult;
        }
 /// <summary>
 /// <para>Adds a subscription plan.</para>
 /// </summary>
 /// <param name="subscriptionPlan">A populated subscription plan object.</param>
 /// <returns>Returns a validation result object.</returns>
 public IValidationResult AddSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     return AccountManager.AddSubscriptionPlan(subscriptionPlan);
 }
 internal void UpdateSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     subscriptionPlan.ObjectState = ObjectState.Modified;
     this.unitOfWork.Repository<SubscriptionPlan>().Update(subscriptionPlan);
 }
 internal SubscriptionPlan CreateSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     subscriptionPlan.ObjectState = ObjectState.Added;
     this.unitOfWork.Repository<SubscriptionPlan>().Insert(subscriptionPlan);
     return subscriptionPlan;
 }
 internal SubscriptionPlan AddSubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     this.unitOfWork.Repository<SubscriptionPlan>().Insert(subscriptionPlan);
     return subscriptionPlan;
 }
        internal IValidationResult SubscriptionPlan(SubscriptionPlan subscriptionPlan)
        {
            IValidationResult validationResult = new ValidationResult();

            // Null checks.
            if (subscriptionPlan.Name == null)
            {
                validationResult.AddError("Name.Null", "Name cannot be null.");
            }

            if (subscriptionPlan.Description == null)
            {
                validationResult.AddError("Description.Null", "Description cannot be null.");
            }

            // Range checks.
            if (subscriptionPlan.SalesAgentLimit < 1 || subscriptionPlan.SalesAgentLimit > 500)
            {
                validationResult.AddError("SalesAgentLimit.Range", "SalesAgentLimit is outside of expected ranges. SalesAgentLimit should be between 1 and 500.");
            }

            if (subscriptionPlan.PricePerMonth < 0 || subscriptionPlan.PricePerMonth > long.MaxValue)
            {
                validationResult.AddError("PricePerMonth.Range", "PricePerMonth can not be less than 0. Also, the upper limit cannot exceed the max value of the long data type.");
            }

            return validationResult;
        }
 public IValidationResult SubscriptionPlan(SubscriptionPlan subscriptionPlan)
 {
     return AccountCheck.SubscriptionPlan(subscriptionPlan);
 }