コード例 #1
0
ファイル: DateMetric.cs プロジェクト: danMateer/platform
        public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
        {
            var clone = BaseClone <DateMetric>(template, metricGroup);

            clone.HasTimeValue = HasTimeValue;
            return(clone);
        }
コード例 #2
0
ファイル: NumericMetric.cs プロジェクト: danMateer/platform
        public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
        {
            var clone = BaseClone <NumericMetric>(template, metricGroup);

            clone.MaxVal = MaxVal;
            return(clone);
        }
コード例 #3
0
        public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
        {
            var clone = BaseClone <AttachmentMetric>(template, metricGroup);

            clone.AllowMultipleFiles     = AllowMultipleFiles;
            clone.AllowedAttachmentTypes = new List <AttachmentType>(AllowedAttachmentTypes);

            return(clone);
        }
コード例 #4
0
        public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
        {
            var clone = BaseClone <MultipleChoiceMetric>(template, metricGroup);

            clone.DataList   = DataList.IsAdHoc ? DataList.Clone() : (DataList)null; // Create a new datalist only if it is an ad-hoc
            clone.DataListId = DataList.IsAdHoc ? (Guid)Guid.Empty : DataListId;
            clone.ViewType   = ViewType;
            return(clone);
        }
コード例 #5
0
ファイル: FreeTextMetric.cs プロジェクト: danMateer/platform
        public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
        {
            var clone = BaseClone <FreeTextMetric>(template, metricGroup);

            clone.MaxLength    = MaxLength;
            clone.NumberOfLine = NumberOfLine;
            clone.MinLength    = MinLength;

            return(clone);
        }
コード例 #6
0
ファイル: RateMetric.cs プロジェクト: danMateer/platform
        public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
        {
            var clone = BaseClone <RateMetric>(template, metricGroup);

            clone.MaxValue     = MaxValue;
            clone.MinValue     = MinValue;
            clone.DefaultValue = DefaultValue;
            clone.DataList     = DataList.IsAdHoc ? DataList.Clone() : null; // Create a new datalist only if it is an ad-hoc
            clone.DataListId   = DataList.IsAdHoc ? null : DataListId;

            return(clone);
        }
コード例 #7
0
ファイル: Metric.cs プロジェクト: danMateer/platform
        protected T BaseClone <T>(FormTemplate cloneTemplate, MetricGroup cloneMetricGroup) where T : Metric, new()
        {
            var clone = new T()
            {
                FormTemplate = cloneMetricGroup.FormTemplate,
                Description  = Description,
                Mandatory    = Mandatory,
                Order        = Order,
                SectionTitle = SectionTitle,
                ShortTitle   = ShortTitle,
                DateArchived = DateArchived,
            };

            return(clone);
        }
コード例 #8
0
ファイル: MetricGroup.cs プロジェクト: danMateer/platform
        public MetricGroup Clone(FormTemplate cloneTemplate)
        {
            var clonedGroup = new MetricGroup
            {
                FormTemplate                                   = cloneTemplate,
                CanAddMoreRows                                 = CanAddMoreRows,
                DataList                                       = DataList?.IsAdHoc ?? false?DataList.Clone() : (DataList)null, // Create a new datalist only if it is an ad-hoc
                                                  DataListId   = DataList?.IsAdHoc ?? true ? (Guid?)null : DataListId,
                                                  HelpContext  = HelpContext,
                                                  NumberOfRows = NumberOfRows,
                                                  Order        = Order,
                                                  Page         = Page,
                                                  Title        = Title
            };

            foreach (var metric in Metrics)
            {
                clonedGroup.Metrics.Add(metric.Clone(cloneTemplate, clonedGroup));
            }

            return(clonedGroup);
        }
コード例 #9
0
ファイル: FormTemplate.cs プロジェクト: danMateer/platform
        public FormTemplate Clone()
        {
            var clone = new FormTemplate
            {
                Code                   = Code,
                Colour                 = Colour,
                Description            = Description,
                DescriptionFormat      = DescriptionFormat,
                FormTemplateCategoryId = FormTemplateCategoryId,
                IsPublished            = false,
                OrganisationId         = OrganisationId,
                ProjectId              = ProjectId,
                Title                  = Title,
                Version                = Version,
                Discriminator          = Discriminator
            };

            foreach (var metricGroup in MetricGroups)
            {
                clone.MetricGroups.Add(metricGroup.Clone(clone));
            }

            return(clone);
        }
コード例 #10
0
 public override Metric Clone(FormTemplate template, MetricGroup metricGroup)
 {
     return(BaseClone <DichotomousMetric>(template, metricGroup));
 }
コード例 #11
0
ファイル: Metric.cs プロジェクト: danMateer/platform
 public virtual Metric Clone(FormTemplate template, MetricGroup metricGroup)
 {
     throw new InvalidOperationException();
 }