Beispiel #1
0
        /// <summary>
        /// find the domain has max match with domain name
        /// </summary>
        /// <param name="ibmDomain"></param>
        /// <param name="matched"></param>
        /// <param name="domainName"></param>
        /// <returns></returns>
        private DomainMatch FindTheNearestDomain(InternalBookmarkDomain ibmDomain, DomainMatchItem matched, string domainName)
        {
            DomainMatch matchResult = new DomainMatch()
            {
                DomainName = domainName
            };

            matchResult.DomainMatchItems = new Dictionary <string, DomainMatchItem>();
            if (matched != null)
            {
                matchResult.DomainMatchItems.Add(domainName, matched);
            }

            // check all domain
            DataSegmentHelper.GetListDomain();
            List <string> domains = Wkl.MainCtrl.CommonCtrl.CommonProfile.ListDomains.Keys.ToList();

            foreach (string domain in domains)
            {
                if (domainName != domain)
                {
                    DomainMatchItem result = IsMatchWithDataSegment(ibmDomain, domain);
                    if (result != null)
                    {
                        matchResult.DomainMatchItems.Add(domain, result);
                    }
                }
            }

            return(matchResult);
        }
Beispiel #2
0
        private void HighlightNotMatchFields(DomainMatch domainMatch)
        {
            try
            {
                foreach (DomainMatchItem matchItem in domainMatch.DomainMatchItems.Values)
                {
                    foreach (string wBmValue in matchItem.NotMatchBizs)
                    {
                        foreach (Bookmark wBm in Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc.Bookmarks)
                        {
                            if (MarkupUtilities.GetRangeText(wBm.Range) == wBmValue)
                            {
                                wBm.Range.HighlightColorIndex = ProntoMarkup.BackgroundHighLight;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ManagerException mgrExp = new ManagerException(ErrorCode.ipe_HighlightBookmarkError,
                                                               MessageUtils.Expand(Properties.Resources.ipe_HighlightBookmarkError, ex.Message), ex.StackTrace);

                throw mgrExp;
            }
        }
Beispiel #3
0
        /// <summary>
        /// Validate Internal Bookmark is match with any Domain. Key is full name of document
        /// </summary>
        /// <param name="fullDocName"></param>
        public void IsInternalBMMatchWithDomain(string key)
        {
            //1.Get InternalBM
            //2.Get Checksum information
            //3.Load Data from datasegment.
            //4.Check match
            try
            {
                IntegrationServiceProfile integrationProfile = Wkl.MainCtrl.ServiceCtrl.GetProfile(key).IntegrationService;
                TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.GetTemplateInfo(integrationProfile.TemplateFileName);

                string          srvKey = string.Empty;
                ServicesProfile srvPro = Wkl.MainCtrl.ServiceCtrl.CreateProfile(out srvKey);
                GetInternalBookmark(srvKey);
                templateInfo.InternalBookmark = srvPro.Ibm;
                templateInfo.UpdateDomainNames();
                templateInfo.PdeContent = srvPro.PdeContent;
                Wkl.MainCtrl.ServiceCtrl.RemoveDataObject(srvKey);

                //Get Checksum Info.
                ChecksumInfo checksum = GetChecksum();

                integrationProfile.CheckMatchWithDomain_OListMatch = new List <DomainMatch>();
                integrationProfile.Result = true;
                foreach (InternalBookmarkDomain ibmDomain in templateInfo.InternalBookmark.InternalBookmarkDomains)
                {
                    DomainMatchItem domainMatchItem = IsMatchWithDataSegment(ibmDomain, ibmDomain.DomainName);
                    if (domainMatchItem != null && (!domainMatchItem.IsMatch || !domainMatchItem.IsMatchRelationOn)) // not match
                    {
                        DomainMatch domainMatch = FindTheNearestDomain(ibmDomain, domainMatchItem, ibmDomain.DomainName);
                        integrationProfile.CheckMatchWithDomain_OListMatch.Add(domainMatch);
                        integrationProfile.Result = false;
                    }
                }
            }
            catch (BaseException srvExp)
            {
                Services.ServiceException newSrvExp = new Services.ServiceException(ErrorCode.ipe_ValidateIbmWithDomainError);
                newSrvExp.Errors.Add(srvExp);

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