Exemple #1
0
        private ContentCollectionCriteria GetCollectionCriteria(long CollectionID)
        {
            var criteria = new ContentCollectionCriteria();

            criteria.AddFilter(CollectionID);
            return(criteria);
        }
        /// <summary>
        /// Get the  collection ids
        /// </summary>  
        /// 
        public static Dictionary<long, string> getCollectionContentIds(long collectionID)
        {
            Dictionary<long, string> contenIdTitles = new Dictionary<long, string>();
            var contentManager2 = new Ektron.Cms.Framework.Content.ContentManager();
            var criteria2 = new ContentCollectionCriteria();
            criteria2.AddFilter(collectionID);
            criteria2.OrderByCollectionOrder = true;
            var collectionList = contentManager2.GetList(criteria2);

            for (int i = 0; i < collectionList.Count; i++)
            {
                contenIdTitles.Add(collectionList[i].Id, collectionList[i].Title);
            }
            return contenIdTitles;
        }
    /// <summary>
    /// This method is used to dislay selected news items as metadata
    /// </summary>
    /// <param name="cData"></param>
    /// 
    public void getAssignedCollection()
    {
        //let check if it has its own sidewidget
           // sideWidget = cf.getSideWidget(contentId);
        string sideWidget = "";
          //  long contentId = long.Parse(ccontentID); // cData.Id;

        long sideNavBarMenuID = 0;
          // Response.Write(cfolderID.ToString());

        SqlDataReader rdr = null;

        string str = ConfigurationManager.ConnectionStrings["Ektron.DbConnection"].ConnectionString;

        List<string> allParentFolder = new List<string>();
        using (SqlConnection sqlConnection1 = new SqlConnection(str))
        {
            using (SqlCommand cmd = new SqlCommand())
            {

                cmd.CommandText = "getParentFolder";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add(new SqlParameter("@folderID", cfolderID));
                cmd.Connection = sqlConnection1;

                sqlConnection1.Open();

                rdr = cmd.ExecuteReader();
                if (rdr.HasRows)
                {
                    while (rdr.Read())
                    {
                        allParentFolder.Add(rdr["parent_folder_id"].ToString());
                    }
                }

                rdr.Close();

            }
        }

        //Collection check
        Dictionary<string, long> menuCol = new Dictionary<string, long>();
        foreach (var FolderId in allParentFolder)
        {
            menuCol = commonfunctions.getAssignedMenuNCollectionId(long.Parse(FolderId.ToString()));
            foreach (var f in menuCol)
            {
                if (f.Key == "CollectionID")
                {

                    if (f.Value > 0)
                    {
                        CollectionID = f.Value;

                    }
                }

            }

            if (CollectionID > 0)
            {
                break;

            }

        }

        ///lets continue the journey
        ///

        if (sideWidget == "" && CollectionID > 0)
        {

            var contentManager2 = new Ektron.Cms.Framework.Content.ContentManager();
            var criteria2 = new ContentCollectionCriteria();
            criteria2.AddFilter(CollectionID);
            criteria2.OrderByCollectionOrder = true;
            var contentList2 = contentManager2.GetList(criteria2);

            for (int jk = 0; jk < contentList2.Count; jk++)
            {
                sideWidgetContent += getSideWidgetDetails(contentList2[jk].Id);
            }

        }
        else
        {
           // sideWidgetContent = sideWidget;
        }
    }
Exemple #4
0
    private string getLinks(long collectionID, long linkscount=4)
    {
        if (collectionID > 0)
        {

            string resultreturned = "";
            var contentManager2 = new Ektron.Cms.Framework.Content.ContentManager();
            var criteria2 = new ContentCollectionCriteria();
            criteria2.AddFilter(collectionID);
            criteria2.OrderByCollectionOrder = true;
            var contentList2 = contentManager2.GetList(criteria2);

            for (int jk = 0; jk < linkscount; jk++)
            {
                string quicklink = contentList2[jk].Quicklink;
                string title = contentList2[jk].Title;
                resultreturned += "<li><a href='" + quicklink + "' title='" + title + "' aria-label='" + title + "'>" + title + "</a></li>";

            }

            return resultreturned;
        }
        else
        {
            return "";
        }
    }
Exemple #5
0
    /// <summary>
    /// Page Init
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Init(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                long contentId = long.Parse(Request.QueryString["id"]);
            //    this.GetContentData(contentId);
            }
        }

        RightSideContent.ccontentID = mainContent.EkItem.Id.ToString();
        RightSideContent.cfolderID = mainContent.EkItem.FolderId.ToString();
        uxPageTitle.pgTitle = mainContent.EkItem.Title.ToString();
        uxPageTitle.pageId = mainContent.EkItem.Id.ToString();
        uxPageTitle.ResourceTypeId = "2";

          //  List<string> listSideWidgetIDs = new List<string>();
        var contentManager2 = new Ektron.Cms.Framework.Content.ContentManager();
        var criteria2 = new ContentCollectionCriteria();
        criteria2.AddFilter(13);
        criteria2.OrderByCollectionOrder = true;
        var staffList = contentManager2.GetList(criteria2);

        for (int jk = 0; jk < staffList.Count; jk++)
        {
             // Response.Write(staffList[jk].Id.ToString());
          //  listSideWidgetIDs.Add(contentList2[jk].Id.ToString());

             ouptput+= getStaffList(staffList[jk].Id);
        }

        //string[] terms = listSideWidgetIDs.ToArray();
    }
Exemple #6
0
 /// <summary>
 /// Adds an exact match filter for <see cref="ContentCollectionProperty.Title"/>.
 /// </summary>
 /// <param name="criteria">The criteria to extend.</param>
 /// <param name="name">The collection title.</param>
 /// <returns>The updated criteria.</returns>
 public static ContentCollectionCriteria ByCollection(this ContentCollectionCriteria criteria, string name)
 {
     criteria.AddFilter(name);
     return(criteria);
 }
Exemple #7
0
 /// <summary>
 /// Adds an exact match filter for <see cref="ContentCollectionProperty.Id"/>.
 /// </summary>
 /// <param name="criteria">The criteria to extend.</param>
 /// <param name="id">The collection id.</param>
 /// <returns>The updated criteria.</returns>
 public static ContentCollectionCriteria ByCollection(this ContentCollectionCriteria criteria, long id)
 {
     criteria.AddFilter(id);
     return(criteria);
 }