Ejemplo n.º 1
0
        private void CreateNews(MySqlDataReader item)
        {
            HtmlGenericControl NewDiv = new HtmlGenericControl("DIV");

            NewDiv.ID = "scroll-slide";
            NewDiv.Attributes.Add("class", "slide-close");

            HtmlGenericControl Link = new HtmlGenericControl("A");

            Link.Attributes.Add("Href", "ContentPage.aspx?index=" + item["id"].ToString());

            HtmlGenericControl TextSpan = new HtmlGenericControl("SPAN");

            TextSpan.Attributes.Add("class", "cell-text");
            TextSpan.Style.Add(HtmlTextWriterStyle.Padding, "0% 0% 5% 2%");

            HtmlGenericControl Title = new HtmlGenericControl("SPAN");

            Title.Attributes.Add("class", "title");
            Title.InnerText = item["title"].ToString();

            HtmlGenericControl Keywords = new HtmlGenericControl("SPAN");

            Keywords.Attributes.Add("class", "keywords");
            Keywords.InnerText = item["keywords"].ToString();

            HtmlGenericControl Category = new HtmlGenericControl("SPAN");

            Category.Attributes.Add("class", "category");
            Category.InnerText = item["category"].ToString();

            HtmlGenericControl Paragraph = new HtmlGenericControl("SPAN");

            Paragraph.Attributes.Add("class", "promoted-article-text");
            Paragraph.InnerText = (item["text"].ToString().Length <= 40) ? item["text"].ToString() : item["text"].ToString().Substring(0, 40) + "...";

            HtmlGenericControl img   = new HtmlGenericControl("IMG");
            string             image = GetFileInfo.IsPhoto(item["imgurl"].ToString()) ? "./Images/" + item["imgurl"].ToString() : "./Images/defaultplay.png";

            img.Attributes.Add("src", image);
            img.Attributes.Add("class", "images");
            Debug.WriteLine(item["text"].ToString());
            TextSpan.Controls.Add(Title);
            TextSpan.Controls.Add(Paragraph);
            Link.Controls.Add(Keywords);
            Link.Controls.Add(Category);
            Link.Controls.Add(TextSpan);
            Link.Controls.Add(img);
            NewDiv.Controls.Add(Link);
            slider.Controls.Add(NewDiv);
        }
Ejemplo n.º 2
0
        public static bool IsPhoto(string fileName)
        {
            var  list     = GetFileInfo.GetAllPhotosExtensions();
            var  filename = fileName.ToLower();
            bool isThere  = false;

            foreach (var item in list)
            {
                if (filename.EndsWith(item))
                {
                    isThere = true;
                    break;
                }
            }
            return(isThere);
        }
Ejemplo n.º 3
0
 private void loadContent(MySqlDataReader reader)
 {
     ContentTitle.InnerHtml     = reader["title"].ToString();
     keywords.InnerHtml         = reader["keywords"].ToString();
     category.InnerHtml         = reader["category"].ToString();
     ContentParagraph.InnerHtml = reader["text"].ToString().Replace("\n", "<br>"); //Newlines did not show
     ContentuserID.InnerHtml    = "created by : " + reader["username"].ToString();
     if (GetFileInfo.IsPhoto(reader["imgurl"].ToString()))
     {
         ContentImg.Src = "./Images/" + reader["imgurl"].ToString();
         ContentImg.Style.Add("display", "block");
     }
     else
     {
         ContentVid.Src = "./Images/" + reader["imgurl"].ToString();
         ContentVid.Style.Add("display", "block");
     }
 }