コード例 #1
0
        /// <summary>
        ///     Gets the page template blobs for the specific type and users (optional)
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="pageTemplateType">Type of the page template.</param>
        /// <param name="userName">The page template user names.</param>
        /// <returns>
        ///     Returns a <see cref="IEnumerable{KeyValuePair{TKey, TValue}}" /> representing the page template and blob
        ///     value.
        /// </returns>
        public static IEnumerable <KeyValuePair <IMMPageTemplateName, IMemoryBlobStream> > GetBlobPageTemplates(this IMMPageTemplateManager source, mmPageTemplateType pageTemplateType, params string[] userName)
        {
            var filter = new QueryFilterClass();

            filter.WhereClause = "TEMPLATE IS NOT NULL";

            if (userName != null && userName.Any())
            {
                filter.WhereClause = string.Format("{0} AND USERNAME IN ('{1}')", filter.WhereClause, string.Join("','", userName));
            }

            ((IQueryFilterDefinition2)filter).PostfixClause = "ORDER BY USERNAME";

            var system = pageTemplateType == mmPageTemplateType.mmPTTSystem;

            return(GetPageTemplatesImpl(source, system, filter, row =>
            {
                var name = (string)row.Value[row.Fields.FindField("NAME")];
                var blob = (IMemoryBlobStream)row.Value[row.Fields.FindField("TEMPLATE")];

                var i = new MMPageTemplateNameClass();
                i.Initialize(row.OID, name, pageTemplateType);

                return new KeyValuePair <IMMPageTemplateName, IMemoryBlobStream>(i, blob);
            }));
        }
コード例 #2
0
ファイル: PERFQA_ARCFM.cs プロジェクト: UDCUS/ArcFM_PerfQA
        private bool OpenPageTemplate(string SDName, string SDType)
        {
            try
            {
                this.Logger.WriteLine("OpenPageTemplate:" + SDName);

                IMMPageTemplateName pPTName;
                IMMEnumPageTemplateName pEPT;

                if (SDName == "")
                {
                    this.Logger.WriteLine("PageTemplate Name not provided");
                    return false;
                }
                else
                {
                    if (_PTMGR == null)
                    {
                        _PTMGR = (IMMPageTemplateManager) new MMPageTemplateManager();
                    }
                    _PTMGR.Workspace = this.Workspace;
                    pPTName = new MMPageTemplateNameClass();
                    pPTName.Name = SDName;

                    if (SDType.ToUpper() == "SYSTEM")
                    {
                        pEPT = _PTMGR.GetPageTemplateNames(mmPageTemplateType.mmPTTSystem);
                    }
                    else
                    {
                        pEPT = _PTMGR.GetPageTemplateNames(mmPageTemplateType.mmPTTUser);
                    }
                    // Get list of Stored Displays.  We have to do this because we have not logged in to ArcFM.
                    pPTName = pEPT.Next();
                    while (pPTName != null)
                    {
                        if (pPTName.Name.Trim().ToUpper() == SDName.Trim().ToUpper())
                        {
                            SW1.Reset();
                            SW1.Start();
                            try
                            {
                                _PTMGR.OpenPageTemplate(pPTName);
                                SW1.Stop();
                                RecordActionTime("Open Page Template :", SW1.ElapsedMilliseconds);
                            }
                            catch (Exception EX)
                            {
                                this.Logger.WriteLine("Error Opening Page Tempate :" + EX.Message + ":" + EX.StackTrace);
                                SW1.Stop();
                            }
                            break;
                        }
                        pPTName = pEPT.Next();
                    }
                    if (pPTName == null)
                    {
                        this.Logger.WriteLine("PageTemplate not found:" + SDName);
                        return false;
                    }
                    else
                    {
                        return true;
                    }
                }
            }
            catch (Exception EX)
            {
                this.Logger.WriteLine("Error in OpenPageTempate:" + EX.Message + ":" + EX.StackTrace);
                return false;
            }
        }