Beispiel #1
0
        /// <summary>
        /// Executes the create customer qualification with GCC scenario.
        /// </summary>
        protected override void RunScenario()
        {
            string customerIdToRetrieve = this.ObtainCustomerId($"Enter the ID of the customer to create qualification for {CustomerQualification.GovernmentCommunityCloud}");

            var partnerOperations = this.Context.UserPartnerOperations;

            this.Context.ConsoleHelper.StartProgress("Retrieving validation codes");
            var validations = partnerOperations.Validations.GetValidationCodes();

            this.Context.ConsoleHelper.StopProgress();

            this.Context.ConsoleHelper.Success("Success!");

            this.Context.ConsoleHelper.WriteObject(validations, "Validations");

            string validationCodeToRetrieve = this.ObtainQuantity("Enter validation code to use by ValidationId");

            ValidationCode code = null;

            foreach (ValidationCode c in validations)
            {
                if (c.ValidationId == validationCodeToRetrieve)
                {
                    code = c;
                    break;
                }
            }

            if (code == null)
            {
                this.Context.ConsoleHelper.Error("Code not found");
            }

            this.Context.ConsoleHelper.StartProgress("Creating customer qualification with GCC");

            var customerQualification = new Models.Customers.V2.CustomerQualification {
                Qualification = "GovernmentCommunityCloud"
            };

            var createCustomerQualification = partnerOperations.Customers.ById(customerIdToRetrieve).Qualification.CreateQualifications(customerQualification, code);

            this.Context.ConsoleHelper.StopProgress();
            this.Context.ConsoleHelper.WriteObject(createCustomerQualification, "Customer Qualification with GCC");
        }
        /// <summary>
        /// Executes the create customer qualification scenario.
        /// </summary>
        protected override void RunScenario()
        {
            string customerIdToRetrieve = this.ObtainCustomerId($"Enter the ID of the customer to create qualification for {CustomerQualification.Education}");

            var partnerOperations = this.Context.UserPartnerOperations;

            this.Context.ConsoleHelper.StartProgress("Creating customer qualification");

            /* This variable can be set to any allowed qualification, for example:
             * (1) "Education"
             * (2) "GovernmentCommunityCloud" <- this has to be paired with a ValidationCode, see sample in "CreateCustomerQualificationWithGCC.cs"
             * (3) "StateOwnedEntity"
             */
            var qualificationToCreate = "Education";

            var customerQualification = new Models.Customers.V2.CustomerQualification {
                Qualification = qualificationToCreate
            };

            var createCustomerQualification = partnerOperations.Customers.ById(customerIdToRetrieve).Qualification.CreateQualifications(customerQualification);

            this.Context.ConsoleHelper.StopProgress();
            this.Context.ConsoleHelper.WriteObject(createCustomerQualification, "Customer Qualification");
        }