Esempio n. 1
0
        protected override void Execute(CodeActivityContext context)
        {
            var wfContext      = context.GetExtension <IWorkflowContext>();
            var servicefactory = context.GetExtension <IOrganizationServiceFactory>();
            var service        = servicefactory.CreateOrganizationService(null);
            var agreementRef   = AgreementReference.Get(context);

            try
            {
                AgreementService agreementService = new AgreementService(service);
                bool             hasInvoices      = agreementService.HasManualInvoicesByAgreementId(agreementRef);
                if (hasInvoices)
                {
                    HasManualInvoice.Set(context, true);
                }
                else
                {
                    HasManualInvoice.Set(context, false);
                }
            }
            catch (Exception ex)
            {
                throw new InvalidPluginExecutionException(ex.Message);
            }
        }