コード例 #1
0
        private IExpressionFieldsRetriever GetDestinationFieldsRetriever(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Checklist:
                    {
                        var settingsStep = field.GetStep<ChecklistSettingsStepEdit>();
                        if (settingsStep == null || string.IsNullOrEmpty(settingsStep.AnswerProcessSystemName))
                        {
                            return null;
                        }

                        return new ChecklistSubfieldsRetriever(
                            settingsStep.AnswerProcessSystemName,
                            f => f.SystemName != Constants.IdColumnName && CanBeDestinationField(f) && f.ColumnType != ColumnTypes.Checklist,
                            CreateDestinationField);
                    }

                default:
                    return null;
            }
        }
        /// <summary>
        /// Gets the destination fields retriever.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <returns>The IExpressionFieldsRetriever.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// Invalid cross reference field: required step not found.
        /// or
        /// Invalid cross reference field: referenced process is null.
        /// </exception>
        private IExpressionFieldsRetriever GetDestinationFieldsRetriever(FieldEdit field)
        {
            switch (field.FieldType.ColumnType)
            {
                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var requiredStep = field.GetStep<CrossRefRequiredStepEdit>();
                        if (requiredStep == null || !requiredStep.CrossRefProcessId.HasValue)
                            return null;

                        return new CrossReferenceSubfieldsRetriever(requiredStep.CrossRefProcessId.Value, CanBeDestinationField, CreateDestinationField);
                    }

                case ColumnTypes.File:
                    return new FileSubfieldsRetriever(CreateConnectionValidator);

                case ColumnTypes.Checklist:
                    {
                        var settingsStep = field.GetStep<ChecklistSettingsStepEdit>();
                        if (settingsStep == null || string.IsNullOrEmpty(settingsStep.AnswerProcessSystemName))
                            return null;

                        return new ChecklistSubfieldsRetriever(settingsStep.AnswerProcessSystemName, CanBeDestinationField, CreateDestinationField);
                    }

                case ColumnTypes.Sample:
                    return new SampleSubfieldsRetriever(CreateConnectionValidator);

                default:
                    return null;
            }
        }
コード例 #3
0
        private static IExpressionFieldsRetriever GetSourceFieldsRetriever(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var requiredStep = field.GetStep<CrossRefRequiredStepEdit>();
                        IExpressionFieldsRetriever subfieldsRetriever = null;
                        if (requiredStep != null && requiredStep.CrossRefProcessId.HasValue)
                        {
                            subfieldsRetriever = new CrossReferenceSubfieldsRetriever(requiredStep.CrossRefProcessId.Value, CanBeSourceField, CreateSourceField);
                        }

                        return subfieldsRetriever;
                    }

                case ColumnTypes.Sample:
                    return new SampleSubfieldsRetriever(SourceFieldSetNames.DataTriggerSourceItem);

                case ColumnTypes.File:
                    return new FileSubfieldsRetriever(SourceFieldSetNames.DataTriggerSourceItem);

                default:
                    return null;
            }
        }
コード例 #4
0
        private static bool CanBeSourceField(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Integer:
                case ColumnTypes.String:
                case ColumnTypes.Numeric:
                case ColumnTypes.Double:
                case ColumnTypes.Boolean:
                case ColumnTypes.DateTime:
                case ColumnTypes.AutoNumber:
                case ColumnTypes.SampleType:
                case ColumnTypes.Label:
                case ColumnTypes.Sample:
                case ColumnTypes.File:
                    return true;

                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var requiredStep = field.GetStep<CrossRefRequiredStepEdit>();
                        return requiredStep != null && requiredStep.CrossRefProcessId.HasValue;
                    }

                case ColumnTypes.DisplayList:
                    {
                        var requiredStep = field.GetStep<DisplayListRequiredStepEdit>();
                        return requiredStep != null && requiredStep.CrossRefProcessId.HasValue;
                    }

                case ColumnTypes.ReverseReference:
                case ColumnTypes.ReverseMultiReference:
                    {
                        var requiredStep = field.GetStep<ReverseCrossRefRequiredStepEdit>();
                        return requiredStep != null && requiredStep.ReverseCrossRefProcessId.HasValue;
                    }

                case ColumnTypes.Checklist:
                    {
                        var requiredStep = field.GetStep<ChecklistSettingsStepEdit>();
                        return requiredStep != null && !string.IsNullOrEmpty(requiredStep.AnswerProcessSystemName);
                    }

                default:
                    return false;
            }
        }
コード例 #5
0
        private IExpressionFieldsRetriever GetSubfieldsRetriever(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var requiredStep = field.GetStep<CrossRefRequiredStepEdit>();
                        return requiredStep != null && requiredStep.CrossRefProcessId.HasValue
                                   ? new CrossReferenceSubfieldsRetriever(requiredStep.CrossRefProcessId.Value, CanBeSourceField, CreateSourceField)
                                   : null;
                    }

                case ColumnTypes.DisplayList:
                    {
                        var requiredStep = field.GetStep<DisplayListRequiredStepEdit>();
                        return requiredStep != null && requiredStep.CrossRefProcessId.HasValue
                                   ? new DisplayListSubfieldsRetriever(requiredStep.CrossRefProcessId.Value, CanBeSourceField, CreateSourceField)
                                   : null;
                    }

                case ColumnTypes.ReverseReference:
                case ColumnTypes.ReverseMultiReference:
                    {
                        var requiredStep = field.GetStep<ReverseCrossRefRequiredStepEdit>();
                        return requiredStep != null && requiredStep.ReverseCrossRefProcessId.HasValue
                                   ? new ReverseCrossReferenceSubfieldsRetriever(
                                         requiredStep.ReverseCrossRefProcessId.Value,
                                         CanBeSourceField,
                                         CreateSourceField)
                                   : null;
                    }

                case ColumnTypes.Checklist:
                    {
                        var settingsStep = field.GetStep<ChecklistSettingsStepEdit>();
                        return settingsStep != null && !string.IsNullOrEmpty(settingsStep.AnswerProcessSystemName)
                                   ? new ChecklistSubfieldsRetriever(settingsStep.AnswerProcessSystemName, CanBeSourceField, CreateSourceField)
                                   : null;
                    }

                case ColumnTypes.Sample:
                    {
                        return new SampleSubfieldsRetriever(SourceFieldSetNames.IntegrationServiceResultItem);
                    }

                case ColumnTypes.File:
                    {
                        return new FileSubfieldsRetriever(SourceFieldSetNames.IntegrationServiceResultItem);
                    }

                default:
                    return null;
            }
        }
コード例 #6
0
ファイル: FilteringUtils.cs プロジェクト: mparsin/Elements
        private static DateTimeFormat? GetDateTimeFormat(FieldEdit field)
        {
            if (field.ColumnType != ColumnTypes.DateTime)
            {
                return null;
            }

            var dateStep = field.GetStep<DateRequiredSettingsStepEdit>();
            if (dateStep == null)
            {
                return null;
            }

            DateTimeFormat dateTimeFormat;
            if (Enum.TryParse(dateStep.SelectedDateTimeFormat, out dateTimeFormat))
            {
                return dateTimeFormat;
            }

            return null;
        }
コード例 #7
0
ファイル: FilteringUtils.cs プロジェクト: mparsin/Elements
        private static string GetDisplayFieldName(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var crStep = field.GetStep<CrossRefRequiredStepEdit>();
                        return crStep != null ? crStep.DisplayFieldName : null;
                    }

                case ColumnTypes.ReverseReference:
                case ColumnTypes.ReverseMultiReference:
                    {
                        var rcrStep = field.GetStep<ReverseCrossRefRequiredStepEdit>();
                        return rcrStep != null ? rcrStep.DisplayFieldName : null;
                    }

                case ColumnTypes.TreeView:
                    {
                        var tvStep = field.GetStep<TreeViewRequiredStepEdit>();
                        return tvStep != null ? tvStep.DisplayFieldName : null;
                    }
            }

            return null;
        }
コード例 #8
0
ファイル: FilteringUtils.cs プロジェクト: mparsin/Elements
        private static int? GetReferencedProcessId(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var crStep = field.GetStep<CrossRefRequiredStepEdit>();
                        return crStep != null ? crStep.CrossRefProcessId : null;
                    }

                case ColumnTypes.ReverseReference:
                case ColumnTypes.ReverseMultiReference:
                    {
                        var rcrStep = field.GetStep<ReverseCrossRefRequiredStepEdit>();
                        return rcrStep != null ? rcrStep.ReverseCrossRefProcessId : null;
                    }

                case ColumnTypes.TreeView:
                    {
                        var tvStep = field.GetStep<TreeViewRequiredStepEdit>();
                        return tvStep != null ? tvStep.ReverseCrossRefProcessId : null;
                    }
            }

            return null;
        }
コード例 #9
0
        /// <summary>
        /// Gets the destination fields retriever.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <returns>The <see cref="IExpressionFieldsRetriever"/>.</returns>
        /// <exception cref="System.InvalidOperationException">
        /// Invalid cross reference field: required step not found.
        /// or
        /// Invalid cross reference field: referenced process is null.
        /// </exception>
        private IExpressionFieldsRetriever GetDestinationFieldsRetriever(FieldEdit field)
        {
            switch (field.ColumnType)
            {
                case ColumnTypes.Reference:
                case ColumnTypes.MultiReference:
                    {
                        var requiredStep = field.GetStep<CrossRefRequiredStepEdit>();
                        if (requiredStep == null)
                            throw new ArgumentException("Invalid cross reference field: required step not found.");

                        if (!requiredStep.CrossRefProcessId.HasValue)
                            throw new ArgumentException("Invalid cross reference field: referenced process is null.");

                        return new CrossReferenceSubfieldsRetriever(
                            requiredStep.CrossRefProcessId.Value,
                            CanBeDestinationField,
                            (fieldInfo, owner) =>
                            {
                                var destinationField = CreateDestinationField(fieldInfo, owner);
                                destinationField.IsKeyVisible = true;
                                destinationField.IsKeyEnabled = CanBeKeyField(fieldInfo);

                                return destinationField;
                            });
                    }

                case ColumnTypes.File:
                    return new FileSubfieldsRetriever();

                default:
                    return null;
            }
        }
コード例 #10
0
        /// <summary>
        /// Determines whether this instance [can be destination field] the specified field.
        /// </summary>
        /// <param name="field">The field.</param>
        /// <returns><c>true</c> if this instance [can be destination field] the specified field; otherwise, <c>false</c>.</returns>
        private static bool CanBeDestinationField(FieldEdit field)
        {
            if (field.IsDeleted || field.IsCalculated())
                return false;

            if (field.ColumnType == ColumnTypes.Reference || field.ColumnType == ColumnTypes.MultiReference)
            {
                var requiredStep = field.GetStep<CrossRefRequiredStepEdit>();
                if (requiredStep == null || requiredStep.CrossRefProcessId == null)
                    return false;
            }

            return CanBeDestinationField(field.ColumnType);
        }