/// <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;
        }
    }
Beispiel #2
0
        /// <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;
        }
Beispiel #3
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 "";
        }
    }