コード例 #1
0
    private void BindInfo()
    {
        if (!SystemTool.IsInt(Request.QueryString["nid"].ToString()))
        {
            Response.Redirect("404.html");
        }
        string  sql = "select * from article_info where nav_id=" + Request.QueryString["nid"];
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            string   article_image = ds.Tables[0].Rows[0]["article_image"].ToString();
            string[] images        = article_image.Split('#');
            string   html          = "";
            for (int i = 0; i < images.Length - 1; i++)
            {
                string bianhao = "b" + i;
                string _width  = "100";
                string _height = "100";
                var    aaa     = "<div id='div" + bianhao + "'  class='imgbox hasboth'  style='background-color:#fff;width:" + _width + "px;height:" + _height + "px;'>";
                var    aa      = " <div class='w_upload' style='width:" + _width + "px;height:" + _height + "px;' >    <a class='item_close' onclick=deletepic('" + bianhao + "')>删除</a><span style='width:" + _width + "px;height:" + _height + "px;' class='item_box'>";
                var    bb      = "<img id='img" + bianhao + "' src='/" + images[i] + "'  style='background:url(images/aa1.gif) no-repeat center;width:" + _width + "px;height:" + _height + "px;'/></span>";
                var    dds     = "</div></div>";
                html += aaa + aa + bb + dds;
            }
            txtname.Text  = article_image;
            box.InnerHtml = html;
        }
    }
コード例 #2
0
    protected string getPage()
    {
        double total     = 0;
        double totalPage = 1;
        double pPage     = 6;
        double cPage     = 1;

        if (null != Request.QueryString["cpage"] && SystemTool.IsInt(Request.QueryString["cpage"].ToString()))
        {
            cPage = Convert.ToDouble(Request.QueryString["cpage"].ToString());
        }
        double prev = cPage - 1 <= 0 ? 1 : cPage - 1;
        string id   = "0";

        if (null != Request.QueryString["id"] && SystemTool.IsInt(Request.QueryString["id"].ToString()))
        {
            id = Request.QueryString["id"].ToString();
        }
        string sql    = "select count(id) from article_info where nav_id=" + id;
        string result = DB.ExecuteSqlValue(sql, null);

        if (result != "" && result != "no")
        {
            total     = Convert.ToInt32(result);
            totalPage = Math.Ceiling(total / pPage);
        }
        double next = (cPage + 1) >= totalPage ? totalPage : cPage + 1;

        return("页次:" + cPage + "/" + totalPage + " 每页" + pPage + " 总数" + total + "<a href='articlelist.aspx?id=" + id + "'>首页</a><a href='articlelist.aspx?id=" + id + "&cpage=" + prev + "'>上一页</a><a href='articlelist.aspx?id=" + id + "&cpage=" + next + "'>下一页</a><a href='articlelist.aspx?id=" + id + "&cpage=" + totalPage + "'>尾页</a>");
    }
コード例 #3
0
    protected string getLocation()
    {
        string id = "0";

        if (null != Request.QueryString["id"] && SystemTool.IsInt(Request.QueryString["id"].ToString()))
        {
            id = DB.ExecuteSqlValue("select nav_id from article_info where id=" + Request.QueryString["id"].ToString() + " and isshow=1", null);
            if (id == "" || id == "no")
            {
                id = "-1";
            }
        }
        if (id == "7")
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>我的日记</a></span><b>个人日记</b>");
        }
        if (id == "8")
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>我的日记</a></span><b>学习笔记</b>");
        }
        if (id == "11")
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>技术文章</a></span><b></b>");
        }
        return("");
    }
コード例 #4
0
    protected string getLocation()
    {
        string id = "0";

        if (null != Request.QueryString["id"] && SystemTool.IsInt(Request.QueryString["id"].ToString()))
        {
            id = DB.ExecuteSqlValue("select nav_id from article_info where id=" + Request.QueryString["id"].ToString() + " and isshow=1", null);
            if (id == "" || id == "no")
            {
                id = "-1";
            }
        }
        string  sql = @"select isnull(n0.nav_name,'') nav_name0,n.nav_name from nav_info n
left join nav_info n0 on n0.id=n.parent_id
 where n.id=" + id;
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>" + ds.Tables[0].Rows[0]["nav_name0"].ToString() + "</a></span><b>" + ds.Tables[0].Rows[0]["nav_name"].ToString() + "</b>");
        }
        else
        {
            return("");
        }
    }
コード例 #5
0
    protected void rptlist_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string       cmd    = e.CommandName.ToString();
        string       userid = e.CommandArgument.ToString();
        TextBox      name   = e.Item.FindControl("txt_name") as TextBox;
        DropDownList muban  = e.Item.FindControl("ddl_muban") as DropDownList;
        TextBox      paixu  = e.Item.FindControl("txt_paixu") as TextBox;
        DropDownList show   = e.Item.FindControl("ddl_show") as DropDownList;
        DropDownList nav0   = e.Item.FindControl("ddl_nav0") as DropDownList;

        if (cmd == "lbtshan")
        {
            string sql    = "delete from nav_info where id=" + userid;
            int    result = DB.ExecuteSql(sql, null);
            if (result > 0)
            {
                SystemTool.AlertShow(this, "删除成功");
                BindInfo();
            }
        }
        if (cmd == "lbtn_edit")
        {
            if (name.Text == "")
            {
                SystemTool.AlertShow(this, "导航栏名称不能为空");
            }
            if (paixu.Text == "")
            {
                SystemTool.AlertShow(this, "排序不能为空");
                return;
            }
            if (!SystemTool.IsInt(paixu.Text))
            {
                paixu.Text = "0";
            }
            string sql = "select id from nav_info where nav_name='" + name.Text + "'";
            string r   = DB.ExecuteSqlValue(sql, null);
            if (r != "" && r != "no")
            {
                if (r != userid)
                {
                    SystemTool.AlertShow(this, "导航栏名称已存在");
                    return;
                }
            }
            sql = "update nav_info set nav_name='" + name.Text + "',muban_id='" + muban.SelectedValue + "',paixu='" + paixu.Text + "',isshow='" + show.SelectedValue + "',parent_id='" + nav0.SelectedValue + "' where id=" + userid;
            int result = DB.ExecuteSql(sql, null);
            if (result > 0)
            {
                SystemTool.AlertShow_Refresh(this, "保存成功", "nvalist.aspx");
            }
            else
            {
                SystemTool.AlertShow(this, "保存失败");
            }
        }
    }
コード例 #6
0
    private void BindInfo()
    {
        string id  = "0";
        string nid = "0";

        if (null != Request.QueryString["id"] && SystemTool.IsInt(Request.QueryString["id"].ToString()))
        {
            id = Request.QueryString["id"].ToString();
        }
        string  sql = "select * from article_info where id=" + id + " and isshow=1 and detail !='album'";
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            p_title.InnerHtml  = ds.Tables[0].Rows[0]["title"].ToString();
            p_box.InnerHtml    = "<span>发布时间:" + ds.Tables[0].Rows[0]["addtime"].ToString() + "</span><span>作者:" + ds.Tables[0].Rows[0]["author"].ToString() + "</span><span>点击:" + ds.Tables[0].Rows[0]["visited"].ToString() + "</span>";
            p_detail.InnerHtml = ds.Tables[0].Rows[0]["detail"].ToString();
            nid = ds.Tables[0].Rows[0]["nav_id"].ToString();
        }
        else
        {
            p_title.InnerHtml  = "";
            p_box.InnerHtml    = "";
            p_detail.InnerHtml = "参数有误!";
        }
        prev.InnerHtml = "上一篇:没有了";
        sql            = "select max(id) from article_info where id<" + id + " and isshow=1 and nav_id=" + nid;
        string previd = DB.ExecuteSqlValue(sql, null);

        if (previd != "" && previd != "no")
        {
            sql = "select a.title,m.muban_url from article_info a left join muban_info m on m.id=a.muban_id where a.id=" + previd;
            DataSet result = DB.ExecuteSqlDataSet(sql, null);
            if (result.Tables[0].Rows.Count > 0)
            {
                prev.InnerHtml = "上一篇:<a href='" + result.Tables[0].Rows[0]["muban_url"].ToString() + "?id=" + previd + "'>" + result.Tables[0].Rows[0]["title"].ToString() + "</a>";
            }
        }
        next.InnerHtml = "下一篇:没有了";
        sql            = "select min(id) from article_info where id>" + id + " and isshow=1 and nav_id=" + nid;
        string nextid = DB.ExecuteSqlValue(sql, null);

        if (nextid != "" && nextid != "no")
        {
            sql = "select a.title,m.muban_url from article_info a left join muban_info m on m.id=a.muban_id where a.id=" + nextid;
            DataSet result = DB.ExecuteSqlDataSet(sql, null);
            if (result.Tables[0].Rows.Count > 0)
            {
                next.InnerHtml = "下一篇:<a href='" + result.Tables[0].Rows[0]["muban_url"].ToString() + "?id=" + nextid + "'>" + result.Tables[0].Rows[0]["title"].ToString() + "</a>";
            }
        }
    }
コード例 #7
0
    protected string getPage()
    {
        double cPage = 1;
        double pPage = 12;

        if (Request.QueryString["page"] != null && SystemTool.IsInt(Request.QueryString["page"].ToString()))
        {
            cPage = Convert.ToDouble(Request.QueryString["page"].ToString());
        }
        string[] images    = getData();
        double   totalPage = Math.Ceiling((images.Length - 1) / pPage);
        double   prev      = cPage - 1 > 0 ? cPage - 1 : cPage;
        double   next      = cPage + 1 > totalPage ? totalPage : cPage + 1;

        return("页次:" + cPage + "/" + totalPage + " 每页" + pPage + " 总数" + (images.Length - 1) + "<a href='listpic.aspx'>首页</a><a href='listpic.aspx?page=" + prev + "'>上一页</a><a href='listpic.aspx?page=" + next + "'>下一页</a><a href='listpic.aspx?page=" + totalPage + "'>尾页</a>");
    }
コード例 #8
0
    private void BindInfo()
    {
        if (!SystemTool.IsInt(Request.QueryString["nid"].ToString()))
        {
            Response.Redirect("404.html");
        }
        string  sql = "select * from article_info where nav_id=" + Request.QueryString["nid"];
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            string navid  = ds.Tables[0].Rows[0]["nav_id"].ToString();
            string detail = ds.Tables[0].Rows[0]["detail"].ToString();
            txtbeizhu.Value = detail;
        }
    }
コード例 #9
0
    protected void add_modules(object sender, EventArgs e)
    {
        string pid      = ddl_nav.SelectedValue;
        string muban_id = ddl_muban.SelectedValue;
        //if (muban_id == "0") {
        //    SystemTool.AlertShow(this, "请选择模板");
        //    return;
        //}
        string name = daohanglanmingcheng.Value;

        if (name == "")
        {
            SystemTool.AlertShow(this, "导航栏名称不能为空");
            return;
        }
        string px = xuhao.Value;

        if (px == "")
        {
            SystemTool.AlertShow(this, "序号不能为空");
            return;
        }
        if (!SystemTool.IsInt(px))
        {
            px = "0";
        }
        string isshow = ddl_show.SelectedValue;
        string sql    = "select id from nav_info where nav_name='" + name + "'";
        string r      = DB.ExecuteSqlValue(sql, null);

        if (r != "" && r != "no")
        {
            SystemTool.AlertShow(this, "导航栏名称已存在");
            return;
        }
        sql = "insert into nav_info(nav_name,muban_id,parent_id,paixu,isshow) values('" + name + "','" + muban_id + "','" + pid + "','" + px + "','" + isshow + "')";
        int result = DB.ExecuteSql(sql, null);

        if (result > 0)
        {
            SystemTool.AlertShow_Refresh(this, "保存成功", "nvalist.aspx");
        }
        else
        {
            SystemTool.AlertShow(this, "添加失败");
        }
    }
コード例 #10
0
    private void BindInfo()
    {
        double cPage = 1;

        if (null != Request.QueryString["cpage"] && SystemTool.IsInt(Request.QueryString["cpage"].ToString()))
        {
            cPage = Convert.ToDouble(Request.QueryString["cpage"].ToString());
        }
        string id = "0";

        if (null != Request.QueryString["nid"] && SystemTool.IsInt(Request.QueryString["nid"].ToString()))
        {
            id = Request.QueryString["nid"].ToString();
        }
        string  sql = @"with t as (
select ROW_NUMBER() OVER(ORDER BY id DESC) AS ROWNUM, * from article_info where nav_id=" + id + " ) select * from t where  rownum>" + (cPage * 6 - 6) + " and rownum<=" + (cPage * 6);
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        rpt_main.DataSource = ds.Tables[0];
        rpt_main.DataBind();
    }
コード例 #11
0
    protected string getLocation()
    {
        string id = "0";

        if (null != Request.QueryString["nid"] && SystemTool.IsInt(Request.QueryString["nid"].ToString()))
        {
            id = Request.QueryString["nid"].ToString();
        }
        if (id == "7")
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>我的日记</a></span><b>个人日记</b>");
        }
        if (id == "8")
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>我的日记</a></span><b>学习笔记</b>");
        }
        if (id == "11")
        {
            return("<a href='index.aspx' target='_blank'>网站首页</a>>><a href='#' target='_blank'>技术文章</a></span><b></b>");
        }
        return("");
    }
コード例 #12
0
    protected string getImages()
    {
        double cPage = 1;
        double pPage = 12;
        Int32  fori  = 0;
        Int32  forj  = 0;

        if (Request.QueryString["page"] != null && SystemTool.IsInt(Request.QueryString["page"].ToString()))
        {
            cPage = Convert.ToDouble(Request.QueryString["page"].ToString());
            fori  = Convert.ToInt32(cPage * 12 - 12);
        }
        string[] images = getData();
        double   total  = images.Length - 1;

        forj = Convert.ToInt32(Math.Min(total, cPage * pPage));
        string html = "";

        for (; fori < forj; fori++)
        {
            html += "<li><a href='/" + images[fori] + "' target='_blank'><img src='/" + images[fori] + "'><span>图片展示</span></a></li>";
        }
        return(html == "" ? "暂无数据..." : html);
    }
コード例 #13
0
    private void BindInfo()
    {
        if (!SystemTool.IsInt(Request.QueryString["id"].ToString()))
        {
            Response.Redirect("404.html");
        }
        string  sql = "select * from article_info where id=" + Request.QueryString["id"];
        DataSet ds  = DB.ExecuteSqlDataSet(sql, null);

        if (ds.Tables[0].Rows.Count > 0)
        {
            string navid = ds.Tables[0].Rows[0]["nav_id"].ToString();
            sql = "select * from nav_info where id=" + navid;
            DataSet dsnav = DB.ExecuteSqlDataSet(sql, null);
            if (dsnav.Tables[0].Rows.Count > 0)
            {
                string nav0 = dsnav.Tables[0].Rows[0]["parent_id"].ToString();
                if (nav0 == "0")
                {
                    //当前为一级导航栏
                    ddl_nav0.SelectedValue = navid;
                }
                else
                {
                    sql   = "select * from nav_info where parent_id=" + nav0;
                    dsnav = DB.ExecuteSqlDataSet(sql, null);
                    if (dsnav.Tables[0].Rows.Count > 0)
                    {
                        ddl_nav.Items.Clear();
                        ddl_nav.DataSource     = dsnav.Tables[0];
                        ddl_nav.DataTextField  = "nav_name";
                        ddl_nav.DataValueField = "id";
                        ddl_nav.DataBind();
                        ListItem list = new ListItem("--请选择--", "0");
                        ddl_nav.Items.Insert(0, list);
                        ddl_nav.SelectedValue = navid;
                    }
                    else
                    {
                        ddl_nav.Items.Clear();
                        ListItem list = new ListItem("--请选择--", "0");
                        ddl_nav.Items.Insert(0, list);
                    }
                }
            }
            string title = ds.Tables[0].Rows[0]["title"].ToString();
            txttitle.Text = title;
            string   article_image = ds.Tables[0].Rows[0]["article_image"].ToString();
            string[] images        = article_image.Split('#');
            string   html          = "";
            for (int i = 0; i < images.Length - 1; i++)
            {
                string bianhao = "b" + i;
                string _width  = "100";
                string _height = "100";
                var    aaa     = "<div id='div" + bianhao + "'  class='imgbox hasboth'  style='background-color:#fff;width:" + _width + "px;height:" + _height + "px;'>";
                var    aa      = " <div class='w_upload' style='width:" + _width + "px;height:" + _height + "px;' >    <a class='item_close' onclick=deletepic('" + bianhao + "')>删除</a><span style='width:" + _width + "px;height:" + _height + "px;' class='item_box'>";
                var    bb      = "<img id='img" + bianhao + "' src='/" + images[i] + "'  style='background:url(images/aa1.gif) no-repeat center;width:" + _width + "px;height:" + _height + "px;'/></span>";
                var    dds     = "</div></div>";
                html += aaa + aa + bb + dds;
            }
            txtname.Text  = article_image;
            box.InnerHtml = html;
            string author = ds.Tables[0].Rows[0]["author"].ToString();
            txtauthor.Text = author;
            string descr = ds.Tables[0].Rows[0]["descr"].ToString();
            txtdescr.Text = descr;
            string isshow = ds.Tables[0].Rows[0]["isshow"].ToString();
            ddl_show.SelectedValue = isshow;
        }
    }