示例#1
0
        private async Task <SdkMessageProcessingStepImage> GetStepImageById(Guid id)
        {
            SdkMessageProcessingStepImage entity1 = GetLinked1(id);
            SdkMessageProcessingStepImage entity2 = await GetLinked2(id);

            SdkMessageProcessingStepImage entity3 = GetLinked3(id);

            entity1.Merge(entity2, entity3);

            SdkMessageProcessingStepRepository.FullfillEntitiesSteps(entity1);

            return(entity1);
        }
示例#2
0
        private List <SdkMessageProcessingStepImage> GetAllImages()
        {
            QueryExpression query = new QueryExpression()
            {
                NoLock = true,

                EntityName = SdkMessageProcessingStepImage.EntityLogicalName,

                ColumnSet = new ColumnSet(true),

                LinkEntities =
                {
                    new LinkEntity()
                    {
                        LinkFromEntityName    = SdkMessageProcessingStepImage.EntityLogicalName,
                        LinkFromAttributeName = SdkMessageProcessingStepImage.Schema.Attributes.sdkmessageprocessingstepid,

                        LinkToEntityName    = SdkMessageProcessingStep.EntityLogicalName,
                        LinkToAttributeName = SdkMessageProcessingStep.EntityPrimaryIdAttribute,

                        EntityAlias = SdkMessageProcessingStep.EntityLogicalName,

                        Columns = new ColumnSet(
                            SdkMessageProcessingStep.Schema.Attributes.plugintypeid
                            , SdkMessageProcessingStep.Schema.Attributes.sdkmessageid
                            , SdkMessageProcessingStep.Schema.Attributes.stage
                            , SdkMessageProcessingStep.Schema.Attributes.mode
                            , SdkMessageProcessingStep.Schema.Attributes.rank
                            , SdkMessageProcessingStep.Schema.Attributes.statuscode
                            , SdkMessageProcessingStep.Schema.Attributes.eventhandler
                            ),

                        LinkCriteria =
                        {
                            Conditions =
                            {
                                new ConditionExpression(SdkMessageProcessingStep.Schema.Attributes.stage,    ConditionOperator.In
                                                        ,                                                    (int)SdkMessageProcessingStep.Schema.OptionSets.stage.Pre_validation_10
                                                        ,                                                    (int)SdkMessageProcessingStep.Schema.OptionSets.stage.Pre_operation_20
                                                        ,                                                    (int)SdkMessageProcessingStep.Schema.OptionSets.stage.Post_operation_40
                                                        ),
                                new ConditionExpression(SdkMessageProcessingStep.Schema.Attributes.ishidden, ConditionOperator.Equal, false),
                            },
                        },

                        LinkEntities =
                        {
                            new LinkEntity()
                            {
                                LinkFromEntityName    = SdkMessageProcessingStep.EntityLogicalName,
                                LinkFromAttributeName = SdkMessageProcessingStep.Schema.Attributes.sdkmessagefilterid,

                                LinkToEntityName    = SdkMessageFilter.EntityLogicalName,
                                LinkToAttributeName = SdkMessageFilter.EntityPrimaryIdAttribute,

                                EntityAlias = SdkMessageProcessingStep.Schema.Attributes.sdkmessagefilterid,

                                JoinOperator = Microsoft.Xrm.Sdk.Query.JoinOperator.LeftOuter,

                                Columns = new ColumnSet(
                                    SdkMessageFilter.Schema.Attributes.primaryobjecttypecode
                                    , SdkMessageFilter.Schema.Attributes.secondaryobjecttypecode
                                    ),
                            },
                        },
                    },
                },

                Orders =
                {
                    new OrderExpression(SdkMessageProcessingStepImage.Schema.Attributes.imagetype,   OrderType.Ascending),
                    new OrderExpression(SdkMessageProcessingStepImage.Schema.Attributes.name,        OrderType.Ascending),
                    new OrderExpression(SdkMessageProcessingStepImage.Schema.Attributes.entityalias, OrderType.Ascending),
                    new OrderExpression(SdkMessageProcessingStepImage.Schema.Attributes.createdon,   OrderType.Ascending),
                },
            };

            var result = _service.RetrieveMultipleAll <SdkMessageProcessingStepImage>(query);

            SdkMessageProcessingStepRepository.FullfillEntitiesSteps(result);

            return(result);
        }
        private List <SdkMessage> GetAllSdkMessageWithFilters(string messageName, string entityName)
        {
            QueryExpression query = new QueryExpression()
            {
                NoLock = true,

                EntityName = SdkMessage.EntityLogicalName,

                ColumnSet = new ColumnSet(SdkMessage.EntityPrimaryIdAttribute, SdkMessage.Schema.Attributes.name, SdkMessage.Schema.Attributes.categoryname),

                Distinct = true,

                //Criteria =
                //{
                //    Conditions =
                //    {
                //        new ConditionExpression(SdkMessage.Schema.Attributes.isprivate, ConditionOperator.Equal, false),
                //    },
                //},

                LinkEntities =
                {
                    new LinkEntity()
                    {
                        JoinOperator = JoinOperator.LeftOuter,

                        LinkFromEntityName    = SdkMessage.EntityLogicalName,
                        LinkFromAttributeName = SdkMessage.EntityPrimaryIdAttribute,

                        LinkToEntityName    = SdkMessageFilter.EntityLogicalName,
                        LinkToAttributeName = SdkMessageFilter.Schema.Attributes.sdkmessageid,

                        EntityAlias = SdkMessageFilter.Schema.EntityPrimaryIdAttribute,

                        Columns = new ColumnSet(SdkMessageFilter.Schema.EntityPrimaryIdAttribute, SdkMessageFilter.Schema.Attributes.primaryobjecttypecode, SdkMessageFilter.Schema.Attributes.secondaryobjecttypecode),

                        //LinkCriteria =
                        //{
                        //    Conditions =
                        //    {
                        //        new ConditionExpression(SdkMessageFilter.Schema.Attributes.iscustomprocessingstepallowed, ConditionOperator.Equal, true),
                        //        new ConditionExpression(SdkMessageFilter.Schema.Attributes.isvisible, ConditionOperator.Equal, true),
                        //    },
                        //},
                    },
                },
            };

            if (!string.IsNullOrEmpty(messageName))
            {
                query.Criteria.Conditions.Add(new ConditionExpression(SdkMessage.Schema.Attributes.name, ConditionOperator.Like, messageName + "%"));
            }

            var result = _service.RetrieveMultipleAll <SdkMessage>(query);

            SdkMessageProcessingStepRepository.FullfillEntitiesSteps(result);

            if (!string.IsNullOrEmpty(entityName))
            {
                result = result.Where(ent => ent.PrimaryObjectTypeCodeName.IndexOf(entityName, StringComparison.InvariantCultureIgnoreCase) > -1).ToList();
            }

            return(result);
        }