protected override void Execute(CodeActivityContext executionContext)
        {
            #region "Load CRM Service from context"

            Common objCommon = new Common(executionContext);
            objCommon.tracingService.Trace("Load CRM Service from context --- OK");
            #endregion

            #region "Read Parameters"
            int _state  = this.State.Get(executionContext);
            int _status = this.Status.Get(executionContext);


            #endregion


            #region "SetState Execution"

            try
            {
                EntityReference moniker = new EntityReference();
                moniker.LogicalName = objCommon.context.PrimaryEntityName;
                moniker.Id          = objCommon.context.PrimaryEntityId;

                Microsoft.Xrm.Sdk.OrganizationRequest request
                    = new Microsoft.Xrm.Sdk.OrganizationRequest()
                    {
                    RequestName = "SetState"
                    };
                request["EntityMoniker"] = moniker;
                OptionSetValue state  = new OptionSetValue(_state);
                OptionSetValue status = new OptionSetValue(_status);
                request["State"]  = state;
                request["Status"] = status;

                objCommon.service.Execute(request);
            }
            catch (FaultException <OrganizationServiceFault> ex)
            {
                throw ex;
            }
            #endregion
        }
Exemple #2
0
 internal SaveChangesResult(OrganizationRequest request, Exception error)
 {
     this.Request = request;
     this.Error   = error;
 }
Exemple #3
0
 internal SaveChangesResult(OrganizationRequest request, OrganizationResponse response)
 {
     this.Request  = request;
     this.Response = response;
 }
 public OrganizationResponse Execute(Microsoft.Xrm.Sdk.OrganizationRequest request)
 {
     return(this.context.Execute(request));
 }
 public R ExecuteRequest <R>(Microsoft.Xrm.Sdk.OrganizationRequest request) where R : OrganizationResponse
 {
     return((R)this.context.Execute(request));
 }
        public Microsoft.Xrm.Sdk.OrganizationResponse Execute(Microsoft.Xrm.Sdk.OrganizationRequest request, Guid runAsSystemUserID)
        {
            var ser = this.ServiceFactory.CreateOrganizationService(runAsSystemUserID);

            return(ser.Execute(request));
        }
Exemple #7
0
        /// <summary>
        /// Execute method override. Returns OrganizationResponse as the specified type
        /// </summary>
        public static T Execute <T>(this IOrganizationService service, OrganizationRequest request) where T : OrganizationResponse
        {
            CheckParam.CheckForNull(request, nameof(request));

            return(service.Execute(request) as T);
        }