Пример #1
0
        /// <summary>
        /// 用超連結網址取得後端作業選項資訊
        /// </summary>
        public OperationOpInfo GetOperationOpInfoByLinkUrl(string linkUrl)
        {
            OperationOpInfo entity = null;

            using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
            {
                entity   = empAuthDao.GetOperationOpInfoByLinkUrl(linkUrl);
                dbErrMsg = empAuthDao.GetErrMsg();
            }

            return(entity);
        }
Пример #2
0
        /// <summary>
        /// 取得後台網頁所屬的作業代碼
        /// </summary>
        public override int GetOpIdOfPage()
        {
            if (opIdOfPage < 1 && qsUrl != "")
            {
                OperationOpInfo opInfo = null;

                using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
                {
                    opInfo = empAuthDao.GetOperationOpInfoByLinkUrl(qsUrl, false);
                    string dbErrMsg = empAuthDao.GetErrMsg();
                }

                if (opInfo != null)
                {
                    opIdOfPage = opInfo.OpId;
                }
            }

            return(opIdOfPage);
        }
Пример #3
0
        /// <summary>
        /// 取得後台網頁所屬的作業代碼
        /// </summary>
        public int GetOpIdOfPage(Guid articleId)
        {
            if (opIdOfPage < 1)
            {
                bool   gotOpId      = false;
                Guid   curArticleId = articleId;
                Guid   curParentId  = Guid.Empty;
                int    curArticleLevelNo;
                string linkUrl = "";
                bool   isRoot  = false;

                // get article info
                ArticleForBackend article = null;

                using (ArticlePublisherDataAccess artPubDao = new ArticlePublisherDataAccess())
                {
                    article = artPubDao.GetArticleDataForBackend(curArticleId);
                    string dbErrMsg = artPubDao.GetErrMsg();
                }

                if (article != null)
                {
                    if (!article.ParentId.HasValue)
                    {
                        isRoot = true;
                    }
                    else
                    {
                        curParentId = article.ParentId.Value;
                    }

                    curArticleLevelNo = article.ArticleLevelNo.Value;
                }

                if (isRoot)
                {
                    opIdOfPage = base.GetOpIdOfPage();
                    return(opIdOfPage);
                }

                do
                {
                    // get opId by LinkUrl
                    linkUrl = string.Format("Article-Node.aspx?artid={0}", curArticleId);
                    OperationOpInfo opInfo = null;

                    using (EmployeeAuthorityDataAccess empAuthDao = new EmployeeAuthorityDataAccess())
                    {
                        opInfo = empAuthDao.GetOperationOpInfoByLinkUrl(linkUrl);
                        string dbErrMsg = empAuthDao.GetErrMsg();
                    }

                    if (opInfo != null)
                    {
                        opIdOfPage = opInfo.OpId;
                        gotOpId    = true;
                    }
                    else
                    {
                        if (curParentId == Guid.Empty)
                        {
                            // parent is root
                            break;
                        }

                        // get parent info
                        ArticleForBackend parent = null;

                        using (ArticlePublisherDataAccess artPubDao = new ArticlePublisherDataAccess())
                        {
                            parent = artPubDao.GetArticleDataForBackend(curParentId);
                            string dbErrMsg = artPubDao.GetErrMsg();
                        }

                        if (parent == null)
                        {
                            logger.Error(string.Format("can not get article data of {0}", curParentId));
                            break;
                        }

                        // move to parent level
                        curArticleId      = curParentId;
                        curParentId       = parent.ParentId.Value;
                        curArticleLevelNo = parent.ArticleLevelNo.Value;
                    }
                } while (!gotOpId);

                if (!gotOpId)
                {
                    opIdOfPage = base.GetOpIdOfPage();
                }
            }

            return(opIdOfPage);
        }