Ejemplo n.º 1
0
        public void RemoveRelatedLink(int siteId, string contentType, int contentId, int relatedId)
        {
            IBaseContent content = this.GetContent(siteId, contentType, contentId);

            content.LinkManager.RemoveRelatedLink(relatedId);
            content.LinkManager.SaveRelatedLinks();
        }
Ejemplo n.º 2
0
        private RelatedLinkDto ConvertToLinkDto(int siteId, IContentLink link)
        {
            ISite        site      = this._siteRep.GetSiteById(link.RelatedSiteId);
            IBaseContent content   = this.GetContent(site.GetAggregaterootId(), ContentTypeIndent.Archive.ToString().ToLower(), link.RelatedContentId);
            String       thumbnail = null;
            IArchive     archive   = content as IArchive;

            if (archive != null)
            {
                thumbnail = archive.Get().Thumbnail;
            }

            return(new RelatedLinkDto
            {
                Id = link.Id,
                Enabled = link.Enabled,
                ContentId = link.ContentId,
                ContentType = link.ContentType,
                RelatedSiteId = link.RelatedSiteId,
                RelatedSiteName = site.Get().Name,
                RelatedContentId = link.RelatedContentId,
                RelatedIndent = link.RelatedIndent,
                Title = archive.Get().Title,
                Url = site.FullDomain + archive.Get().Path,
                Thumbnail = thumbnail,
                IndentName = ContentUtil.GetRelatedIndentName(link.RelatedIndent).Name,
            });
        }
Ejemplo n.º 3
0
        public IEnumerable <RelatedLinkDto> GetRelatedLinks(int siteId, string contentType, int contentId)
        {
            IBaseContent         content  = this.GetContent(siteId, contentType, contentId);
            IList <IContentLink> linkList = content.LinkManager.GetRelatedLinks();

            foreach (IContentLink link in linkList)
            {
                yield return(this.ConvertToLinkDto(siteId, link));
            }
        }
Ejemplo n.º 4
0
        public void RemoveRelatedLink(int siteId, string typeIndent, int contentId, int relatedLinkId)
        {
            IBaseContent content = this.GetContent(siteId, typeIndent, contentId);

            if (relatedLinkId > 0)
            {
                ILink link = content.LinkManager.GetLinkById(relatedLinkId);
                content.LinkManager.Remove(link);
            }
            else
            {
                throw new Exception("relatedLinkId无效");
            }

            content.LinkManager.SaveLinks();
        }
Ejemplo n.º 5
0
        public void MoveToSort(int siteId, int id, int direction)
        {
            IBaseContent archive = this._contentRep.GetContent(siteId).GetArchiveById(id);

            if (archive == null)
            {
                throw new ArgumentException("no such archive", "id");
            }

            if (direction == 1)
            {
                archive.SortUpper();
            }
            else if (direction == 2)
            {
                archive.SortLower();
            }
        }
Ejemplo n.º 6
0
        public void MoveSortNumber(int siteId, int id, int direction)
        {
            IBaseContent archive = _contentRep.GetContent(siteId).GetArchiveById(id);

            if (archive == null)
            {
                throw new ArgumentException("no such archive", "id");
            }

            if (direction == 1)
            {
                archive.MoveSortUp();
            }
            else if (direction == 2)
            {
                archive.MoveSortDown();
            }
        }
Ejemplo n.º 7
0
        public IBaseContent GetContent(string contentType, int contentId)
        {
            IBaseContent content = null;

            switch (contentType.ToLower())
            {
            case "1":
            case "archive":
                //content = this._archiveRep.CreateArchive(contentId, null, -1, null);
                content = this._archiveRep.GetArchiveById(this.SiteId, contentId);
                break;
            }
            if (content == null)
            {
                throw new Exception("内容不存在");
            }
            return(content);
        }
Ejemplo n.º 8
0
        public int SaveRelatedLink(int siteId, RelatedLinkDto linkDto)
        {
            IBaseContent content = this.GetContent(siteId, linkDto.ContentType, linkDto.ContentId);

            if (linkDto.Id > 0)
            {
                IContentLink link = content.LinkManager.GetLinkById(linkDto.Id);
                link.RelatedIndent    = linkDto.RelatedIndent;
                link.RelatedContentId = linkDto.RelatedContentId;
                link.Enabled          = linkDto.Enabled;
                link.RelatedSiteId    = linkDto.RelatedSiteId;
            }
            else
            {
                content.LinkManager.Add(linkDto.Id, linkDto.RelatedSiteId, linkDto.RelatedIndent, linkDto.RelatedContentId, linkDto.Enabled);
            }

            content.LinkManager.SaveRelatedLinks();
            return(linkDto.Id);
        }
Ejemplo n.º 9
0
        public int SaveRelatedLink(int siteId, string typeIndent, int contentId, LinkDto link)
        {
            IBaseContent content = this.GetContent(siteId, typeIndent, contentId);

            if (link.LinkID > 0)
            {
                ILink _link = content.LinkManager.GetLinkById(link.LinkID);
                _link.LinkTitle = link.LinkTitle;
                _link.LinkName  = link.LinkName;
                _link.LinkUri   = link.LinkUri;
                _link.Enabled   = link.Enabled;
            }
            else
            {
                content.LinkManager.Add(link.LinkID, link.LinkName, link.LinkTitle, link.LinkUri, link.Enabled);
            }

            content.LinkManager.SaveLinks();
            return(link.LinkID);
        }
Ejemplo n.º 10
0
        public void Parse()
        {
            Cursor = Cursors.WaitCursor;

            DockContent frm = this.FindDocument(title);

            if (frm == null)
            {
                IRepositoryFactory factory = ComponentLocator.Instance().Resolve <IRepositoryFactory>();

                IBaseContent frmNewConent = null;
                try
                {
                    frmNewConent = factory.Create(path);
                    //BaseContent frmNewConent = (BaseContent)ComponentLocator.Instance().Resolve(path, typeof(BaseContent));
                    frmNewConent.DockTitle       = title;
                    frmNewConent.Parentdockpanel = parentpanel;
                    frmNewConent.ShowContent(false);
                }
                catch (Exception ex)
                {
                    log.Info(ex.Message);
                }

                //ComponentLocator.Instance().Release(frmNewConent);
            }
            else
            {
                frm.Show(parentpanel);
                frm.BringToFront();
            }

//            #region ***ExchangeRade 利率管理***
//            if ("FExchangeRate".Equals(path))
//            {
//                DockContent frm = this.FindDocument(title);
//                if (frm == null)
//                {
//                    FrmExchangeRate frmExchangeRate = new FrmExchangeRate(parentpanel);
//                    frmExchangeRate.DockTitle = title;
//                    frmExchangeRate.ShowContent(false);
//                }
//                else
//                {
//                    frm.Show(parentpanel);
//                    frm.BringToFront();
//                }
//            }
//            #endregion
//
//            if ("FCompany".Equals(path))
//            {
//                DockContent frm = this.FindDocument(title);
//                if (frm == null)
//                {
//                    FrmCompany frmcompany = new FrmCompany(parentpanel);
//                    frmcompany.DockTitle = title;
//                    frmcompany.ShowContent(false);
//                }
//                else
//                {
//                    frm.Show(parentpanel);
//                    frm.BringToFront();
//                }
//
//                //DockContent frm = this.FindDocument(e.Node.Text);  // FindDocument(e.Node.Text);
//                //if (frm == null)
//                //{
//                //    FrmCompany frmcompany = new FrmCompany(baseform);
//                //    frmcompany.Show(baseform.dockPanel, DockState.Document);
//                //    frmcompany.BringToFront();
//                //    baseform.Show(this.dockpanel);
//
//                //}
//                //else
//                //{
//                //    frm.Show(this.dockpanel);
//                //    frm.BringToFront();
//                //}
//            }
//            if ("FQuotationEntry".Equals(path))
//            {
//                DockContent frm = this.FindDocument(title);
//                if (frm == null)
//                {
//
//                    FrmProductPlan frmproductplan = new FrmProductPlan(parentpanel);
//                    frmproductplan.DockTitle = title;
//                    frmproductplan.ShowContent(false);
//                }
//                else
//                {
//                    frm.Show(parentpanel);
//                    frm.BringToFront();
//                }
//
//
//            }
//
//            #region 物料管理
//            if ("FMaterial".Equals(path))
//            {
//
//                DockContent frm = this.FindDocument(title);  // FindDocument(e.Node.Text);
//                if (frm == null)
//                {
//                    FrmMaterialSearch frmMaterialSearch = new FrmMaterialSearch(parentpanel);
//                    frmMaterialSearch.DockTitle = title;
//                    frmMaterialSearch.ShowContent(false);
//                }
//                else
//                {
//                    frm.Show(parentpanel);
//                    frm.BringToFront();
//                }
//
//
//            }
//            #endregion
//
//            if ("FFactory".Equals(path))
//            {
//                DockContent frm = this.FindDocument(title);  // FindDocument(e.Node.Text);
//                if (frm == null)
//                {
//                    FrmFactory frmFactory = new FrmFactory(parentpanel);
//                    frmFactory.DockTitle = title;
//                    frmFactory.ShowContent(false);
//                }
//                else
//                {
//                    frm.Show(parentpanel);
//                    frm.BringToFront();
//                }
//            }
//


            Cursor = Cursors.Default;
        }
Ejemplo n.º 11
0
 public static string GetHeroText(IBaseContent that) => that.Value <string>("heroText");
Ejemplo n.º 12
0
 public static string GetHeroHeadline(IBaseContent that) => that.Value <string>("heroHeadline");
Ejemplo n.º 13
0
 /// <summary>Static getter for Title</summary>
 public static string GetTitle(IBaseContent that)
 {
     return(that.GetPropertyValue <string>("title"));
 }
Ejemplo n.º 14
0
 /// <summary>Static getter for Main Content</summary>
 public static IHtmlString GetMainContent(IBaseContent that)
 {
     return(that.GetPropertyValue <IHtmlString>("mainContent"));
 }
 public static string GetPageTitle(IBaseContent that) => that.Value <string>("pageTitle");
 public static string GetPageDescription(IBaseContent that) => that.Value <string>("pageDescription");