Пример #1
0
 internal TemplatePipeline(PipelineContext context, PipelineWriter writer, string deploymentName, ResourceGroupOption resourceGroup, SubscriptionOption subscription)
     : base(context, writer)
 {
     _DeploymentName = deploymentName;
     _ResourceGroup  = resourceGroup;
     _Subscription   = subscription;
 }
Пример #2
0
        public List <SubscriptionOption> GetSubscriptionOption(Hashtable criteria)
        {
            List <SubscriptionOption> listSubscriptionOption = new List <SubscriptionOption>();
            DBUtility objUtility = new DBUtility();

            _cmd = new SqlCommand();

            _cmd.CommandType = CommandType.StoredProcedure;
            _cmd.CommandText = "GP_SP_GetSubscriptionOptions";

            _cmd.Parameters.AddWithValue("@RoleId", Convert.ToInt64(criteria["roleID"]));
            var _dt = new DataTable();

            _dt = objUtility.FillDataTable(_cmd, _dt);
            if (_dt.Rows.Count > 0)
            {
                foreach (DataRow dr in _dt.Rows)
                {
                    SubscriptionOption objSubscriptionOptionList = new SubscriptionOption();
                    objSubscriptionOptionList.ID       = Convert.ToInt32(dr["ID"]);
                    objSubscriptionOptionList.PlanName = Convert.ToString(dr["PlanName"]);
                    objSubscriptionOptionList.Amount   = Convert.ToDouble(dr["Amount"]);

                    listSubscriptionOption.Add(objSubscriptionOptionList);
                }
            }
            return(listSubscriptionOption);
        }
 public override IPipeline Build()
 {
     _ResourceGroup = ResourceGroupOption.Combine(_ResourceGroup ?? Option.Configuration.ResourceGroup, ResourceGroupOption.Default);
     _Subscription  = SubscriptionOption.Combine(_Subscription ?? Option.Configuration.Subscription, SubscriptionOption.Default);
     _ResourceGroup.SubscriptionId = _Subscription.SubscriptionId;
     return(new TemplatePipeline(PrepareContext(), _DeploymentName, _ResourceGroup, _Subscription));
 }
Пример #4
0
        public override IPipeline Build()
        {
            _ResourceGroup = _ResourceGroup ?? Option.Configuration.ResourceGroup;
            _Subscription  = _Subscription ?? Option.Configuration.Subscription;

            _ResourceGroup.SubscriptionId = _Subscription.SubscriptionId;
            return(new TemplatePipeline(PrepareContext(), PrepareWriter(), _DeploymentName, _ResourceGroup, _Subscription));
        }
Пример #5
0
        /// <summary>
        /// Handle a nested deployment resource.
        /// </summary>
        private bool TryDeploymentResource(TemplateContext context, JObject resource)
        {
            var resourceType = ExpandProperty <string>(context, resource, PROPERTY_TYPE);

            if (!string.Equals(resourceType, RESOURCETYPE_DEPLOYMENT, StringComparison.OrdinalIgnoreCase))
            {
                return(false);
            }

            var deploymentName = ExpandProperty <string>(context, resource, PROPERTY_NAME);

            if (string.IsNullOrEmpty(deploymentName))
            {
                return(false);
            }

            if (!TryObjectProperty(resource, PROPERTY_PROPERTIES, out JObject properties))
            {
                return(false);
            }

            var deploymentContext = context;

            if (TryObjectProperty(properties, PROPERTY_EXPRESSIONEVALUATIONOPTIONS, out JObject options) &&
                TryStringProperty(options, PROPERTY_SCOPE, out string scope) &&
                StringComparer.OrdinalIgnoreCase.Equals(DEPLOYMENTSCOPE_INNER, scope))
            {
                var subscription  = new SubscriptionOption(context.Subscription);
                var resourceGroup = new ResourceGroupOption(context.ResourceGroup);
                if (TryStringProperty(resource, PROPERTY_SUBSCRIPTIONID, out string subscriptionId))
                {
                    subscription.SubscriptionId = subscriptionId;
                }

                if (TryStringProperty(resource, PROPERTY_RESOURCEGROUP, out string resourceGroupName))
                {
                    resourceGroup.Name = resourceGroupName;
                }

                resourceGroup.SubscriptionId = subscription.SubscriptionId;
                deploymentContext            = new TemplateContext(context.Pipeline, subscription, resourceGroup);
                if (TryObjectProperty(properties, PROPERTY_PARAMETERS, out JObject innerParameters))
                {
                    foreach (var parameter in innerParameters.Properties())
                    {
                        deploymentContext.Parameter(parameter.Name, ResolveVariable(context, parameter.Value[PROPERTY_VALUE]));
                    }
                }
            }

            if (!TryObjectProperty(properties, PROPERTY_TEMPLATE, out JObject template))
            {
                return(false);
            }

            Template(deploymentContext, deploymentName, template);
            return(true);
        }
Пример #6
0
        public void Subscription(SubscriptionOption subscription)
        {
            if (subscription == null)
            {
                return;
            }

            _Subscription = subscription;
        }
Пример #7
0
            internal TemplateContext(SubscriptionOption subscription, ResourceGroupOption resourceGroup)
                : this()
            {
                if (subscription != null)
                {
                    Subscription = subscription;
                }

                if (resourceGroup != null)
                {
                    ResourceGroup = resourceGroup;
                }
            }
Пример #8
0
            internal TemplateContext(PipelineContext context, SubscriptionOption subscription, ResourceGroupOption resourceGroup)
                : this()
            {
                Pipeline = context;
                if (subscription != null)
                {
                    Subscription = subscription;
                }

                if (resourceGroup != null)
                {
                    ResourceGroup = resourceGroup;
                }
            }
Пример #9
0
        private void SetInDatabaseSubscription <TValue>(OptionDefinition <TValue> pref, int subId, TValue value)
        {
            var dbPref = dataContext.SubscriptionOptions.Find(pref.Key, subId);

            if (dbPref == null)
            {
                dbPref = new SubscriptionOption()
                {
                    Key = pref.Key, SubscriptionId = subId
                };
                dataContext.SubscriptionOptions.Add(dbPref);
            }
            dbPref.Value = JsonSerializer.Serialize(value);
            dataContext.SaveChanges();
        }
Пример #10
0
        public ActionResult GetSubscriptionPopup(SubscriptionOption model)
        {
            var subscriptionModel = new SubscriptionModel();

            subscriptionModel.subscriptionOption  = model;
            subscriptionModel.CardType            = GetPaymentCardType();
            subscriptionModel.ExpirationYearList  = GetExpirationYear();
            subscriptionModel.ExpirationMonthList = GetExpirationMonth();
            var customerID = SessionController.UserSession.CustomerID;           //Check whether the user already has credit card details or not

            if (customerID != null && customerID != "")
            {
                var            customerService = new StripeCustomerService();
                StripeCustomer stripeCustomer  = customerService.Get(customerID);
                var            cardService     = new StripeCardService();
                StripeCard     stripeCard      = cardService.Get(customerID, stripeCustomer.DefaultSourceId); // optional isRecipient
                foreach (var card in subscriptionModel.CardType)
                {
                    stripeCard.Brand             = subscriptionModel.CardType[0].Name;
                    subscriptionModel.CardTypeID = Convert.ToInt32(subscriptionModel.CardType[0].ID);
                }
                subscriptionModel.ExpirationMonth = stripeCard.ExpirationMonth;
                subscriptionModel.ExpirationYear  = stripeCard.ExpirationYear;
                subscriptionModel.CardTypeID      = subscriptionModel.CardTypeID;
                subscriptionModel.CardNumber      = "************" + stripeCard.Last4;
                subscriptionModel.NameOnCard      = stripeCard.Name;
            }
            //----------------------
            if (model.RoleId == 2)
            {
                ViewBag.SubscriptionTitle = "Find unlimited investment opportunities for " + model.AmountPerMonth + " per month.";
            }
            else if (model.RoleId == 3)
            {
                ViewBag.SubscriptionTitle = "List unlimited investment opportunities for " + model.AmountPerMonth + " per month.";
            }
            return(PartialView("_PaymentSubscriptionPopup", subscriptionModel));
        }
Пример #11
0
        public void Subscribe(Action <T> processFunc)
        {
            SubscriptionOption <T> options = new SubscriptionOption <T> {
                MessageHandler = processFunc, BatchSize = this._batchSize
            };

            if (this._queuePrefetchSize > 0)
            {
                options.QueuePrefetchSize = this._queuePrefetchSize;
            }

            if (!string.IsNullOrEmpty(this._subscriptionName))
            {
                options.SubscriptionName = this._subscriptionName;
            }

            if (this._routeFinder != null)
            {
                options.RouteFinder = this._routeFinder;
            }


            this._tunnel.Subscribe(options);
        }