コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            #region News
            tblNewsDetailsCollection newsTbl = new tblNewsDetailsCollection();
            newsTbl.ReadList();

            string newsStr = string.Empty;

            for (int i = newsTbl.Count - 1; i >= 0; i--)
            {
                newsStr += "<div class='span3 module_cont module_iconboxes'><div class='shortcode_iconbox'>" +
                           "<img src='" + newsTbl[i].topPageFileAddr + "' alt='' />" +
                           "<h4>" + newsTbl[i].newsDetTitle + "</h4>" +
                           "<p style='width: 100%;'>" + newsTbl[i].newsDetGist + "</p>" +
                           "</div></div>";
            }

            newsHTML.InnerHtml = newsStr;
            #endregion


            //if save fact
            string code_s;
            if ((Request.QueryString["code"] != null))
            {
                code_s            = Request.QueryString["code"];
                fact_no.InnerText = "شماره سفارش شما :" + code_s;
            }

            #region information
            tblInformationDetailCollection infoTbl = new tblInformationDetailCollection();
            infoTbl.ReadList();

            string infoStr = string.Empty;

            for (int i = infoTbl.Count - 1; i >= 0; i--)
            {
                infoStr += "<li><div class='item'>" +
                           "<div class='img_block'><img class='img_footer' style='width:260px;' src='" + infoTbl[i].frontFile + "' alt='عسل شهد فروش' />" +
                           "</div><div class='carousel_title'>" +
                           "<h4 class='featured_ico_video'>" + infoTbl[i].infDetailTitle + "</h4>" +
                           "</div><div class='carousel_desc'>" +
                           "<div class='exc common_font' style='font-size:10pt;line-height: 20px;font-weight: bold;overflow: hidden;'>" + infoTbl[i].infDetailsGist + "</div>" +
                           "</div></div></li>";
            }

            infoHtml.InnerHtml = infoStr;
            #endregion
        }
        catch (Exception)
        {
            newsHTML.InnerText = "روال انجام کار با شکست مواجه شد.";
        }
    }
コード例 #2
0
    protected void btnDel_Click(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("news-details.aspx");
        }

        tblNewsDetailsCollection newsTbl = new tblNewsDetailsCollection();

        newsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        newsTbl[0].Delete();

        Response.Redirect("news-add.aspx");
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["itemNo"] != null)
        {
            itemGet = int.Parse(Request.QueryString["itemNo"]);
        }
        else
        {
            Response.Redirect("default.aspx");
        }


        tblNewsDetailsCollection newsTbl = new tblNewsDetailsCollection();

        newsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, Convert.ToInt32(itemGet)));

        newsDetHtml.InnerHtml = "<h4>" + newsTbl[0].newsDetInsertDate + "</h4>" +
                                "<h2>" + newsTbl[0].newsDetTitle + "</h2>" +
                                "<p class='lead'>" + newsTbl[0].newsDetSubtitle + "</p>" +
                                "<p>" + newsTbl[0].newsDetDetails + "</p>";

        if (newsTbl[0].topPageFileType == 0)
        {
            newsImgHtml.InnerHtml = "<img src='" + newsTbl[0].topPageFileAddr + "' alt='bondelectric " + newsTbl[0].topPageFileAddr + "' class='img-responsive img-rounded'>";
        }
        else if (newsTbl[0].topPageFileType == 0)
        {
            newsImgHtml.InnerHtml = "<div><video id='video1'><source src='movie/news/" + newsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
        }
        else
        {
            newsImgHtml.InnerHtml = newsTbl[0].topPageFileAddr;
        }
    }
コード例 #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        tblNewsDetailsCollection newsTbl = new tblNewsDetailsCollection();



        if (IsPostBack)
        {
            #region post back for filtering date
            try
            {
                int startDate = 0; int endDate = 0;
                if (txtStartDate.Text.Length > 0 && txtEndDate.Text.Length > 0)
                {
                    startDate = Convert.ToInt32(txtStartDate.Text.Substring(6, 4) + txtStartDate.Text.Substring(3, 2) + txtStartDate.Text.Substring(0, 2));
                    endDate   = Convert.ToInt32(txtEndDate.Text.Substring(6, 4) + txtEndDate.Text.Substring(3, 2) + txtEndDate.Text.Substring(0, 2));
                }

                newsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.newsDetInsertDate, CriteriaOperators.GreaterThanOrEqual, startDate) & Criteria.NewCriteria(tblNewsDetails.Columns.newsDetInsertDate, CriteriaOperators.LessThanOrEqual, endDate));
            }
            catch (Exception)
            {
                throw;
            }
            #endregion
        }
        else
        {
            newsTbl.ReadList();
        }

        #region news
        //top and big news
        string newsString = "<div class='col-md-12'><div class='farsi-position section-title'><h2 class='farsi-font title'>آرشیو اخبار</h2></div></div>";
        if (newsTbl.Count > 2)
        {
            for (int i = newsTbl.Count - 1; i > newsTbl.Count - 3; i--)
            {
                newsString += "<div class='col-md-6 col-sm-6'><article class='article'><div class='article2-img'>" +
                              "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsTbl[i].id + "'>";

                if (newsTbl[i].topPageFileType == 0)
                {
                    newsString += "<img src='./images/news/" + newsTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsTbl[i].topPageFileAddr + "'>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>";
                }
                else if (newsTbl[i].topPageFileType == 1)
                {
                    newsString += "<div><video id='video1'><source src='../movie/news/" + newsTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-video-camera'></i></li></ul></div>";
                }
                else
                {
                    newsString += newsTbl[i].topPageFileAddr +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-link'></i></li></ul></div>";
                }


                newsString += "<div class='article-body'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsTbl[i].newsDetSubtitle + "</p>" +
                              "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsTbl[i].id + "'>" + newsTbl[i].newsDetTitle + "</a></h3>" +
                              "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsTbl[i].incReview + "</li></ul>" +
                              "<p>" + newsTbl[i].newsDetDetails + "</p></div>" +
                              "</article></div>";
            }
        }
        else
        {
            if (newsTbl.Count > 0)
            {
                newsString += "<div class='col-md-6 col-sm-6'><article class='article'><div class='article2-img'>" +
                              "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsTbl[0].id + "'>";

                if (newsTbl[0].topPageFileType == 0)
                {
                    newsString += "<img src='./images/news/" + newsTbl[0].topPageFileAddr + "' alt='دنیای ورزشی " + newsTbl[0].topPageFileAddr + "'>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>";
                }
                else if (newsTbl[0].topPageFileType == 1)
                {
                    newsString += "<div><video id='video1'><source src='../movie/news/" + newsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-video-camera'></i></li></ul></div>";
                }
                else
                {
                    newsString += newsTbl[0].topPageFileAddr +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-link'></i></li></ul></div>";
                }



                newsString += "<div class='article-body'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsTbl[0].newsDetSubtitle + "</p>" +
                              "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsTbl[0].id + "'>" + newsTbl[0].newsDetTitle + "</a></h3>" +
                              "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsTbl[0].incReview + "</li></ul>" +
                              "<p>" + newsTbl[0].newsDetDetails + "</p></div>" +
                              "</article></div>";
            }
        }
        newsHtml.InnerHtml = newsString;
        //small news
        string smallNewsString = string.Empty;
        if (newsTbl.Count > 3)
        {
            for (int i = newsTbl.Count - 1; i > newsTbl.Count - 4; i--)
            {
                smallNewsString += "<div class='col-md-4 col-sm-4'><article class='article'><div class='article2-img'>";
                if (newsTbl[i].topPageFileType == 0)
                {
                    smallNewsString += "<img src='./images/news/" + newsTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsTbl[i].topPageFileAddr + "'>";
                }
                else if (newsTbl[0].topPageFileType == 1)
                {
                    smallNewsString += "<div><video id='video1'><source src='../movie/news/" + newsTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    smallNewsString += newsTbl[i].topPageFileAddr;
                }
                smallNewsString += "<div class='article-body'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsTbl[i].newsDetSubtitle + "</p><ul class='article-info'><li class='article-type'><i class='fa fa-file-text'></i></li></ul></div>" +
                                   "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsTbl[i].id + "'>" + newsTbl[i].newsDetTitle + "</a></h3>" +
                                   "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsTbl[i].incReview + "</li></ul></div></article></div>";
            }
        }
        else
        {
            for (int i = newsTbl.Count - 1; i >= 0; i--)
            {
                smallNewsString += "<div class='col-md-4 col-sm-4'><article class='article'><div class='article2-img'>";
                if (newsTbl[i].topPageFileType == 0)
                {
                    smallNewsString += "<img src='./images/news/" + newsTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsTbl[i].topPageFileAddr + "'>";
                }
                else if (newsTbl[0].topPageFileType == 1)
                {
                    smallNewsString += "<div><video id='video1'><source src='../movie/news/" + newsTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    smallNewsString += newsTbl[i].topPageFileAddr;
                }
                smallNewsString += "<div class='article-body'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsTbl[i].newsDetSubtitle + "</p><ul class='article-info'><li class='article-type'><i class='fa fa-file-text'></i></li></ul></div>" +
                                   "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsTbl[i].id + "'>" + newsTbl[i].newsDetTitle + "</a></h3>" +
                                   "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsTbl[i].incReview + "</li></ul></div></article></div>";
            }
        }
        newsSmallHtml.InnerHtml = smallNewsString;
        #endregion
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["newsId"] != null)
        {
            itemGet = int.Parse(Request.QueryString["newsId"]);
        }
        else
        {
            Response.Redirect("default.aspx");
        }


        string newsDetailString = "", picThumbString = "";
        tblNewsDetailsCollection newsDetailsTbl = new tblNewsDetailsCollection();

        newsDetailsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        int idCounter = 0;
        //news image
        string imagesString = "<div class=\"ws_images\"><ul>";

        if (newsDetailsTbl[0].topPageFileType == 0)
        {
            imagesString   += "<li><img src='images/news/top/" + newsDetailsTbl[0].topPageFileAddr + "' alt='اخبار دنیای ورزشی " + newsDetailsTbl[0].id + "' title='دنیای ورزشی' id='wows1_" + idCounter + "'/></li>";
            picThumbString += "<a href='#wows1_" + idCounter + "' title='اخبار دنیای ورزشی'><img src='images/news/top/" + newsDetailsTbl[0].topPageFileAddr + "' alt='اخبار دنیای ورزشی " + newsDetailsTbl[0].id + "' title='دنیای ورزشی' /></a>";
        }
        else if (newsDetailsTbl[0].topPageFileType == 1)
        {
            imagesString   += "<li><video id='wows1_" + idCounter + "'><source src='../movie/news/top/" + newsDetailsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></li>";
            picThumbString += "<a href='#wows1_" + idCounter + "'' title='اخبار دنیای ورزشی'><video id='video" + idCounter + "'><source src='../movie/news/top/" + newsDetailsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></a>";
        }
        else
        {
            imagesString   += "<li id='wows1_" + idCounter + "'>" + newsDetailsTbl[0].topPageFileAddr + "</li>";
            picThumbString += "<a href='#wows1_" + idCounter + "'' title='اخبار دنیای ورزشی'>" + newsDetailsTbl[0].topPageFileAddr + "</a>";
        }

        idCounter++;

        tblNewsPicCollection newsPicTbl = new tblNewsPicCollection();

        newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));

        for (int i = 0; i < newsPicTbl.Count; i++)
        {
            imagesString   += "<li><img src='images/news/sport/" + newsPicTbl[i].picName + "' alt='اخبار دنیای ورزشی " + newsPicTbl[i].id + "' title='دنیای ورزشی' id='wows1_" + idCounter + "'/></li>";
            picThumbString += "<a href='#wows1_" + idCounter + "' title='اخبار دنیای ورزشی'><img src='images/news/sport/" + newsPicTbl[i].picName + "' alt='اخبار دنیای ورزشی " + newsPicTbl[i].id + "' title='دنیای ورزشی' /></a>";
            idCounter++;
        }

        tblNewsMovieCollection newsMovieTbl = new tblNewsMovieCollection();

        newsMovieTbl.ReadList(Criteria.NewCriteria(tblNewsMovie.Columns.newsId, CriteriaOperators.Equal, itemGet));

        for (int i = 0; i < newsMovieTbl.Count; i++)
        {
            imagesString   += "<li><video id='video" + idCounter + "'><source src='../movie/news/sport/" + newsMovieTbl[i].movieName + "' type='video/mp4' id='wows1_" + newsPicTbl[i].id + "'>Your browser does not support HTML5 video.</video></li>";
            picThumbString += "<a href='#wows1_" + idCounter + "' title='اخبار دنیای ورزشی'><video id='video" + newsMovieTbl[i].id + "'><source src='../movie/news/sport/" + newsMovieTbl[i].movieName + "' type='video/mp4'>Your browser does not support HTML5 video.</video></a>";
            idCounter++;
        }

        tblNewsHyperlinkCollection newsLinksTbl = new tblNewsHyperlinkCollection();

        newsLinksTbl.ReadList(Criteria.NewCriteria(tblNewsHyperlink.Columns.newsId, CriteriaOperators.Equal, itemGet));

        for (int i = 0; i < newsLinksTbl.Count; i++)
        {
            imagesString   += "<li id='wows1_" + idCounter + "'>" + newsLinksTbl[i].HyperlinkAddr + "</li>";
            picThumbString += "<a href='#wows1_" + idCounter + "' title='اخبار دنیای ورزشی'>" + newsLinksTbl[i].HyperlinkAddr + "</a>";
            idCounter++;
        }

        imagesString += "</ul></div><div class=\"ws_thumbs\"><div>";



        imagesString += picThumbString;

        imagesString += "</div></div>" +
                        "<div class=\"ws_script\" style=\"position:absolute;left:-99%\"></div>" +
                        "<div class=\"ws_shadow\"></div>";


        imgNewsHtml.InnerHtml = imagesString;

        //news details
        newsDetailString += "<ul class='article-info'><li class='article-category'><a href='#'>ورزشی</a></li><li class='article-type'><i class='fa fa-file-text'></i></li></ul>" +
                            "<h1 class='farsi-font-title farsi-align farsi-direction article-title'>" + newsDetailsTbl[0].newsDetTitle + "</h1>" +
                            "<ul class='article-meta'><li><i class='fa fa-clock-o'></i> " + newsDetailsTbl[0].newsDetInsertDate + " </li></ul>" +
                            "<p class='farsi-font-text farsi-align farsi-direction'>" + newsDetailsTbl[0].newsDetDetails + "</p>";

        newsDetailHtml.InnerHtml = newsDetailString;
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string groupTabsSrting = string.Empty, groupContentString = string.Empty;

        if (!IsPostBack)
        {
            tblNewsGroupCollection newsGroupTbl = new tblNewsGroupCollection();
            newsGroupTbl.ReadList();

            tblNewsHitCollection newsHitTbl = new tblNewsHitCollection();

            tblNewsDetailsCollection newsDetTbl = new tblNewsDetailsCollection();

            //isolated 1st item due to actived class to be set for it
            if (newsGroupTbl.Count > 0)
            {
                groupTabsSrting = "<li class='tab-current'><a href='#section-" + newsGroupTbl[0].id + "' class='icon-shop'><span class='farsi-font-tab'>" + newsGroupTbl[0].newsGroupTitle + "</span></a></li>";
            }

            newsDetTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.idGroup, CriteriaOperators.Equal, newsGroupTbl[0].id));
            if (newsDetTbl.Count > 0)
            {
                groupContentString += "<section id='section-" + newsGroupTbl[0].id + "' class='content-current'>";
                for (int i = 0; i < newsDetTbl.Count; i++)
                {
                    newsHitTbl.ReadList(Criteria.NewCriteria(tblNewsHit.Columns.newsId, CriteriaOperators.Equal, newsDetTbl[i].id));
                    groupContentString += "<div class='fo-top'><div class='form-group'>" +
                                          "<div class='col-sm-12 ctl'>";
                    if (newsHitTbl.Count > 0)
                    {
                        groupContentString += "<div class='checkbox'><span id='text" + newsDetTbl[i].id + "' class='top-news' style='display:inline'>(Checked as a top news)</span> <label> <input type='checkbox' class='newsClass' checked id='" + newsDetTbl[i].id + "'> " + newsDetTbl[i].newsDetTitle + " </label> </div>";
                    }
                    else
                    {
                        groupContentString += "<div class='checkbox'><span id='text" + newsDetTbl[i].id + "' class='top-news' style='display:none'>(Checked as a top news)</span> <label> <input type='checkbox' class='newsClass' id='" + newsDetTbl[i].id + "'> " + newsDetTbl[i].newsDetTitle + " </label> </div>";
                    }

                    groupContentString += "</div><div class='clearfix'></div></div></div>";
                }
                groupContentString += "</section>";
            }
            else
            {
                groupTabsSrting = "";
            }


            //other elements
            //if in a group there is no news, it will be ignored to put in category
            string tempString = string.Empty;
            for (int i = 1; i < newsGroupTbl.Count; i++)
            {
                tempString = "<li><a href='#section-" + newsGroupTbl[i].id + "' class='icon-cup'><span class='farsi-font-tab'>" + newsGroupTbl[i].newsGroupTitle + "</span></a></li>";

                newsDetTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.idGroup, CriteriaOperators.Equal, newsGroupTbl[i].id));
                if (newsDetTbl.Count > 0)
                {
                    groupTabsSrting    += tempString;
                    groupContentString += "<section id='section-" + newsGroupTbl[i].id + "' >";
                    for (int j = 0; j < newsDetTbl.Count; j++)
                    {
                        newsHitTbl.ReadList(Criteria.NewCriteria(tblNewsHit.Columns.newsId, CriteriaOperators.Equal, newsDetTbl[j].id));

                        groupContentString += "<div class='fo-top'><div class='form-group'>" +
                                              "<div class='col-sm-12 ctl'>";
                        if (newsHitTbl.Count > 0)
                        {
                            groupContentString += "<div class='checkbox'><span id='text" + newsDetTbl[j].id + "' class='top-news' style='display:inline'>(Checked as a top news)</span> <label> <input type='checkbox' class='newsClass' checked id='" + newsDetTbl[j].id + "'> " + newsDetTbl[j].newsDetTitle + " </label> </div>";
                        }
                        else
                        {
                            groupContentString += "<div class='checkbox'><span id='text" + newsDetTbl[j].id + "' class='top-news' style='display:none'>(Checked as a top news)</span> <label> <input type='checkbox' class='newsClass' id='" + newsDetTbl[j].id + "'> " + newsDetTbl[j].newsDetTitle + " </label> </div>";
                        }

                        groupContentString += "</div><div class='clearfix'></div></div></div>";
                    }
                    groupContentString += "</section>";
                }
            }

            //---tabsheets
            newsGroupTabHtml.InnerHtml = groupTabsSrting;

            //---contents
            newsTitleHtml.InnerHtml = groupContentString;
        }
    }
コード例 #7
0
    protected void Page_Load(object sender, EventArgs e)
    {
        tblNewsDetailsCollection newsDetailsSportTbl = new tblNewsDetailsCollection();

        newsDetailsSportTbl.ReadList();

        #region archive News
        newsDetailsSportTbl.ReadList();
        string popularNews = "<div class='farsi-position section-title' style='border-bottom: 1px solid #ededed;'><h2 class='farsi-font title'> اخبار</h2></div>";

        if (newsDetailsSportTbl.Count > 5)
        {
            for (int i = 0; i < 5; i++)
            {
                popularNews += "<article class='article row-article'><div class='article3-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>";

                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    popularNews += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    popularNews += "<div><video id='video1'><source src='../movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    popularNews += newsDetailsSportTbl[i].topPageFileAddr;
                }

                popularNews += "</a></div><div class='article-body'>" +
                               //"<ul class='article-info'><li class='article-category'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>News</a></li><li class='article-type'><i class='fa fa-file-text'></i></li></ul>" +
                               "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                               "<h4 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                               "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul>" +
                               "<p>" + newsDetailsSportTbl[i].newsDetDetails + "</p></div></article>";
            }
        }
        else
        {
            for (int i = 0; i < newsDetailsSportTbl.Count; i++)
            {
                popularNews += "<article class='article row-article'><div class='article3-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>";

                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    popularNews += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    popularNews += "<div><video id='video1'><source src='../movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    popularNews += newsDetailsSportTbl[i].topPageFileAddr;
                }

                popularNews += "</a></div><div class='article-body'>" +
                               "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p><ul class='article-info'><li class='article-category'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>News</a></li><li class='article-type'><i class='fa fa-file-text'></i></li></ul>" +
                               "<h4 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                               "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul>" +
                               "<p>" + newsDetailsSportTbl[i].newsDetDetails + "</p></div></article>";
            }
        }
        popularNewsHtml.InnerHtml = popularNews;
        #endregion
    }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region SQL query
        string dateInsert = DateTime.Now.ToString("yyyyMMdd");

        string ConStr = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        using (SqlConnection con = new SqlConnection(ConStr))
        {
            con.Open();
            SqlCommand cmd = new SqlCommand("select * from tblNewsDetails where id IN (select idNews from tblNewsPeriod where DateOfExp > " + dateInsert + ") order by incReview DESC", con);
            using (SqlDataReader dataReader = cmd.ExecuteReader())
            {
                while (dataReader.Read())
                {
                    //hotNewsList = dataReader["id"] , ;
                }
            }
        }
        #endregion


        #region Tables recalls


        tblNewsGroupCollection newsGroupSportTbl = new tblNewsGroupCollection();
        newsGroupSportTbl.ReadList();

        tblNewsDetailsCollection newsDetailsSportTbl = new tblNewsDetailsCollection();

        tblNewsMovieCollection newsMovieTbl = new tblNewsMovieCollection();
        newsMovieTbl.ReadList();

        tblNewsPicCollection newsPicTbl = new tblNewsPicCollection();
        newsPicTbl.ReadList();



        tblNewsHitCollection newsHitSportTbl = new tblNewsHitCollection();
        newsHitSportTbl.ReadList();

        tblSliderCollection sliderNewsTbl = new tblSliderCollection();

        tblMovieGalleryCollection videoGalleryTbl = new tblMovieGalleryCollection();
        videoGalleryTbl.ReadList();

        tblMovieGalleryGroupCollection videoGalleryGrpTbl = new tblMovieGalleryGroupCollection();

        tblGalleryPicturesCollection galleryTbl = new tblGalleryPicturesCollection();
        galleryTbl.ReadList();

        #endregion


        #region slider old
        newsDetailsSportTbl.ReadList();

        string sliderString = "<div id='owl-carousel-1' class='news-background-filler owl-carousel owl-theme center-owl-nav'>";
        int    counterFiles = 0;
        if (newsDetailsSportTbl.Count > 5)
        {
            for (int i = newsDetailsSportTbl.Count - 1; i > newsDetailsSportTbl.Count - 6; i--)
            {
                sliderNewsTbl.ReadList(Criteria.NewCriteria(tblSlider.Columns.SliderLink, CriteriaOperators.Like, newsDetailsSportTbl[i].id.ToString()));

                if ((newsDetailsSportTbl[i].topPageFileType == 0) && (sliderNewsTbl.Count == 0))
                {
                    sliderString += "<article class='article thumb-article'><div class='article-img'>" +
                                    "<img class='head-news-img' src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>" +
                                    "</div><div class='article-body'><ul class='article-info'>" +
                                    "<li class='article-category'><a href='#'>News</a></li><li class='article-type'><i class='fa fa-camera'></i></li></ul>" +
                                    "<p class='sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                                    "<h2 class='farsi-position farsi-font farsi-slider-title article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h2>" +
                                    "<ul class='article-meta'>" +
                                    "<li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li>" +
                                    "</ul></div></article>";
                }
                else
                {
                    counterFiles++;
                }
            }
        }
        else
        {
            for (int i = newsDetailsSportTbl.Count - 1; i > 0; i--)
            {
                sliderNewsTbl.ReadList(Criteria.NewCriteria(tblSlider.Columns.SliderLink, CriteriaOperators.Like, newsDetailsSportTbl[i].id.ToString()));

                if ((newsDetailsSportTbl[i].topPageFileType == 0) && (sliderNewsTbl.Count == 0))
                {
                    sliderString += "<article class='article thumb-article'><div class='article-img'>" +
                                    "<img class='head-news-img' src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>" +
                                    "</div><div class='article-body'><ul class='article-info'>" +
                                    "<li class='article-category'><a href='#'>News</a></li><li class='article-type'><i class='fa fa-camera'></i></li></ul>" +
                                    "<p class='sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                                    "<h2 class='farsi-position farsi-font farsi-slider-title article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h2>" +
                                    "<ul class='article-meta'>" +
                                    "<li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li>" +
                                    "</ul></div></article>";
                }
                else
                {
                    counterFiles++;
                }
            }
        }
        sliderString += "</div></div>";
        //sliderHtml.InnerHtml = sliderString;
        #endregion


        #region New slider

        string sliderStr = ""; string slidertooltipStr = "";
        newsHitSportTbl.ReadList();

        for (int i = 0; i < newsHitSportTbl.Count; i++)
        {
            newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, newsHitSportTbl[i].newsId));

            sliderStr += "<li class='farsi-font'><img src='images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='" + newsDetailsSportTbl[0].topPageFileAddr + "' title='" + newsDetailsSportTbl[0].newsDetTitle + "' />" +
                         "<h2 class='box-show-slider farsi-position farsi-font farsi-slider-title' style='color:white;'><a href='donyaye-varzeshi-news-details.aspx?itemId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetGist + "</a></h2></li>";

            slidertooltipStr += "<a href='#' title='" + newsDetailsSportTbl[0].newsDetTitle + "'><span><img src='images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='" + newsDetailsSportTbl[0].topPageFileAddr + "' style='width:85px;'/>" + newsDetailsSportTbl[0].newsDetTitle + "</span></a>";
        }

        sliderItemsHtml.InnerHtml   = sliderStr;
        sliderToolTipHtml.InnerHtml = slidertooltipStr;
        #endregion


        #region tabMenu
        string tabsStrings = string.Empty;
        if (newsGroupSportTbl.Count > 0)
        {
            tabsStrings += "<li  class='active'><a data-toggle='tab' href='#tab" + newsGroupSportTbl[0].id + "'>" + newsGroupSportTbl[0].newsGroupTitle + "</a></li>";
        }

        for (int i = 1; i < newsGroupSportTbl.Count; i++)
        {
            tabsStrings += "<li><a data-toggle='tab' href='#tab" + newsGroupSportTbl[i].id + "'>" + newsGroupSportTbl[i].newsGroupTitle + "</a></li>";
        }
        tabsHtml.InnerHtml = tabsStrings;
        #endregion


        #region news in tab
        string newsTabBarString = string.Empty;
        for (int j = 0; j < newsGroupSportTbl.Count; j++)
        {
            newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.idGroup, CriteriaOperators.Equal, newsGroupSportTbl[j].id));
            if (j == 0)
            {
                newsTabBarString += "<div id='tab" + newsGroupSportTbl[j].id + "' class='tab-pane fade in active'><div class='row'>";
            }
            else
            {
                newsTabBarString += "<div id='tab" + newsGroupSportTbl[j].id + "' class='tab-pane fade'><div class='row'>";
            }

            if (newsDetailsSportTbl.Count < 5)
            {
                for (int i = 0; i < newsDetailsSportTbl.Count; i++)
                {
                    newsTabBarString += "<div class='col-md-4 col-sm-6'><article class='article'><div class='article-img'>";

                    if (newsDetailsSportTbl[i].topPageFileType == 0)
                    {
                        newsTabBarString += "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'><img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='" + newsDetailsSportTbl[i].topPageFileAddr + "'></a><ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i>";
                    }
                    else if (newsDetailsSportTbl[i].topPageFileType == 1)
                    {
                        newsTabBarString += "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'><video id='video" + i + "'><source src='./movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></a><ul class='article-info'><li class='article-type'><i class='fa fa-video-camera'></i>";
                    }
                    else
                    {
                        newsTabBarString += "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].topPageFileAddr + "</a><ul class='article-info'><li class='article-type'><i class='fa fa-link'></i>";
                    }

                    newsTabBarString += "</li></ul></div><div class='article-body article-body-top'>" +
                                        "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                                        "<h4 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                                        "<p>" + newsDetailsSportTbl[i].newsDetGist + "</p>" +
                                        "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li>" +
                                        "</ul></div></article></div>";
                }
            }
            else
            {
                for (int i = 0; i < 5; i++)
                {
                    newsTabBarString += "<div class='col-md-3 col-sm-6'><article class='article'><div class='article-img'>" +
                                        "<a href='#'><img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='" + newsDetailsSportTbl[i].topPageFileAddr + "'></a>" +
                                        "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div><div class='article-body article-body-top'>" +
                                        "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                                        "<h4 class='farsi-font farsi-position article-title'><a href='#'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                                        "<p>" + newsDetailsSportTbl[i].newsDetGist + "</p>" +
                                        "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li>" +
                                        "</ul></div></article></div>";
                }
            }
            newsTabBarString += "</div></div>";
        }
        tabNewsDetailsHtml.InnerHtml = newsTabBarString;
        #endregion


        #region Hit news Left
        string hitNewsString = string.Empty;
        hitNewsString = "<div class='farsi-position section-title'><h2 class='farsi-font title'>خبرهای داغ ورزشی</h2></div>";

        if (newsHitSportTbl.Count > 0)
        {
            newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, newsHitSportTbl[newsHitSportTbl.Count - 1].newsId));

            if (newsDetailsSportTbl[0].topPageFileType == 0)
            {
                hitNewsString += "<article class='article col-md-6'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><img src='images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='" + newsDetailsSportTbl[0].newsDetTitle + "'></a>" +
                                 "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>" +
                                 "<div class='article-body article-body-2'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                                 "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                 "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                                 "<p>" + newsDetailsSportTbl[0].newsDetGist + "</p></div></article>";
            }
            else if (newsDetailsSportTbl[0].topPageFileType == 1)
            {
                hitNewsString += "<article class='article col-md-6'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><video id='videoTop" + 0 + "'><source src='./movie/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></a>" +
                                 "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>" +
                                 "<div class='article-body article-body-2'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                                 "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                 "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                                 "<p>" + newsDetailsSportTbl[0].newsDetGist + "</p></div></article>";
            }
            else
            {
                hitNewsString += "<article class='article col-md-6'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].topPageFileAddr + "</a>" +
                                 "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>" +
                                 "<div class='article-body article-body-2'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                                 "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                 "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                                 "<p>" + newsDetailsSportTbl[0].newsDetGist + "</p></div></article>";
            }
            if (newsHitSportTbl.Count > 1)
            {
                newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, newsHitSportTbl[newsHitSportTbl.Count - 2].newsId));
                if (newsDetailsSportTbl[0].topPageFileType == 0)
                {
                    hitNewsString += "<article class='article col-md-6'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><img src='images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='" + newsDetailsSportTbl[0].newsDetTitle + "'></a>" +
                                     "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>" +
                                     "<div class='article-body article-body-2'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                                     "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                     "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                                     "<p>" + newsDetailsSportTbl[0].newsDetGist + "</p></div></article>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    hitNewsString += "<article class='article col-md-6'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><video id='videoTop" + 1 + "'><source src='./movie/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></a>" +
                                     "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>" +
                                     "<div class='article-body article-body-2'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                                     "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                     "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                                     "<p>" + newsDetailsSportTbl[0].newsDetGist + "</p></div></article>";
                }
                else
                {
                    hitNewsString += "<article class='article col-md-6'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].topPageFileAddr + "</a>" +
                                     "<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>" +
                                     "<div class='article-body article-body-2'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                                     "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                     "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                                     "<p>" + newsDetailsSportTbl[0].newsDetGist + "</p></div></article>";
                }
            }
        }


        int lengthTable = 0;
        //switch (newsHitSportTbl.Count)
        //{
        //    case 1:
        //        lengthTable = 1;
        //        break;
        //    case 2:
        //        lengthTable = 0;
        //        break;
        //    case 3:
        //        lengthTable = 1;
        //        break;
        //    case 4:
        //        lengthTable = 2;
        //        break;
        //    default:
        //        lengthTable = newsHitSportTbl.Count - 5;
        //        break;
        //}


        for (int i = newsHitSportTbl.Count - 3; i >= lengthTable; i--)
        {
            newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, newsHitSportTbl[i].newsId));
            hitNewsString += "<article class='article widget-article'><div class='article2-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><img src='images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='" + newsDetailsSportTbl[0].newsDetTitle + "'></a></div><div class='article-body'>" +
                             "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                             "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                             "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul></div></article>";
        }

        hitNewsSportHtml.InnerHtml = hitNewsString;
        #endregion


        #region news (delete tmep)
        //top and big news
        string newsString = "<div class='col-md-12'><div class='farsi-position section-title'><h2 class='farsi-font title'>اخبار</h2></div></div>";
        if (newsDetailsSportTbl.Count > 2)
        {
            for (int i = newsDetailsSportTbl.Count - 1; i > newsDetailsSportTbl.Count - 3; i--)
            {
                newsString += "<div class='col-md-6 col-sm-6'><article class='article'><div class='article-img'>" +
                              "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>";

                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    newsString += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>";
                }
                else if (newsDetailsSportTbl[i].topPageFileType == 1)
                {
                    newsString += "<div><video id='video1'><source src='./movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-video-camera'></i></li></ul></div>";
                }
                else
                {
                    newsString += newsDetailsSportTbl[i].topPageFileAddr +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-link'></i></li></ul></div>";
                }


                newsString += "<div class='article-body article-body-3'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                              "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h3>" +
                              "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul>" +
                              "<p>" + newsDetailsSportTbl[i].newsDetGist + "</p></div>" +
                              "</article></div>";
            }
        }
        else
        {
            if (newsDetailsSportTbl.Count > 0)
            {
                newsString += "<div class='col-md-6 col-sm-6'><article class='article'><div class='article-img'>" +
                              "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>";

                if (newsDetailsSportTbl[0].topPageFileType == 0)
                {
                    newsString += "<img src='./images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[0].topPageFileAddr + "'>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i></li></ul></div>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    newsString += "<div><video id='video1'><source src='./movie/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>" +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-video-camera'></i></li></ul></div>";
                }
                else
                {
                    newsString += newsDetailsSportTbl[0].topPageFileAddr +
                                  "</a><ul class='article-info'><li class='article-type'><i class='fa fa-link'></i></li></ul></div>";
                }



                newsString += "<div class='article-body article-body-3'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[0].newsDetSubtitle + "</p>" +
                              "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                              "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul>" +
                              "<p>" + newsDetailsSportTbl[0].newsDetDetails + "</p></div>" +
                              "</article></div>";
            }
        }
        //newsHtml.InnerHtml = newsString;
        //small news
        string smallNewsString = string.Empty;
        if (newsDetailsSportTbl.Count > 3)
        {
            for (int i = newsDetailsSportTbl.Count - 1; i > newsDetailsSportTbl.Count - 4; i--)
            {
                smallNewsString += "<div class='col-md-4 col-sm-4'><article class='article'><div class='article-img'>";
                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    smallNewsString += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    smallNewsString += "<div><video id='video1'><source src='./movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    smallNewsString += newsDetailsSportTbl[i].topPageFileAddr;
                }
                smallNewsString += "<div class='article-body'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p><ul class='article-info'><li class='article-type'><i class='fa fa-file-text'></i></li></ul></div>" +
                                   "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h3>" +
                                   "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul></div></article></div>";
            }
        }
        else
        {
            for (int i = newsDetailsSportTbl.Count - 1; i >= 0; i--)
            {
                smallNewsString += "<div class='col-md-4 col-sm-4'><article class='article'><div class='article-img'>";
                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    smallNewsString += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    smallNewsString += "<div><video id='video1'><source src='./movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    smallNewsString += newsDetailsSportTbl[i].topPageFileAddr;
                }
                smallNewsString += "<div class='article-body'><p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p><ul class='article-info'><li class='article-type'><i class='fa fa-file-text'></i></li></ul></div>" +
                                   "<h3 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h3>" +
                                   "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul></div></article></div>";
            }
        }
        //newsSmallHtml.InnerHtml = smallNewsString;
        #endregion


        #region popular News
        newsDetailsSportTbl.ReadList();
        string popularNews = "<div class='farsi-position section-title'><h2 class='farsi-font title'>اخبار محبوب</h2></div>";

        if (newsDetailsSportTbl.Count > 5)
        {
            for (int i = 0; i < 5; i++)
            {
                popularNews += "<article class='article row-article'><div class='article3-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>";

                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    popularNews += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    popularNews += "<div><video id='video1'><source src='./movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    popularNews += newsDetailsSportTbl[i].topPageFileAddr;
                }

                popularNews += "</a></div><div class='article-body article-body-4'>" +
                               //"<ul class='article-info'><li class='article-category'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>News</a></li><li class='article-type'><i class='fa fa-file-text'></i></li></ul>" +
                               "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p>" +
                               "<h4 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                               "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul>" +
                               "<p>" + newsDetailsSportTbl[i].newsDetGist + "</p></div></article>";
            }
        }
        else
        {
            for (int i = 0; i < newsDetailsSportTbl.Count; i++)
            {
                popularNews += "<article class='article row-article'><div class='article3-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>";

                if (newsDetailsSportTbl[i].topPageFileType == 0)
                {
                    popularNews += "<img src='./images/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='دنیای ورزشی " + newsDetailsSportTbl[i].topPageFileAddr + "'>";
                }
                else if (newsDetailsSportTbl[0].topPageFileType == 1)
                {
                    popularNews += "<div><video id='video1'><source src='./movie/news/" + newsDetailsSportTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
                }
                else
                {
                    popularNews += newsDetailsSportTbl[i].topPageFileAddr;
                }

                popularNews += "</a></div><div class='article-body article-body-4'>" +
                               "<p class='sub-title-news sub-title' style='font-size: 9px;'>" + newsDetailsSportTbl[i].newsDetSubtitle + "</p><ul class='article-info'><li class='article-category'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>News</a></li><li class='article-type'><i class='fa fa-file-text'></i></li></ul>" +
                               "<h4 class='farsi-font farsi-position article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[i].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                               "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul>" +
                               "<p>" + newsDetailsSportTbl[i].newsDetGist + "</p></div></article>";
            }
        }
        popularNewsHtml.InnerHtml = popularNews;
        #endregion

        #region Ad
        string ret = "none";
        tblAdStyleCollection adStyleTbl = new tblAdStyleCollection();
        adStyleTbl.ReadList();

        for (int i = 0; i < adStyleTbl.Count; i++)
        {
            // ----------------- FOR POSITION OF 980*120 --------------------
            if (adStyleTbl[i].styleWidth > 600 && adStyleTbl[i].styleHeight > 105)
            {
                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    ad1Html.Src = ret;
                }

                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    ad2Html.Src = ret;
                }

                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    ad3Html.Src = ret;
                }

                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    ad4Html.Src = ret;
                }

                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    ad5Html.Src = ret;
                }
            }
            // ----------------- FOR POSITION OF 980*90 --------------------
            else if (adStyleTbl[i].styleWidth > 600 && adStyleTbl[i].styleHeight <= 105)
            {
            }
            // ----------------- FOR POSITION OF 300*250 --------------------
            else if (adStyleTbl[i].styleWidth <= 600 && adStyleTbl[i].styleHeight >= 250)
            {
                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    adSquareMiddleHtml.Src = ret;
                }
            }
        }

        #endregion

        #region More read in side bar
        newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.incReview, CriteriaOperators.IsNotNull));
        string sideNewsSlider = "<div id='owl-carousel-3' class='owl-carousel owl-theme center-owl-nav'>";
        int    maxTopLoop     = 0;
        if (newsDetailsSportTbl.Count > 6)
        {
            maxTopLoop = newsDetailsSportTbl.Count - 6;
        }

        for (int i = newsDetailsSportTbl.Count - 1; i > maxTopLoop; i--)
        {
            sideNewsSlider += "<article class='article'><div class='article2-img'>" +
                              "<a href='#'><img src='./images//news/" + newsDetailsSportTbl[i].topPageFileAddr + "' alt='Tamasha new " + newsDetailsSportTbl[i].topPageFileAddr + "'></a>" +
                              "<ul class='article-info'><li class='article-type'><i class='fa fa-file-text'></i></li></ul></div><div class='article-body'>" +
                              "<h4 class='farsi-font farsi-position article-title'><a href='#'>" + newsDetailsSportTbl[i].newsDetTitle + "</a></h4>" +
                              "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[i].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[i].incReview + "</li></ul></div></article>";
        }
        sideNewsSlider            += "</div>";
        moreReadSideHtml.InnerHtml = sideNewsSlider;
        #endregion


        #region popular News side on the top
        string sideNews = string.Empty;
        int    lowRange = 0;

        newsDetailsSportTbl.ReadList();

        if (newsDetailsSportTbl.Count > 26)
        {
            lowRange = newsDetailsSportTbl.Count - 25;
        }

        for (int i = newsDetailsSportTbl.Count - 1; i > lowRange; i--)
        {
            sideNews += "<a class='title-block farsi-font farsi-position article-title' href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[i].newsDetTitle + "</a>";
        }

        popularNewsSideHtml.InnerHtml = sideNews;
        recentNewsSideHtml.InnerHtml  = sideNews;

        #endregion


        #region Rss news
        newsString = "";
        string RssFeedUrl;
        tblNewsRssCollection rssNewsTbl = new tblNewsRssCollection();
        rssNewsTbl.ReadList();

        for (int i = 0; i < rssNewsTbl.Count; i++)
        {
            if (rssNewsTbl[i].RssLink.Trim().Length > 3)
            {
                RssFeedUrl = rssNewsTbl[i].RssLink;

                newsString = PopulateRssFeed(RssFeedUrl);
            }
        }

        rssNewsHtml.InnerHtml = newsString;
        #endregion


        #region popular videos
        string popularVideoStr = "<div class='farsi-position section-title'><h2 class='farsi-font title'>ویدیوهای محبوب</h2><div id='nav-carousel-2' class='custom-owl-nav pull-left'></div></div>";
        int    MaxLength       = 0;
        if (videoGalleryTbl.Count > 7)
        {
            MaxLength = videoGalleryTbl.Count - 7;
        }

        popularVideoStr += "<div id='owl-carousel-2' class='owl-carousel owl-theme'>";
        for (int i = videoGalleryTbl.Count - 1; i >= MaxLength; i--)
        {
            popularVideoStr += "<article class='article thumb-article'><div class='video-pre-small article-video'>" +
                               "<video controls><source src='" + videoGalleryTbl[i].movieAddr + videoGalleryTbl[i].movieName + "' type='video/mp4'>Your browser does not support HTML5 video.</video>" +
                               "</div><div class='article-body'><ul class='article-info'><li class='article-category'><a>Play</a></li>" +
                               "<li class='article-type'><i class='fa fa-video-camera'></i></li></ul>" +
                               "<h4 class='farsi-font farsi-position article-title'><a href='#'>" + videoGalleryTbl[i].movieTitle + "</a></h4>" +
                               "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + videoGalleryTbl[i].insertDate + "</li></ul></div></article>";
        }
        popularVideoStr           += "</div>";
        popularVideoHtml.InnerHtml = popularVideoStr;
        #endregion


        #region top news small slider
        string sliderHitNewsStr = "<div class='widget-title'><h2 class='farsi-font title'>اخبار بر جسته</h2></div>";


        sliderHitNewsStr += "<div id='owl-carousel-4' class='owl-carousel owl-theme'>";
        for (int i = 0; i < newsHitSportTbl.Count; i++)
        {
            newsDetailsSportTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, newsHitSportTbl[i].newsId));

            sliderHitNewsStr += "<article class='article thumb-article'><div class='article3-img'>";

            if (newsDetailsSportTbl[0].topPageFileType == 0)
            {
                sliderHitNewsStr += "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><img src='./images/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' alt='" + newsDetailsSportTbl[0].topPageFileAddr + "'></a>";
            }
            //<ul class='article-info'><li class='article-type'><i class='fa fa-camera'></i>";
            else if (newsDetailsSportTbl[0].topPageFileType == 1)
            {
                sliderHitNewsStr += "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'><video id='video" + i + "'><source src='./movie/news/" + newsDetailsSportTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></a>";
            }
            //<ul class='article-info'><li class='article-type'><i class='fa fa-video-camera'></i>";
            else
            {
                sliderHitNewsStr += "<a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsSportTbl[0].id + "'>" + newsDetailsSportTbl[0].topPageFileAddr + "</a>";
            }
            //<ul class='article-info'><li class='article-type'><i class='fa fa-link'></i>";

            sliderHitNewsStr += "</div><div class='article-body'>" +
                                //"<ul class='article-info'><li class='article-category'><a href='#'>News</a></li><li class='article-type'><i class='fa fa-video-camera'></i></li></ul>"+
                                "<h3 class='farsi-font farsi-position article-title'><a href='#'>" + newsDetailsSportTbl[0].newsDetTitle + "</a></h3>" +
                                "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsSportTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsSportTbl[0].incReview + "</li></ul></div></article>";
        }
        sliderHitNewsStr += "</div>";

        hitNewsSliderHtml.InnerHtml = sliderHitNewsStr;
        #endregion


        #region picture galleries
        string pictureGalleriesStr = "";
        int    minLengthGallery    = 0;

        if (galleryTbl.Count > 12)
        {
            minLengthGallery = galleryTbl.Count - 13;
        }

        for (int i = galleryTbl.Count - 1; i > minLengthGallery; i--)
        {
            pictureGalleriesStr += "<li><a href='picture-gallery.aspx'><img src='" + galleryTbl[i].GalleryPicAddr + galleryTbl[i].GalleryPicName + "' alt=''></a></li>";
        }

        gallery1Html.InnerHtml = pictureGalleriesStr;

        #endregion
    }
コード例 #9
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string dateInsert = DateTime.Now.ToString("yyyyMMdd");
        string timeInsert = DateTime.Now.ToString("hh:mm:ss");


        tblNewsDetails           newsTbl       = new tblNewsDetails();
        tblNewsPeriod            newsPeriodTbl = new tblNewsPeriod();
        tblNewsDetailsCollection newsLastIdTbl = new tblNewsDetailsCollection();

        if (txtTitle.Text.Trim().Length > 0)
        {
            #region add news
            newsTbl.newsDetTitle = txtTitle.Text;

            if (ckNews.Text.Trim().Length > 0)
            {
                string str = ckNews.Text;
                newsTbl.newsDetDetails = Server.HtmlDecode(str);
            }
            else
            {
                newsTbl.newsDetDetails = "";
            }

            newsTbl.idAcceptedAdmin   = 1;
            newsTbl.idStaffCreator    = 5;
            newsTbl.newsDetInsertDate = dateInsert;
            newsTbl.newsDetInsertTime = timeInsert;



            newsTbl.incReview = 1;

            newsTbl.idGroup = Int32.Parse(ddlNewsGroup.SelectedValue);

            newsTbl.allow = "1";



            // file upload start
            string  filename  = string.Empty;
            Boolean fileOK    = false;
            String  path      = Server.MapPath("~/images/news/");
            String  pathMovie = Server.MapPath("~/movie/news/");

            // if picture
            if (rb1.Value == "0")
            {
                newsTbl.topPageFileType = 0;

                if (IsPostBack)
                {
                    if (fuGallery.HasFile)
                    {
                        String   fileExtension     = System.IO.Path.GetExtension(fuGallery.FileName).ToLower();
                        String[] allowedExtensions = { ".jpg", ".png", ".bmp", ".gif" };
                        for (int i = 0; i < allowedExtensions.Length; i++)
                        {
                            if (fileExtension == allowedExtensions[i])
                            {
                                fileOK = true;
                            }
                        }
                    }

                    if (fileOK)
                    {
                        try
                        {
                            fuGallery.PostedFile.SaveAs(path + fuGallery.FileName);
                            filename = fuGallery.FileName;
                        }
                        catch (Exception ex)
                        {
                            lblError.Text = "A problem with uplouding picture";
                        }
                    }
                    else
                    {
                        lblError.Text = "Not valid picture";
                    }
                }

                //file upload end
                if (filename.Trim().Length > 0)
                {
                    newsTbl.topPageFileAddr = filename;
                }
                else
                {
                    newsTbl.topPageFileAddr = "default.jpg";
                }
            }
            else if (rb2.Value == "1")
            {
                newsTbl.topPageFileType = 1;

                if (IsPostBack)
                {
                    if (fuGallery.HasFile)
                    {
                        String   fileExtension     = System.IO.Path.GetExtension(fuGallery.FileName).ToLower();
                        String[] allowedExtensions = { ".mov", ".mp4", ".ogv" };
                        for (int i = 0; i < allowedExtensions.Length; i++)
                        {
                            if (fileExtension == allowedExtensions[i])
                            {
                                fileOK = true;
                            }
                        }
                    }

                    if (fileOK)
                    {
                        try
                        {
                            fuGallery.PostedFile.SaveAs(pathMovie + fuGallery.FileName);
                            filename = fuGallery.FileName;
                        }
                        catch (Exception ex)
                        {
                            lblError.Text = "A problem with uplouding movie";
                        }
                    }
                    else
                    {
                        lblError.Text = "Not valid movie";
                    }
                }

                //file upload end
                if (filename.Trim().Length > 0)
                {
                    newsTbl.topPageFileAddr = filename;
                }
                else
                {
                    newsTbl.topPageFileAddr = "default.jpg";
                    newsTbl.topPageFileType = 0;
                }
            }
            else if (rb3.Value == "2")
            {
                newsTbl.topPageFileType = 2;
                newsTbl.topPageFileAddr = txtLink.Text;
            }

            newsTbl.newsDetSubtitle = txtSubTitle.Text;

            newsTbl.Create();
            #endregion

            #region add preiod of show
            newsLastIdTbl.ReadList();

            if (txtStartDate.Text.Trim().Length > 0)
            {
                newsPeriodTbl.DateOfShow = Convert.ToInt32(txtStartDate.Text);
            }
            else
            {
                newsPeriodTbl.DateOfShow = Convert.ToInt32(dateInsert);
            }

            newsPeriodTbl.idNews    = newsLastIdTbl[newsLastIdTbl.Count - 1].id;
            newsPeriodTbl.DateOfExp = Convert.ToInt32(txtEndDate.Text);
            newsPeriodTbl.allow     = "1";

            newsPeriodTbl.Create();
            #endregion

            Response.Redirect("news-add.aspx");
        }
        else
        {
            lblError.Text = "* please enter title frist.";
        }
    }
コード例 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Add ddl
        tblNewsGroupCollection newsGroupTbl = new tblNewsGroupCollection();

        newsGroupTbl.ReadList();

        //tblNewsPicArtCollection newsPicTbl = new tblNewsPicArtCollection();

        if (!IsPostBack)
        {
            for (int i = 0; i < newsGroupTbl.Count; i++)
            {
                ddlNewsGroup.Items.Add(new ListItem(newsGroupTbl[i].newsGroupTitle, newsGroupTbl[i].id.ToString()));
            }
        }
        //place data
        string newsString = string.Empty;
        tblNewsDetailsCollection newsTbl = new tblNewsDetailsCollection();

        newsTbl.ReadList();

        string addRow     = "<div class='row'>";
        int    countSteps = 0;

        for (int i = 0; i < newsTbl.Count; i++)
        {
            newsGroupTbl.ReadList(Criteria.NewCriteria(tblNewsGroup.Columns.id, CriteriaOperators.Equal, newsTbl[i].idGroup));
            //newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPicArt.Columns.newsId, CriteriaOperators.Equal, newsTbl[i].id));

            if (countSteps == 0)
            {
                newsString += addRow;
            }

            newsString += "<div class='col-md-6 graph-2'>" +
                          "<h3 class='inner-tittle'>News " + (i + 1) + " </h3>" +
                          "<div class='panel panel-primary two'>" +
                          "<div class='panel-heading'>" + newsTbl[i].newsDetTitle + "(" + newsGroupTbl[0].newsGroupTitle + ")" + "</div><div class='panel-body ont two'>";
            if (newsTbl[i].topPageFileType == 0)
            {
                newsString += "<div><img src='../images/news/" + newsTbl[i].topPageFileAddr + "' alt='" + newsTbl[i].topPageFileAddr + "' style='width: 100%;' /></div>";
            }
            else if (newsTbl[i].topPageFileType == 1)
            {
                newsString += "<div><video id='video1'><source src='../movie/news/" + newsTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
            }
            else
            {
                newsString += "<div>" + newsTbl[i].topPageFileAddr + "</div>";
            }

            newsString += "<p>" + newsTbl[i].newsDetDetails + "</p></div>" +
                          "<div class='panel-footer'><a href='news-details.aspx?item=" + newsTbl[i].id + "'>edit</a></div></div></div>";
            countSteps++;
            if (countSteps == 2)
            {
                countSteps  = 0;
                newsString += "</div>";
            }
        }

        infHtml.InnerHtml = newsString;
    }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["newsId"] != null)
        {
            itemGet = int.Parse(Request.QueryString["newsId"]);
        }
        else
        {
            Response.Redirect("default.aspx");
        }

        string newsDetailString = "", picThumbString = "";
        tblNewsDetailsCollection newsDetailsTbl = new tblNewsDetailsCollection();

        newsDetailsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        tblNewsPicCollection newsPicTbl         = new tblNewsPicCollection();

        newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));

        #region increment number of review a news
        tblNewsDetailsCollection newsDetailsIncTbl = new tblNewsDetailsCollection();
        newsDetailsIncTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        int numberOfReview = Convert.ToInt32(newsDetailsTbl[0].incReview) + 1;
        newsDetailsIncTbl[0].incReview = numberOfReview;

        newsDetailsIncTbl[0].Update();
        #endregion

        int idCounter = 0;
        //news image
        string imagesString = string.Empty, otherPopPageString = string.Empty;
        if (newsDetailsTbl[0].topPageFileType == 1)
        {
            imagesString += "<div class='article-main-img'><video id='wows1_" + idCounter + "'><source src='../movie/news/" + newsDetailsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
        }
        else if (newsDetailsTbl[0].topPageFileType == 2)
        {
            imagesString += "<div class='article-main-img'>" + newsDetailsTbl[0].topPageFileAddr + "</div>";
        }
        else
        {
            otherPopPageString += "<li><img src='images/news/" + newsDetailsTbl[0].topPageFileAddr + "' alt='اخبار دنیای ورزشی " + newsDetailsTbl[0].id + "' title='دنیای ورزشی' id='wows1_" + idCounter + "'/></li>";
            picThumbString     += "<a href='#wows1_" + idCounter + "' title='اخبار دنیای ورزشی'><img src='images/news/" + newsDetailsTbl[0].topPageFileAddr + "' alt='اخبار دنیای ورزشی " + newsDetailsTbl[0].id + "' title='دنیای ورزشی' /></a>";
        }

        if (newsPicTbl.Count > 0)
        {
            imagesString += "<div class=\"ws_images\"><ul>";
            if (otherPopPageString.Trim().Length > 0)
            {
                imagesString += otherPopPageString;
                idCounter++;
            }
            for (int i = 0; i < newsPicTbl.Count; i++)
            {
                imagesString   += "<li><img src='images/news/" + newsPicTbl[i].picName + "' alt='اخبار دنیای ورزشی " + newsPicTbl[i].id + "' title='دنیای ورزشی' id='wows1_" + idCounter + "'/></li>";
                picThumbString += "<a href='#wows1_" + idCounter + "' title='اخبار دنیای ورزشی'><img src='images/news/" + newsPicTbl[i].picName + "' alt='اخبار دنیای ورزشی " + newsPicTbl[i].id + "' title='دنیای ورزشی' /></a>";
                idCounter++;
            }

            imagesString += "</ul></div><div class=\"ws_thumbs\"><div>";

            imagesString += picThumbString;

            imagesString += "</div></div>" +

                            "<div class=\"ws_shadow\"></div>";
        }
        else
        {
            imagesString += "<div class='article-main-img'><img src='images/news/" + newsDetailsTbl[0].topPageFileAddr + "' alt ='دنیای ورزشی " + newsDetailsTbl[0].topPageFileAddr + "'></div>";
        }

        imgNewsHtml.InnerHtml = imagesString;

        //news details
        newsDetailString += "<ul class='article-info'><li class='article-category'><a href='#'>ورزشی</a></li><li class='article-type'><i class='fa fa-file-text'></i></li></ul>" +
                            "<h1 class='farsi-font-title farsi-align farsi-direction article-title'>" + newsDetailsTbl[0].newsDetTitle + "</h1>" +
                            "<ul class='article-meta'><li><i class='fa fa-clock-o'></i> " + newsDetailsTbl[0].newsDetInsertDate + " </li></ul>" +
                            "<p class='farsi-font-text farsi-align farsi-direction'>" + newsDetailsTbl[0].newsDetDetails + "</p>";

        newsDetailHtml.InnerHtml = newsDetailString;

        #region Simular News
        string simularNewsString = string.Empty;

        int res;


        do
        {
            res = randomNo(newsDetailsTbl.Count);
        } while (newsDetailsTbl[res].topPageFileType != 0);

        simularNewsString += "<div class='media-body'><div class='media-heading'>" +
                             "<h5 class='farsi-font farsi-title'>" + newsDetailsTbl[res].newsDetTitle + "</h5><p class='left-alignment reply-time'>April 04, 2017 At 9:30 AM</p>" +
                             "</div><p class='farsi-font farsi-article'>" + newsDetailsTbl[res].newsDetTitle + "</p>" +
                             "</div><div class='media-left'><img src='images/news/" + newsDetailsTbl[res].topPageFileAddr + "' alt='" + newsDetailsTbl[res].topPageFileAddr + "'></div>";

        simularNewsHtml.InnerHtml = simularNewsString;
        #endregion
    }
コード例 #12
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string newsGrpStr = string.Empty;
        tblNewsGroupCollection newsGrpTbl = new tblNewsGroupCollection();

        newsGrpTbl.ReadList();

        #region news Group
        for (int i = 0; i < newsGrpTbl.Count; i++)
        {
            newsGrpStr += "<li><a class='btn btn-light grd1 effect-1 btn-radius btn-brd' href='news.aspx?itemId=" + newsGrpTbl[i].id + "'>" + newsGrpTbl[i].newsGroupTitle + "</a><li>";
        }
        newsGrpHtml.InnerHtml = newsGrpStr;

        #endregion

        string newsDetStr = "<div class='row dev-list text-center'>";
        int    counter    = 0;
        tblNewsPicCollection     newsPicTbl = new tblNewsPicCollection();
        tblNewsDetailsCollection newsDetTbl = new tblNewsDetailsCollection();

        int itemGet = 0;
        if (Request.QueryString["itemId"] != null)
        {
            itemGet = int.Parse(Request.QueryString["itemId"]);
            newsDetTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.idGroup, CriteriaOperators.Equal, itemGet));
        }
        else
        {
            newsDetTbl.ReadList();
        }

        #region news
        for (int i = 0; i < newsDetTbl.Count; i++)
        {
            if (counter == 4)
            {
                newsDetStr = "</div><div class='row dev-list text-center'>";
                counter    = 0;
            }
            newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, newsDetTbl[i].id));
            newsDetStr += "<div class='col-lg-4 col-md-4 col-sm-12 col-xs-12 wow fadeIn' data-wow-duration='1s' data-wow-delay='0.2s'>" +
                          "<div class='widget clearfix'>";
            //picture
            if (newsDetTbl[i].topPageFileType == 0)
            {
                newsDetStr += "<img src='" + newsDetTbl[i].topPageFileAddr + "' alt='bondelectric " + newsDetTbl[i].newsDetTitle + "' class='img-responsive'>";
            }
            //movie
            else if (newsDetTbl[i].topPageFileType == 1)
            {
                newsDetStr += "<div><video id='video1'><source src='" + newsDetTbl[i].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video></div>";
            }
            //external link
            else
            {
                newsDetStr += newsDetTbl[i].topPageFileAddr;
            }

            newsDetStr += "<div class='widget-title'><h3>" + newsDetTbl[i].newsDetTitle + "</h3><small>" + newsDetTbl[i].newsDetSubtitle + "</small></div>" +
                          "<p>" + newsDetTbl[i].newsDetGist + "</p>" +
                          "<hr><a href='news-details.aspx?itemNo=" + newsDetTbl[i].id + "' data-scroll class='btn btn-light grd1 effect-1 btn-radius btn-brd'>Read more</a></div></div>";

            counter++;
        }
        newsDetStr           += "</div>";
        newsDetHtml.InnerHtml = newsDetStr;

        #endregion

        #region header top picture
        tblLogsCollection picTopTbl = new tblLogsCollection();
        picTopTbl.ReadList();
        if (picTopTbl.Count > 0)
        {
            headerPicHtml.Attributes["style"] = "background: url(" + picTopTbl[0].logDetail + ")no-repeat;background-size: cover;background-position: center;";
        }
        #endregion
    }
コード例 #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Menu
        string            menuString = string.Empty;
        tblMenuCollection menuTbl    = new tblMenuCollection();

        menuTbl.ReadList();

        string subMenuString            = string.Empty;
        tblSubMenuCollection subMenuTbl = new tblSubMenuCollection();

        for (int i = 0; i < menuTbl.Count; i++)
        {
            //get sub menu
            subMenuTbl.ReadList(Criteria.NewCriteria(tblSubMenu.Columns.MenuId, CriteriaOperators.Equal, menuTbl[i].id));

            menuString += "<li><a href='#'>" + menuTbl[i].menuItem + "</a></li>";
            //subMenuString += "<li><a href='#'>" + subMenuTbl[0].SubMenuTitle + "</a></li>";
        }

        //menuHtml.InnerHtml = menuString;
        //subMenuHtml.InnerHtml = subMenuString;

        #region footer details

        // ---------------- footer -----------------
        string socialFooterStr = "";
        tblCompanyCollection companyDetailTbl = new tblCompanyCollection();
        companyDetailTbl.ReadList();
        if (companyDetailTbl.Count > 0)
        {
            coDetailHtml.InnerHtml = companyDetailTbl[0].CoDetail;
            if (companyDetailTbl[0].Facebook.Trim().Length > 0)
            {
                socialFooterStr += "<li><a href='" + companyDetailTbl[0].Facebook + "' class='facebook'><i class='fa fa-facebook'></i></a></li>";
            }
            if (companyDetailTbl[0].Twitter.Trim().Length > 0)
            {
                socialFooterStr += "<li><a href='" + companyDetailTbl[0].Twitter + "' class='twitter'><i class='fa fa-twitter'></i></a></li>";
            }
            if (companyDetailTbl[0].GooglePlus.Trim().Length > 0)
            {
                socialFooterStr += "<li><a href='" + companyDetailTbl[0].GooglePlus + "' class='google'><i class='fa fa-google'></i></a></li>";
            }
            if (companyDetailTbl[0].Instagram.Trim().Length > 0)
            {
                socialFooterStr += "<li><a href='" + companyDetailTbl[0].Instagram + "' class='instagram'><i class='fa fa-instagram'></i></a></li>";
            }
            if (companyDetailTbl[0].youtube.Trim().Length > 0)
            {
                socialFooterStr += "<li><a href='" + companyDetailTbl[0].youtube + "' class='youtube'><i class='fa fa-youtube'></i></a></li>";
            }
            if (companyDetailTbl[0].Linkedin.Trim().Length > 0)
            {
                socialFooterStr += "<li><a href='" + companyDetailTbl[0].Linkedin + "' class='rss'><i class='fa fa-linkedin-square'></i></a></li>";
            }
        }

        socialFooterHtml.InnerHtml = socialFooterStr;
        #endregion

        #region Ad
        string ret = "none";
        tblAdStyleCollection adStyleTbl = new tblAdStyleCollection();
        adStyleTbl.ReadList();

        for (int i = 0; i < adStyleTbl.Count; i++)
        {
            // ----------------- FOR POSITION OF 980*120 --------------------
            if (adStyleTbl[i].styleWidth > 600 && adStyleTbl[i].styleHeight > 105)
            {
            }
            // ----------------- FOR POSITION OF 980*90 --------------------
            else if (adStyleTbl[i].styleWidth > 600 && adStyleTbl[i].styleHeight <= 105)
            {
                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    adHeaderHtml.Src = ret;
                }
            }
            // ----------------- FOR POSITION OF 300*250 --------------------
            else if (adStyleTbl[i].styleWidth <= 600 && adStyleTbl[i].styleHeight >= 250)
            {
                ret = giveMeAd(adStyleTbl[i].id);
                if (ret != "none")
                {
                    adSquareHtml.Src = ret;
                }
            }
        }

        #endregion

        tblGalleryPicturesCollection galleryTbl = new tblGalleryPicturesCollection();
        galleryTbl.ReadList();

        #region footer gallery
        string pictureGalleriesStr = "";
        int    minLengthGallery    = 0;

        if (galleryTbl.Count > 12)
        {
            minLengthGallery = galleryTbl.Count - 13;
        }

        for (int i = galleryTbl.Count - 1; i > minLengthGallery; i--)
        {
            pictureGalleriesStr += "<li><a href='picture-gallery.aspx'><img src='" + galleryTbl[i].GalleryPicAddr + galleryTbl[i].GalleryPicName + "' alt=''></a></li>";
        }

        gallery1Html.InnerHtml = pictureGalleriesStr;
        #endregion

        tblNewsHitCollection hitNewsTbl = new tblNewsHitCollection();
        hitNewsTbl.ReadList();

        tblNewsDetailsCollection newsDetailsTbl = new tblNewsDetailsCollection();

        #region hit news footer

        string hitNewsFooterStr = "";
        int    minLength        = 0;
        if (hitNewsTbl.Count > 5)
        {
            minLength = hitNewsTbl.Count - 6;
        }

        for (int i = hitNewsTbl.Count - 1; i >= minLength; i--)
        {
            newsDetailsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, hitNewsTbl[i].newsId));

            hitNewsFooterStr += "<article class='article widget-article'><div class='farsi-float article4-img'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsTbl[0].id + "'>" +
                                "<img src='images/news/" + newsDetailsTbl[0].topPageFileAddr + "' alt='" + newsDetailsTbl[0].topPageFileAddr + "'>" +
                                "</a></div><div class='article-body'>" +
                                "<h4 class='farsi-position farsi-font article-title'><a href='donyaye-varzeshi-news-details.aspx?newsId=" + newsDetailsTbl[0].id + "'>" + newsDetailsTbl[0].newsDetTitle + "</a></h4>" +
                                "<ul class='article-meta'><li><i class='fa fa-clock-o'></i>" + newsDetailsTbl[0].newsDetInsertDate + "</li><li><i class='fa fa-comments'></i>" + newsDetailsTbl[0].incReview + "</li></ul>" +
                                "</div></article>";
        }

        hitNewsFooterHtml.InnerHtml += hitNewsFooterStr;
        #endregion
    }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int itemGet = 0;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("news-add.aspx");
        }

        //fill data

        tblNewsDetailsCollection newsDetailsTbl = new tblNewsDetailsCollection();

        newsDetailsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        tblNewsPicCollection newsPicTbl = new tblNewsPicCollection();

        newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));

        tblNewsHyperlinkCollection newsHypTbl = new tblNewsHyperlinkCollection();

        newsHypTbl.ReadList(Criteria.NewCriteria(tblNewsHyperlink.Columns.newsId, CriteriaOperators.Equal, itemGet));



        if (newsDetailsTbl.Count > 0)
        {
            if (newsDetailsTbl[0].topPageFileAddr.Length > 3)
            {
                if (newsDetailsTbl[0].topPageFileType == 0)
                {
                    setPicHtml.InnerHtml = "<img src='../images/news/" + newsDetailsTbl[0].topPageFileAddr + "' class='img-responsive' draggable='false'>";
                }
                else if (newsDetailsTbl[0].topPageFileType == 1)
                {
                    setPicHtml.InnerHtml = "<video id='video1'><source src='../movie/news/" + newsDetailsTbl[0].topPageFileAddr + "' type='video/mp4'>Your browser does not support HTML5 video.</video>";
                }
                else
                {
                    setPicHtml.InnerHtml = newsDetailsTbl[0].topPageFileAddr;
                }
            }
        }

        string             writerStr      = string.Empty;
        tblStaffCollection NewsCreatorTbl = new tblStaffCollection();

        NewsCreatorTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, newsDetailsTbl[0].idStaffCreator));

        if (NewsCreatorTbl.Count > 0)
        {
            writerStr = NewsCreatorTbl[0].StaffName + " " + NewsCreatorTbl[0].StaffFamily;
        }

        string addDataString = string.Empty;

        addDataString += "<h3>" + newsDetailsTbl[0].newsDetTitle + "</h3><br>" +
                         "<h5 class='farsi-direction farsi-font-text subtitle-text'>" + newsDetailsTbl[0].newsDetSubtitle + "</h5>" +
                         "<span class='code'>Writer: <a>" + writerStr + "</a></span>" +
                         "<p>News Details: " + newsDetailsTbl[0].newsDetDetails + "</p>" +
                         "<div class='price'>" +
                         "<span class='text'></span>";

        addDataString += "<span class='price-new'></span>";


        addDataString += "<span class='price-tax'><label class='checkbox'></label></span><br>";


        addDataString += "<span class='points'><small>Insert Date: " + newsDetailsTbl[0].newsDetInsertDate + "</small></span><br>";

        addDataString += "</div>";

        addDetailHtml.InnerHtml = addDataString;

        //fill data in change part
        //Groups
        tblNewsGroupCollection newsGroupTbl = new tblNewsGroupCollection();

        newsGroupTbl.ReadList();


        //Select old items
        if (!IsPostBack)
        {
            if (newsDetailsTbl[0].newsDetTitle.Length > 0)
            {
                txtTitle.Text = newsDetailsTbl[0].newsDetTitle;
            }

            if (newsDetailsTbl[0].newsDetDetails.Length > 0)
            {
                ckNews.Text = newsDetailsTbl[0].newsDetDetails;
            }

            for (int i = 0; i < newsGroupTbl.Count; i++)
            {
                ddlNewsGroup.Items.Add(new ListItem(newsGroupTbl[i].newsGroupTitle, newsGroupTbl[i].id.ToString()));
            }
            ddlNewsGroup.SelectedValue = newsDetailsTbl[0].idGroup.ToString();
        }

        #region extera items(Pics/Movies/Links)

        //extra pictures and movies
        tblNewsMovieCollection newsMovieTbl = new tblNewsMovieCollection();
        newsMovieTbl.ReadList(Criteria.NewCriteria(tblNewsMovie.Columns.newsId, CriteriaOperators.Equal, itemGet));

        tblNewsPicCollection newsPictureTbl = new tblNewsPicCollection();
        newsPictureTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));


        string extraMovieString = "", extraPicturesString = "", extraHypString = "";

        extraMovieString    += "<h3>Movies: </h3><ul>";
        extraPicturesString += "<h3>Pictures: </h3><ul>";
        extraHypString      += "<h3>External links: </h3><ul>";

        for (int i = 0; i < newsMovieTbl.Count; i++)
        {
            extraMovieString += "<li class='tumb-ul'> <video id='image-extra video1' ><source src='../movie/news/sport/" + newsMovieTbl[i].movieName + "' type='video/mp4'>Your browser does not support HTML5 video.</video></li>";
        }

        if (newsMovieTbl.Count == 0)
        {
            extraMovieString += "<li class='tumb-ul'>There is no video to show</li>";
        }



        for (int i = 0; i < newsPictureTbl.Count; i++)
        {
            extraPicturesString += "<li class='tumb-ul'><img src='../images/news/sport/" + newsPictureTbl[i].picName + "' class='image-extra thumbnail-pictures' alt='" + newsPictureTbl[i].picName + "' /></li>";
        }

        if (newsPictureTbl.Count == 0)
        {
            extraPicturesString += "<li class='tumb-ul'>There is no picture to show</li>";
        }

        for (int i = 0; i < newsHypTbl.Count; i++)
        {
            extraHypString += "<li class='tumb-ul'>" + newsHypTbl[i].HyperlinkAddr + "</li>";
        }

        if (newsHypTbl.Count == 0)
        {
            extraHypString += "<li class='tumb-ul'>There is no external link to show</li>";
        }


        extraMovieString    += "</ul>";
        extraPicturesString += "</ul>";
        extraHypString      += "</ul>";


        extraMovieHtml.InnerHtml = extraMovieString;

        extraPictureHtml.InnerHtml = extraPicturesString;
        extraHypHtml.InnerHtml     = extraHypString;
        #endregion
    }
コード例 #15
0
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int itemGet = 0; string fileNameUpdate = string.Empty;

        if (Request.QueryString["item"] != null)
        {
            itemGet = int.Parse(Request.QueryString["item"]);
        }
        else
        {
            Response.Redirect("news-add.aspx");
        }

        tblNewsDetailsCollection newsTbl = new tblNewsDetailsCollection();

        newsTbl.ReadList(Criteria.NewCriteria(tblNewsDetails.Columns.id, CriteriaOperators.Equal, itemGet));

        //tblNewsPicCollection newsPicTbl = new tblNewsPicCollection();
        //newsPicTbl.ReadList(Criteria.NewCriteria(tblNewsPic.Columns.newsId, CriteriaOperators.Equal, itemGet));

        string             writerStr = string.Empty;
        tblStaffCollection infWriterTbl = new tblStaffCollection();

        infWriterTbl.ReadList(Criteria.NewCriteria(tblStaff.Columns.id, CriteriaOperators.Equal, newsTbl[0].idStaffCreator));

        if (infWriterTbl.Count > 0)
        {
            writerStr = infWriterTbl[0].StaffName + " " + infWriterTbl[0].StaffFamily;
        }
        else
        {
            writerStr = "Unknown";
        }



        //if (newsPicTbl.Count > 0)
        //    fileNameUpdate = newsPicTbl[0].picName;


        if (txtTitle.Text.Trim().Length > 0 && ckNews.Text.Trim().Length > 0)
        {
            newsTbl[0].newsDetTitle = txtTitle.Text;
            string str = ckNews.Text;
            newsTbl[0].newsDetDetails = Server.HtmlDecode(str);
            newsTbl[0].idGroup        = Int32.Parse(ddlNewsGroup.SelectedValue);


            // file upload start
            string filename = string.Empty;
            if (IsPostBack)
            {
                Boolean fileOK = false;
                String  path   = Server.MapPath("~/images/news/");
                if (fuGallery.HasFile)
                {
                    String   fileExtension     = System.IO.Path.GetExtension(fuGallery.FileName).ToLower();
                    String[] allowedExtensions = { ".jpg", ".png", ".bmp", ".gif" };
                    for (int i = 0; i < allowedExtensions.Length; i++)
                    {
                        if (fileExtension == allowedExtensions[i])
                        {
                            fileOK = true;
                        }
                    }
                }

                if (fileOK)
                {
                    try
                    {
                        fuGallery.PostedFile.SaveAs(path + fuGallery.FileName);
                        filename = fuGallery.FileName;
                    }
                    catch (Exception ex)
                    {
                        lblError.Text = "A problem accurred while uplouding picture";
                    }
                }
                else
                {
                    lblError.Text = "Not valid picture file";
                }
            }

            // file upload end
            if (filename.Trim().Length > 0)
            {
                newsTbl[0].topPageFileAddr = filename;
            }
            else
            {
                newsTbl[0].topPageFileAddr = fileNameUpdate;
            }

            newsTbl[0].Update();
        }

        Response.Redirect("news-details.aspx?item=" + itemGet);
    }