예제 #1
0
        protected void datanewsquan_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo();
            int index = int.Parse(datanewsquan.DataKeys[e.Item.ItemIndex].ToString());
            //DataSet bllds = newbll.GetList("NewsTypeID="+index+"");
            int pageSize = 5; //每页大小
            int page     = 1; //当前第几页
            int recordCount;  //总共有多少条数据

            if (Request.QueryString["page"] != null)
            {
                if (Request.QueryString["page"].ToString() != "")
                {
                    page = int.Parse(Request.QueryString["page"].ToString());
                }
            }
            recordCount = newbll.GetNewCount("NewsTypeID=" + index + "");
            int pageCount = recordCount / pageSize + 1;//共有多少页

            if (recordCount % pageSize == 0)
            {
                pageCount--;
            }
            DataSet  bllds  = newbll.GeNewsList(pageSize * (page - 1), pageSize, "NewsTypeID=" + index + "");
            DataList dlNews = e.Item.FindControl("datanewsfen") as DataList;

            dlNews.DataSource = bllds;
            dlNews.DataBind();
            Maticsoft.BLL.NewsTypeInfo   typebll   = new Maticsoft.BLL.NewsTypeInfo();
            Maticsoft.Model.NewsTypeInfo typemodel = typebll.GetModel(int.Parse(this.datanewsquan.DataKeys[e.Item.ItemIndex].ToString()));
            Label lbltype = e.Item.FindControl("lbltype") as Label;

            lbltype.Text = typemodel.NewsTypeTitle;
            Label lblpage = e.Item.FindControl("lblpage") as Label;
        }
예제 #2
0
        private void bind()
        {
            Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo();
            int recordCount = 0;  //总共有多少条数据
            int pageSize    = 20; //每页大小
            int page        = 1;  //当前第几页
            int pagecount;

            if (Request.QueryString["page"] != null)
            {
                if (Request.QueryString["page"].ToString() != "")
                {
                    page = int.Parse(Request.QueryString["page"].ToString());
                }
            }
            recordCount = newbll.GetNewCount("");
            int pageCont = recordCount / pageSize + 1;

            if (recordCount % pageSize == 0)
            {
                pageCont--;
            }
            DataSet ds = newbll.GeNewsList(pageSize * (page - 1), pageSize, "");

            datamess.DataSource   = ds;
            datamess.DataKeyField = "NewsID";
            datamess.DataBind();
            if (ds.Tables[0].Rows.Count > 0)
            {
                this.lblpage.Text += "共有<b>" + recordCount + "</b>条记录&nbsp; ";
                this.lblpage.Text += "当前第<b>" + page + "</b>页&nbsp;&nbsp;";
                if (page == 1)
                {
                    this.lblpage.Text += "首页&nbsp;";
                    this.lblpage.Text += "上一页&nbsp;";
                }
                else
                {
                    this.lblpage.Text += "<a href='NewsLIst.aspx?page=" + 1 + " '>首页</a>&nbsp;";
                    this.lblpage.Text += "<a href='NewsLIst.aspx?page=" + (page - 1).ToString() + " '>上一页</a>&nbsp;";
                }
                if (page == pageCont)
                {
                    this.lblpage.Text += "下一页&nbsp;";
                    this.lblpage.Text += "尾页&nbsp;";
                }
                else
                {
                    this.lblpage.Text += "<a href='NewsLIst.aspx?page=" + (page + 1).ToString() + " '>下一页</a>&nbsp;";
                    this.lblpage.Text += "<a href='NewsLIst.aspx?page=" + pageCont.ToString() + " '>尾页</a>&nbsp;";
                }
            }
        }
예제 #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Session["usename"] != null)
                {
                    if (Session["usename"].ToString() != "")
                    {
                        //获得服务器名称
                        this.lServerName.Text = Server.MachineName;
                        //获得服务器IP地址
                        this.lServerIP.Text = Request.ServerVariables["LOCAL_ADDR"].ToString();
                        //获得服务器操作系统版本
                        this.lServerOSVersion.Text = Environment.OSVersion.ToString();
                        //获得服务器IIS版本
                        this.lServerIISVersion.Text = Request.ServerVariables["SERVER_SOFTWARE"];
                        //获得DoNET引擎版本
                        this.lServerDotNETVersion.Text = ".NET CLR" + Environment.Version.Major + "." + Environment.Version.Minor + "." + Environment.Version.Build + "." + Environment.Version.Revision;

                        Maticsoft.BLL.NewsInfo newbll = new Maticsoft.BLL.NewsInfo();
                        lblnew.Text = newbll.GetNewCount(" Fatime='" + Convert.ToDateTime(DateTime.Now.ToString()) + "'").ToString();
                        Maticsoft.BLL.NicheInfo nichebll = new Maticsoft.BLL.NicheInfo();
                        lblniche.Text = nichebll.GetnicheCount(" Fatime='" + Convert.ToDateTime(DateTime.Now.ToString()) + "'").ToString();
                        Maticsoft.BLL.Product probll = new Maticsoft.BLL.Product();
                        lblproduct.Text = probll.getproCount(" Fatime='" + Convert.ToDateTime(DateTime.Now.ToString()) + "'").ToString();
                        Maticsoft.BLL.DingProduct dingbll = new Maticsoft.BLL.DingProduct();
                        lblding.Text = dingbll.GetDingCount(" Dingtime='" + Convert.ToDateTime(DateTime.Now.ToString()) + "'").ToString();
                        Maticsoft.BLL.JobZiJianInfo jobbll = new Maticsoft.BLL.JobZiJianInfo();
                        lblzijian.Text = jobbll.GetzijianCount(" datatime='" + Convert.ToDateTime(DateTime.Now.ToString()) + "'").ToString();
                        Maticsoft.BLL.MessageInfo messbll = new Maticsoft.BLL.MessageInfo();
                        lblyijian.Text = messbll.GetmessCount(" DateTime='" + Convert.ToDateTime(DateTime.Now.ToString()) + "'").ToString();
                    }
                    else
                    {
                        Response.Redirect("login.aspx");
                        Response.End();
                    }
                }
                else
                {
                    Response.Redirect("login.aspx");
                    Response.End();
                }
            }
        }