Web/manage/Hotel/HotelList.aspx.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Common;
using System.Data.SqlClient;
using System.Data;

namespace HotelShop.manage.Hotel
{
    public partial class HotelList : System.Web.UI.Page
    {
        public int count = 0, pageindex = 1, pagesize = 10;        //总页数,当前页
        public string wd = "", webUrl = "", strWhere = "", ddl_status = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {

                if (HttpContext.Current.Request.QueryString["pageindex"] != null && HttpContext.Current.Request.QueryString["pageindex"].Trim() != "")
                {

                    pageindex = Convert.ToInt32(HttpContext.Current.Request.QueryString["pageindex"]);     //当前页
                }
                if (HttpContext.Current.Request.QueryString["wd"] != null && HttpContext.Current.Request.QueryString["wd"].Trim() != "")
                {
                    wd = HttpContext.Current.Request.QueryString["wd"];
                    webUrl += "&wd=" + wd;
                }
                if (HttpContext.Current.Request.QueryString["ddl_status"] != null && HttpContext.Current.Request.QueryString["ddl_status"].Trim() != "")
                {
                    ddl_status = HttpContext.Current.Request.QueryString["ddl_status"];     //当前页
                    webUrl += "&ddl_status=" + ddl_status;
                }
                MyDataBind();
            }
        }
        public void MyDataBind()
        {
            string sort = " HotelID desc";
            strWhere = " m.Status<>0 ";
            if (ddl_status != "")
                strWhere += " and m.Status=" + this.ddl_status;
            if (this.wd != "")
            {
                strWhere += "  and (m.HotelName like '%" + this.wd + "%' or m.Contact like '%" + this.wd + "%')";
            }
            string sql = @"select m.HotelID,m.HotelName,m.ImgPath,m.AddDate,m.Address,m.Contact,m.Phone,m.Status,case when m.Status=1 then '可用' else '禁用' end StatusName from T_Hotel m   ";
            sql += " where " + strWhere;
            sql = DataTableHelper.GetPageSql(sql, pageindex, pagesize, sort);
            DataSet ds = DbHelperSQL.Query(sql);
            if (ds.Tables[0].Rows.Count > 0)
                this.count = Convert.ToInt32(ds.Tables[0].Rows[0]["num"]);
            this.rep_data.DataSource = ds;
            this.rep_data.DataBind();
        }
        public string Pager()
        {
后面还有 9 行代码,购买后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。