示例#1
0
        /// <summary>
        /// Remove all word bookmark that not exist on internal bookmark collection
        /// </summary>
        /// <param name="iBms"></param>
        public void ValidateBookmarkCollection(string key)
        {
            // 1. Get all word bookmark
            // 2. If bookmark in word not exist in internal bookmark
            // 2.1. markup this to return
            // 2.2. if isUpdate = true, we delete its
            try
            {
                ContentServiceProfile contentProfile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key).ContentService;
                InternalBookmark      iBms           = Wkl.MainCtrl.CommonCtrl.GetTemplateInfo(
                    contentProfile.ValidateBookmark_ITemplateName).InternalBookmark;

                GetBookmarkCollection(key);

                List <string> deletedList        = new List <string>();
                Dictionary <string, string> wBms = contentProfile.GetBookmarks_OListBM;

                foreach (string bmKey in wBms.Keys)
                {
                    InternalBookmarkItem item = iBms.GetInternalBookmarkItem(bmKey);

                    if (item == null || item.BizName != wBms[bmKey]) // compare key and value
                    {
                        if (MarkupUtilities.IsProntoDocCommentBookmark(bmKey) ||
                            MarkupUtilities.IsPdeTagBookmark(bmKey))
                        {
                            continue;
                        }

                        deletedList.Add(wBms[bmKey]);
                        contentProfile.HighlightBookmarkName = bmKey;
                        HighlightBookmark(key);

                        if (contentProfile.ValidateBookmark_IIsUpdate)
                        {
                            contentProfile.DeletedBookmarkName = bmKey;
                            contentProfile.DeleteWholeBookmark = false;
                            DeleteBookmark(key);
                        }
                    }
                }

                contentProfile.ValidateBookmark_ORemovedList = deletedList;
            }
            catch (BaseException srvExp)
            {
                Services.ServiceException newSrvExp = new Services.ServiceException(ErrorCode.ipe_ValidateWordBookmarkError);
                newSrvExp.Errors.Add(srvExp);

                throw newSrvExp;
            }
            catch (Exception ex)
            {
                ServiceException srvExp = new ServiceException(ErrorCode.ipe_ValidateWordBookmarkError,
                                                               MessageUtils.Expand(Properties.Resources.ipe_ValidateWordBookmarkError, ex.Message), ex.StackTrace);

                throw srvExp;
            }
        }
示例#2
0
        private string GetPdeDataType(string key, InternalBookmark ibm)
        {
            if (ibm == null || string.IsNullOrWhiteSpace(key))
            {
                return(string.Empty);
            }

            InternalBookmarkItem ibmItem = ibm.GetInternalBookmarkItem(key);

            if (ibmItem == null)
            {
                return(string.Empty);
            }

            return(MarkupUtilities.SqlDbType2XsdDataType(ibmItem.DataType));
        }
示例#3
0
        public PartBookmark(string name, InternalBookmark ibookmark)
        {
            InternalBookmarkItem bookmark = ibookmark.GetInternalBookmarkItem(name);

            if (bookmark != null)
            {
                BizName = bookmark.OrginalBizName;

                Key = name;
            }
            else
            {
                PdeDataTagInfo pdeTag = ibookmark.GetPdeDataTagInfo(name);

                if (pdeTag != null)
                {
                    BizName = pdeTag.BookmarkName;

                    Key = name;
                }
            }

            InitializeBookmark();
        }