Ejemplo n.º 1
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns>return All subscription</returns>
        public IActionResult Index()
        {
            if (Convert.ToBoolean(applicationConfigRepository.GetValuefromApplicationConfig(MainMenuStatusEnum.IsLicenseManagementEnabled.ToString())) == true)
            {
                this.TempData["ShowLicensesMenu"] = true;
            }
            SubscriptionLicensesModel subscriptionLicenses = new SubscriptionLicensesModel();

            subscriptionLicenses.SubscriptionList = new SelectList(this.subscriptionRepository.Get().Where(s => s.SubscriptionStatus == Convert.ToString(SubscriptionStatusEnum.Subscribed)), "Id", "Name");
            List <SubscriptionLicensesViewModel> subscriptionlist = new List <SubscriptionLicensesViewModel>();
            var getsubscriptionList = this.subscriptionLicensesRepository.GetLicensesForSubscriptions(Convert.ToString(SubscriptionStatusEnum.Subscribed));

            foreach (var item in getsubscriptionList)
            {
                SubscriptionLicensesViewModel subscription = new SubscriptionLicensesViewModel();
                subscription.Id = item.Id;
                subscription.AmpsubscriptionId = Convert.ToString(item.Subscription.AmpsubscriptionId);
                subscription.LicenseKey        = item.LicenseKey;
                subscription.PlanName          = item.Subscription?.AmpplanId;
                subscription.SubscriptionName  = item.Subscription?.Name;
                subscription.Status            = item.IsActive.GetValueOrDefault();
                subscription.SubScriptionID    = item.SubscriptionId ?? 0;
                subscriptionlist.Add(subscription);
            }
            subscriptionLicenses.Licenses = subscriptionlist;
            return(this.View(subscriptionLicenses));
            //return this.View(subscriptionlist);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds the subscription license.
        /// </summary>
        /// <returns>return subscription list</returns>
        public PartialViewResult AddSubscriptionLicense()
        {
            SubscriptionLicensesViewModel subscription = new SubscriptionLicensesViewModel();

            subscription.SubscriptionList = new SelectList(this.subscriptionRepository.Get().Where(s => s.SubscriptionStatus == Convert.ToString(SubscriptionStatusEnum.Subscribed)), "Id", "Name");
            return(this.PartialView(subscription));
        }
Ejemplo n.º 3
0
        public IActionResult AddLicenseDetail(SubscriptionLicensesViewModel subscriptionLicenses)
        {
            if (Convert.ToBoolean(applicationConfigRepository.GetValuefromApplicationConfig(MainMenuStatusEnum.IsLicenseManagementEnabled.ToString())) == true)
            {
                this.TempData["ShowLicensesMenu"] = true;
            }
            if (subscriptionLicenses != null)
            {
                var currentUserDetail   = this.usersRepository.GetPartnerDetailFromEmail(this.CurrentUserEmailAddress);
                var subscriptionLicense = new SubscriptionLicenses()
                {
                    LicenseKey     = subscriptionLicenses.LicenseKey,
                    SubscriptionId = subscriptionLicenses.SubScriptionID,
                    IsActive       = true,
                    CreatedDate    = DateTime.Now,
                    CreatedBy      = currentUserDetail == null ? 0 : currentUserDetail.UserId
                };

                //Check For the Existing
                var getsubscriptionDetails = this.subscriptionLicensesRepository.GetLicensesForSubscriptions(Convert.ToString(SubscriptionStatusEnum.Subscribed))
                                             .Where(s => s.SubscriptionId == subscriptionLicenses.SubScriptionID).ToList();

                if (getsubscriptionDetails.Any(s => s.IsActive == true))
                {
                    if (getsubscriptionDetails.FirstOrDefault() != null && getsubscriptionDetails.FirstOrDefault().Subscription != null)
                    {
                        TempData["msg"] = "<script>alert('There is already a license associated with the subscription" + getsubscriptionDetails.FirstOrDefault().Subscription.Name + "');</script>";
                        return(this.RedirectToAction(nameof(this.Index)));
                    }
                }
                this.subscriptionLicensesRepository.AssignLicenseToSubscription(subscriptionLicense);
            }

            return(this.RedirectToAction(nameof(this.Index)));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets subscription licenses by user.
        /// </summary>
        /// <param name="userId">The user identifier.</param>
        /// <returns>
        /// return subscription licenses by user
        /// </returns>
        public List <SubscriptionLicensesViewModel> GetSubScriptionLicensesbyUser(int userId)
        {
            List <SubscriptionLicensesViewModel> subscriptionLicensesList = new List <SubscriptionLicensesViewModel>();
            var allsubscriptionData = this.subscriptionLicensesRepository.GetSubscriptionLicensesByUser(userId, Convert.ToString(SubscriptionStatusEnum.Subscribed));

            foreach (var item in allsubscriptionData)
            {
                SubscriptionLicensesViewModel subscription = new SubscriptionLicensesViewModel();
                subscription.AmpsubscriptionId = Convert.ToString(item.Subscription.AmpsubscriptionId);
                subscription.SubscriptionName  = item.Subscription.Name;
                subscription.PlanName          = item.Subscription.AmpplanId;
                subscription.LicenseKey        = item.LicenseKey;
                subscriptionLicensesList.Add(subscription);
            }

            return(subscriptionLicensesList);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Indexes this instance.
        /// </summary>
        /// <returns>return All subscription</returns>
        public IActionResult Index()
        {
            List <SubscriptionLicensesViewModel> subscriptionlist = new List <SubscriptionLicensesViewModel>();
            var getsubscriptionList = this.subscriptionLicensesRepository.GetLicensesForSubscriptions(Convert.ToString(SubscriptionStatusEnum.Subscribed));

            foreach (var item in getsubscriptionList)
            {
                SubscriptionLicensesViewModel subscription = new SubscriptionLicensesViewModel();
                subscription.Id = item.Id;
                subscription.AmpsubscriptionId = Convert.ToString(item.Subscription.AmpsubscriptionId);
                subscription.LicenseKey        = item.LicenseKey;
                subscription.PlanName          = item.Subscription?.AmpplanId;
                subscription.SubscriptionName  = item.Subscription?.Name;
                subscription.Status            = item.IsActive.GetValueOrDefault();
                subscription.SubScriptionID    = item.SubscriptionId ?? 0;
                subscriptionlist.Add(subscription);
            }

            return(this.View(subscriptionlist));
        }