Пример #1
0
 public static List <Declaration> GetChunkDeclarations()
 {
     if (OnDemandProcessingManager.m_ChunkDeclarations == null)
     {
         List <Declaration> list = new List <Declaration>(21);
         list.Add(ScopeInstance.GetDeclaration());
         list.Add(ReportInstance.GetDeclaration());
         list.Add(DataSetInstance.GetDeclaration());
         list.Add(DataRegionInstance.GetDeclaration());
         list.Add(DataRegionMemberInstance.GetDeclaration());
         list.Add(DataCellInstance.GetDeclaration());
         list.Add(DataAggregateObjResult.GetDeclaration());
         list.Add(SubReportInstance.GetDeclaration());
         list.Add(GroupTreePartition.GetDeclaration());
         list.Add(ReportSnapshot.GetDeclaration());
         list.Add(ParametersImplWrapper.GetDeclaration());
         list.Add(ParameterImplWrapper.GetDeclaration());
         list.Add(SubReportInfo.GetDeclaration());
         list.Add(ParameterInfo.GetNewDeclaration());
         list.Add(ParameterInfoCollection.GetDeclaration());
         list.Add(ParameterBase.GetNewDeclaration());
         list.Add(ValidValue.GetNewDeclaration());
         list.Add(FieldInfo.GetDeclaration());
         list.Add(TreePartitionManager.GetDeclaration());
         list.Add(LookupObjResult.GetDeclaration());
         list.Add(DataCellInstanceList.GetDeclaration());
         return(list);
     }
     return(OnDemandProcessingManager.m_ChunkDeclarations);
 }
Пример #2
0
 internal static List <Declaration> GetChunkDeclarations()
 {
     if (m_ChunkDeclarations == null)
     {
         return(new List <Declaration>(21)
         {
             ScopeInstance.GetDeclaration(),
             ReportInstance.GetDeclaration(),
             DataSetInstance.GetDeclaration(),
             DataRegionInstance.GetDeclaration(),
             DataRegionMemberInstance.GetDeclaration(),
             DataCellInstance.GetDeclaration(),
             DataAggregateObjResult.GetDeclaration(),
             SubReportInstance.GetDeclaration(),
             GroupTreePartition.GetDeclaration(),
             ReportSnapshot.GetDeclaration(),
             ParametersImplWrapper.GetDeclaration(),
             ParameterImplWrapper.GetDeclaration(),
             SubReportInfo.GetDeclaration(),
             ParameterInfo.GetNewDeclaration(),
             ParameterInfoCollection.GetDeclaration(),
             ParameterBase.GetNewDeclaration(),
             ValidValue.GetNewDeclaration(),
             FieldInfo.GetDeclaration(),
             TreePartitionManager.GetDeclaration(),
             LookupObjResult.GetDeclaration(),
             DataCellInstanceList.GetDeclaration()
         });
     }
     return(m_ChunkDeclarations);
 }
        public SubReportInfo GetSubReportInfo(bool isTopLevelSubreport, string definitionPath, string reportPath)
        {
            SubReportInfo result    = null;
            bool          condition = this.TryGetSubReportInfo(isTopLevelSubreport, definitionPath, reportPath, out result);

            Global.Tracer.Assert(condition, "Missing expected SubReportInfo: {0}_{1}", definitionPath, reportPath.MarkAsPrivate());
            return(result);
        }
Пример #4
0
        /// <summary>
        /// Duplicate button click handler.
        /// </summary>
        private void _DuplicateTemplate_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                ReportInfo selectedInfo = _GetSelectedInfo();
                if (null != selectedInfo)
                {
                    ReportsGenerator generator = App.Current.ReportGenerator;

                    // generate new name
                    string dir = Path.GetDirectoryName(selectedInfo.TemplatePath);

                    // create sub reports
                    List <SubReportInfo> subReports = new List <SubReportInfo>();
                    foreach (SubReportInfo subReport in selectedInfo.SubReports)
                    {
                        string        subNameNew      = _GetNameForDublicate(subReport.Name);
                        string        subTemplatePath = ReportsGenerator.GetNewTemplatePath(subNameNew, subReport.TemplatePath);
                        SubReportInfo newSubReport    = new SubReportInfo(subNameNew, subTemplatePath, subReport.Description,
                                                                          subReport.IsDefault, subReport.GroupId,
                                                                          subReport.IsVisible);
                        // copy template file for subreport template
                        _DuplicateReportFile(subReport.TemplatePath, newSubReport.TemplatePath);

                        subReports.Add(newSubReport);
                    }

                    // create new info
                    string     nameNew      = _GetNameForDublicate(selectedInfo.Name);
                    string     templatePath = ReportsGenerator.GetNewTemplatePath(nameNew, selectedInfo.TemplatePath);
                    ReportInfo newInfo      = new ReportInfo(nameNew, selectedInfo.Context, templatePath, selectedInfo.Description,
                                                             false, subReports);

                    // copy template file for template
                    _DuplicateReportFile(selectedInfo.TemplatePath, newInfo.TemplatePath);

                    generator.AddReportInfo(newInfo);
                    _itemToSelection = newInfo.Name;
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                App.Current.Messenger.AddError(ex.Message);
            }

            _InitReportTable();
        }
        public SubReportInfo AddSubReportInfo(bool isTopLevelSubreport, string definitionPath, string reportPath, string originalCatalogReportPath)
        {
            this.m_metaDataChanged = true;
            if (this.m_subReportInfoMap == null)
            {
                this.m_subReportInfoMap = new Dictionary <string, SubReportInfo>(EqualityComparers.StringComparerInstance);
            }
            Global.Tracer.Assert(!this.m_subReportInfoMap.ContainsKey(definitionPath), "(!m_subReportInfoMap.ContainsKey(definitionPath))");
            SubReportInfo subReportInfo = new SubReportInfo(Guid.NewGuid());

            this.m_subReportInfoMap.Add(definitionPath, subReportInfo);
            string reportPath2 = isTopLevelSubreport ? reportPath : (definitionPath + "_" + reportPath);
            bool   flag        = default(bool);

            subReportInfo.CommonSubReportInfo = this.GetOrCreateCommonSubReportInfo(reportPath2, out flag);
            if (flag)
            {
                subReportInfo.CommonSubReportInfo.DefinitionUniqueName = subReportInfo.UniqueName;
                subReportInfo.CommonSubReportInfo.OriginalCatalogPath  = originalCatalogReportPath;
            }
            return(subReportInfo);
        }
        public bool TryCreateObject(ObjectType objectType, out IPersistable persistObj)
        {
            switch (objectType)
            {
            case ObjectType.DataCellInstance:
                persistObj = new DataCellInstance();
                break;

            case ObjectType.DataAggregateObjResult:
                persistObj = new DataAggregateObjResult();
                break;

            case ObjectType.DataRegionMemberInstance:
                persistObj = new DataRegionMemberInstance();
                break;

            case ObjectType.DataRegionInstance:
                persistObj = new DataRegionInstance();
                break;

            case ObjectType.DataSetInstance:
                persistObj = new DataSetInstance();
                break;

            case ObjectType.ReportInstance:
                persistObj = new ReportInstance();
                break;

            case ObjectType.OnDemandMetadata:
                persistObj = new OnDemandMetadata();
                break;

            case ObjectType.GroupTreePartition:
                persistObj = new GroupTreePartition();
                break;

            case ObjectType.IntermediateFormatVersion:
                persistObj = new IntermediateFormatVersion();
                break;

            case ObjectType.ReportSnapshot:
                persistObj = new ReportSnapshot();
                break;

            case ObjectType.SubReportInstance:
                persistObj = new SubReportInstance();
                break;

            case ObjectType.Parameters:
                persistObj = new ParametersImplWrapper();
                break;

            case ObjectType.Parameter:
                persistObj = new ParameterImplWrapper();
                break;

            case ObjectType.SubReportInfo:
                persistObj = new SubReportInfo();
                break;

            case ObjectType.CommonSubReportInfo:
                persistObj = new CommonSubReportInfo();
                break;

            case ObjectType.ParameterInfo:
                persistObj = new ParameterInfo();
                break;

            case ObjectType.ParameterInfoCollection:
                persistObj = new ParameterInfoCollection();
                break;

            case ObjectType.ParametersLayout:
                persistObj = new ParametersGridLayout();
                break;

            case ObjectType.ParameterGridLayoutCellDefinition:
                persistObj = new ParameterGridLayoutCellDefinition();
                break;

            case ObjectType.ValidValue:
                persistObj = new ValidValue();
                break;

            case ObjectType.FieldInfo:
                persistObj = new FieldInfo();
                break;

            case ObjectType.ImageInfo:
                persistObj = new ImageInfo();
                break;

            case ObjectType.TreePartitionManager:
                persistObj = new TreePartitionManager();
                break;

            case ObjectType.LookupObjResult:
                persistObj = new LookupObjResult();
                break;

            case ObjectType.ShapefileInfo:
                persistObj = new ShapefileInfo();
                break;

            case ObjectType.UpdatedVariableValues:
                persistObj = new UpdatedVariableValues();
                break;

            case ObjectType.DataCellInstanceList:
                persistObj = new DataCellInstanceList();
                break;

            default:
                persistObj = null;
                return(false);
            }
            return(true);
        }
        public bool TryGetSubReportInfo(bool isTopLevelSubreport, string definitionPath, string reportPath, out SubReportInfo subReportInfo)
        {
            subReportInfo = null;
            if (this.m_subReportInfoMap != null && this.m_subReportInfoMap.TryGetValue(definitionPath, out subReportInfo))
            {
                if (subReportInfo.CommonSubReportInfo == null)
                {
                    string key = isTopLevelSubreport ? reportPath : (definitionPath + "_" + reportPath);
                    if (this.m_commonSubReportInfoMap != null)
                    {
                        CommonSubReportInfo commonSubReportInfo = default(CommonSubReportInfo);
                        if (this.m_commonSubReportInfoMap.TryGetValue(key, out commonSubReportInfo))
                        {
                            subReportInfo.CommonSubReportInfo = commonSubReportInfo;
                            return(true);
                        }
                        int length = reportPath.Length;
                        foreach (string key2 in this.m_commonSubReportInfoMap.Keys)
                        {
                            if (key2.Length >= length)
                            {
                                int num = key2.LastIndexOf(reportPath, StringComparison.OrdinalIgnoreCase);
                                if (num >= 0 && num + length == key2.Length)
                                {
                                    subReportInfo.CommonSubReportInfo = this.m_commonSubReportInfoMap[key2];
                                    return(true);
                                }
                            }
                        }
                        goto IL_00e7;
                    }
                    subReportInfo = null;
                    return(false);
                }
                goto IL_00e7;
            }
            return(false);

IL_00e7:
            return(true);
        }