public string ShowArticles()
    {
        string tbarticle = "";
        CDymanicviewArticles ArticleView = new CDymanicviewArticles();

        try
        {
            int page = 1;
            try
            {
                page = int.Parse(Request.QueryString["page"].ToString());
            }
            catch
            {
            }
            if (Session["SSArticleAll"] != null)
            {
                ArticleView = (CDymanicviewArticles)Session["SSArticleAll"];
                ArticleView.SetNumberArticlesGroup(idgroup);
                ArticleView.SetCurrentPage(page);
            }
            else
            {
                ArticleView.SetPageSize(20);
                ArticleView.SetNumberArticlesGroup(idgroup);
                ArticleView.SetCurrentPage(page);
                Session["SSArticleAll"] = ArticleView;
            }
            DataSet dsArticle  = ArticleView.ArticleGroupSelectFromTo(idgroup);
            int     numArticle = 0;
            if (dsArticle.Tables.Count > 0)
            {
                numArticle = dsArticle.Tables[0].Rows.Count;
            }
            string id    = "";
            string title = "";
            string url   = "";
            string sum   = "";
            if (ArticleView.GetPages() > 1)
            {
                tpage += ": " + BuildPage(ArticleView.GetCurrentPage(), ArticleView.GetPages());
            }
            else
            {
                tpage = "";
            }
            tbarticle  = "<table border='0' cellpadding='0' cellspacing='0' width='100%' align='left'>";
            tbarticle += "<tr><td height='5' width='120'></td><td></td></tr>";
            for (int i = 0; i < numArticle; i++)
            {
                id    = dsArticle.Tables[0].Rows[i]["id"].ToString();
                title = dsArticle.Tables[0].Rows[i]["title"].ToString();
                sum   = dsArticle.Tables[0].Rows[i]["sumarticle"].ToString();
                url   = dsArticle.Tables[0].Rows[i]["urlimage"].ToString();
                if (url.Length > 0)
                {
                    url = "image/img_article/" + url;
                }
                tbarticle += "<tr>";
                if (url.Length > 0)
                {
                    tbarticle += "<td height='95' align='center'><img src='" + url + "' width='110' height='85' /></td>";
                    tbarticle += "<td valign='top'>";
                    tbarticle += "<span class='text_2'><a href='?menu=da&id=" + id + "'>" + title + "</a></span>";
                    tbarticle += "<div>" + sum + " ...</div>";
                    tbarticle += "</td>";
                }
                else
                {
                    tbarticle += "<td valign='top' height='95' colspan='2'>";
                    tbarticle += "<span class='text_2'><a href='?menu=da&id=" + id + "'>" + title + "</a></span>";
                    tbarticle += "<div>" + sum + " ...</div>";
                    tbarticle += "</td>";
                }
                tbarticle += "</tr>";
                if (i + 1 < numArticle)
                {
                    tbarticle += "<tr><td colspan='2' class='bg_line2'></td></tr>";
                }
            }
            tbarticle += "</table>";
        }
        catch
        { }
        return(tbarticle);
    }
    public string ShowArticles()
    {
        string tbarticle = "";
        CDymanicviewArticles ArticleView = new CDymanicviewArticles();
        try
        {
            int page = 1;
            try
            {
                page = int.Parse(Request.QueryString["page"].ToString());
            }
            catch
            {

            }
            if (Session["SSArticleAll"] != null)
            {
                ArticleView = (CDymanicviewArticles)Session["SSArticleAll"];
                ArticleView.SetNumberArticlesGroup(idgroup);
                ArticleView.SetCurrentPage(page);
            }
            else
            {
                ArticleView.SetPageSize(20);
                ArticleView.SetNumberArticlesGroup(idgroup);
                ArticleView.SetCurrentPage(page);
                Session["SSArticleAll"] = ArticleView;
            }
            DataSet dsArticle = ArticleView.ArticleGroupSelectFromTo(idgroup);
            int numArticle = 0;
            if (dsArticle.Tables.Count > 0)
            {
                numArticle = dsArticle.Tables[0].Rows.Count;
            }
            string id = "";
            string title = "";
            string url = "";
            string sum = "";
            if (ArticleView.GetPages() > 1)
            {
                tpage += ": " + BuildPage(ArticleView.GetCurrentPage(), ArticleView.GetPages());
            }
            else
            {
                tpage = "";
            }
            tbarticle = "<table border='0' cellpadding='0' cellspacing='0' width='100%' align='left'>";
            tbarticle += "<tr><td height='5' width='120'></td><td></td></tr>";
            for (int i = 0; i < numArticle; i++)
            {
                id = dsArticle.Tables[0].Rows[i]["id"].ToString();
                title = dsArticle.Tables[0].Rows[i]["title"].ToString();
                sum = dsArticle.Tables[0].Rows[i]["sumarticle"].ToString();
                url = dsArticle.Tables[0].Rows[i]["urlimage"].ToString();
                if (url.Length > 0)
                {
                    url = "image/img_article/" + url;
                }
                tbarticle += "<tr>";
                if (url.Length > 0)
                {
                    tbarticle += "<td height='95' align='center'><img src='" + url + "' width='110' height='85' /></td>";
                    tbarticle += "<td valign='top'>";
                    tbarticle += "<span class='text_2'><a href='?menu=da&id=" + id + "'>" + title + "</a></span>";
                    tbarticle += "<div>" + sum + " ...</div>";
                    tbarticle += "</td>";
                }
                else
                {
                    tbarticle += "<td valign='top' height='95' colspan='2'>";
                    tbarticle += "<span class='text_2'><a href='?menu=da&id=" + id + "'>" + title + "</a></span>";
                    tbarticle += "<div>" + sum + " ...</div>";
                    tbarticle += "</td>";
                }
                tbarticle += "</tr>";
                if (i + 1 < numArticle)
                {
                    tbarticle += "<tr><td colspan='2' class='bg_line2'></td></tr>";
                }
            }
            tbarticle += "</table>";
        }
        catch
        { }
        return tbarticle;
    }
Ejemplo n.º 3
0
    public void ShowListArticle()
    {
        int idgroup = 0;
        int page = 0;
        try
        {
            idgroup = int.Parse(Request.QueryString["idgroup"].ToString());
        }
        catch
        { }
        try
        {
            page = int.Parse(Request.QueryString["page"].ToString());
        }
        catch
        {

        }
        CDymanicviewArticles articleList = new CDymanicviewArticles();
        if (Session["SSAdminArticle"] == null)
        {
            articleList.SetPageSize(20);
            if (idgroup > 0)
            {
                articleList.SetIdGroup(idgroup);
                articleList.BuildWhere();
            }
            articleList.AdminSetNumarticle();
            if (page > 0)
            {
                articleList.SetCurrentPage(page);
            }
            else
            {
                articleList.SetCurrentPage(1);
            }
            Session["SSAdminArticle"] = articleList;
        }
        else
        {
            articleList = (CDymanicviewArticles)Session["SSAdminArticle"];
            if (idgroup > 0)
            {
                articleList.SetIdGroup(idgroup);
                articleList.BuildWhere();
            }
            articleList.AdminSetNumarticle();
            if (page > 0)
            {
                articleList.SetCurrentPage(page);
            }
            else
            {
                articleList.ReSetCurrentPage();
            }
        }
        DataSet dsarticle = articleList.AdminArticleFromTo();
        int numarticle = 0;
        if (dsarticle.Tables.Count > 0)
        {
            numarticle = dsarticle.Tables[0].Rows.Count;
        }
        if (articleList.GetPages() > 1)
        {
            BuildPage(articleList.GetCurrentPage(), articleList.GetPages());
        }
        if (numarticle > 0)
        {
            strTable = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;' width='730'>";
            strTable += "<tr class='tlist'><td width='30'>STT</td><td width='200'>Tiêu đề tin đăng</td><td width='400'>Mô tả ngắn gọn</td><td width='50'>Hiển thị</td><td width='50'>Xóa bỏ</td></tr>";
            for (int i = 1; i <= numarticle; i++)
            {
                string id = dsarticle.Tables[0].Rows[i - 1]["id"].ToString();
                string check = "";
                if (dsarticle.Tables[0].Rows[i - 1]["ishow"].ToString().Equals("1"))
                {
                    check = "<input type='checkbox' checked='checked' DISABLED />";
                }
                else
                {
                    check = "<input type='checkbox' DISABLED />";
                }
                strTable += "<tr><td align='center'>" + i.ToString() + "</td><td class='title1' width='200'><a href='?menu=edita&id=" + id + "'>" + dsarticle.Tables[0].Rows[i - 1]["title"].ToString() + "</a></td>";
                strTable += "<td>" + dsarticle.Tables[0].Rows[i - 1]["sumarticle"].ToString() + "</td>";
                strTable += "<td align='center'>" + check + "</td><td align='center'><span class='spanbt' onclick='Dfunction(" + id + ",7);'>Xóa</span></td></tr>";
            }
            strTable += "</table>";
        }
        else
        {
            strTable = "Chưa có tin nào";
        }
    }
Ejemplo n.º 4
0
    public void ShowListArticle()
    {
        int idgroup = 0;
        int page    = 0;

        try
        {
            idgroup = int.Parse(Request.QueryString["idgroup"].ToString());
        }
        catch
        { }
        try
        {
            page = int.Parse(Request.QueryString["page"].ToString());
        }
        catch
        {
        }
        CDymanicviewArticles articleList = new CDymanicviewArticles();

        if (Session["SSAdminArticle"] == null)
        {
            articleList.SetPageSize(20);
            if (idgroup > 0)
            {
                articleList.SetIdGroup(idgroup);
                articleList.BuildWhere();
            }
            articleList.AdminSetNumarticle();
            if (page > 0)
            {
                articleList.SetCurrentPage(page);
            }
            else
            {
                articleList.SetCurrentPage(1);
            }
            Session["SSAdminArticle"] = articleList;
        }
        else
        {
            articleList = (CDymanicviewArticles)Session["SSAdminArticle"];
            if (idgroup > 0)
            {
                articleList.SetIdGroup(idgroup);
                articleList.BuildWhere();
            }
            articleList.AdminSetNumarticle();
            if (page > 0)
            {
                articleList.SetCurrentPage(page);
            }
            else
            {
                articleList.ReSetCurrentPage();
            }
        }
        DataSet dsarticle  = articleList.AdminArticleFromTo();
        int     numarticle = 0;

        if (dsarticle.Tables.Count > 0)
        {
            numarticle = dsarticle.Tables[0].Rows.Count;
        }
        if (articleList.GetPages() > 1)
        {
            BuildPage(articleList.GetCurrentPage(), articleList.GetPages());
        }
        if (numarticle > 0)
        {
            strTable  = "<table border='1' cellpadding='2' cellspacing='0' bordercolor='#DFDFDF' style='border-collapse:collapse;' width='730'>";
            strTable += "<tr class='tlist'><td width='30'>STT</td><td width='200'>Tiêu đề tin đăng</td><td width='400'>Mô tả ngắn gọn</td><td width='50'>Hiển thị</td><td width='50'>Xóa bỏ</td></tr>";
            for (int i = 1; i <= numarticle; i++)
            {
                string id    = dsarticle.Tables[0].Rows[i - 1]["id"].ToString();
                string check = "";
                if (dsarticle.Tables[0].Rows[i - 1]["ishow"].ToString().Equals("1"))
                {
                    check = "<input type='checkbox' checked='checked' DISABLED />";
                }
                else
                {
                    check = "<input type='checkbox' DISABLED />";
                }
                strTable += "<tr><td align='center'>" + i.ToString() + "</td><td class='title1' width='200'><a href='?menu=edita&id=" + id + "'>" + dsarticle.Tables[0].Rows[i - 1]["title"].ToString() + "</a></td>";
                strTable += "<td>" + dsarticle.Tables[0].Rows[i - 1]["sumarticle"].ToString() + "</td>";
                strTable += "<td align='center'>" + check + "</td><td align='center'><span class='spanbt' onclick='Dfunction(" + id + ",7);'>Xóa</span></td></tr>";
            }
            strTable += "</table>";
        }
        else
        {
            strTable = "Chưa có tin nào";
        }
    }