- using System;
- using System.Data;
- using System.Configuration;
- using System.Collections;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Web.UI.HtmlControls;
- using System.Collections.Generic;
- public partial class PostUrl : System.Web.UI.Page
- {
- /// <summary>
- /// 模板
- /// </summary>
- Model.Post_Tel MR = new Model.Post_Tel();
- /// <summary>
- /// 业务
- /// </summary>
- BLL.Post_Tel BR = new BLL.Post_Tel();
- /// <summary>
- /// 查询条件
- /// </summary>
- public string TiaoJian
- {
- get
- {
- if (ViewState["ProvinceTiaoJian"] == null)
- {
- return "";
- }
- else
- {
- return ViewState["ProvinceTiaoJian"].ToString();
- }
- }
- set { ViewState["ProvinceTiaoJian"] = value; }
- }
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- TiaoJian = "";
- if (Request.QueryString["p"] != null)
- {
- TiaoJian = "Province='" + GetAddr(Request.QueryString["p"].ToString()) + "'";
- if(Request.QueryString["num"]!=null)
- {
- TiaoJian = "PostNo='" +Request.QueryString["p"].ToString() + "'";
- }
- }
- MyDataBind(1);
- }
- }
- /// <summary>
- /// 获取信息
- /// </summary>
- /// <param name="pidx">页号</param>
- public void MyDataBind(int pidx)
- {
- AspNetPager1.RecordCount = BR.GetCount(TiaoJian);
- List<Model.Post_Tel> LRData = BR.GetPageList(20, pidx, "PostNo", true, TiaoJian);
- if (LRData.Count == 0)
- {
- Model.Post_Tel MR = new Model.Post_Tel();
- LRData.Add(MR);
- }
- GridView1.DataSource = LRData;
- GridView1.DataBind();
- }
- protected void AspNetPager1_PageChanging(object src, Wuqi.Webdiyer.PageChangingEventArgs e)
- {
- MyDataBind(e.NewPageIndex);
- }
- protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
- {
- for (int i = 0; i < GridView1.Rows.Count; i++)
- {
- //首先判断是否是数据行
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- //当鼠标停留时更改背景色
- e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#F0F0F0'");
- //当鼠标移开时还原背景色
- e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c");
- }
- }
- }
- public string GetAddr(string PinYin)
- {
- string RtStr="北京";
- switch(PinYin)
- {
- case "beijing": return "北京";
- case "tianjin": return "天津";
- case "xinjiang": return "新疆";
- case "xizang": return "西藏";
- case "qinghai": return "青海";
- case "gansu": return "甘肃";
- case "neimenggu": return "内蒙古";
- case "ningxia": return "宁夏";
- case "shanxi": return "山西";
- case "liaoning": return "辽宁";
- case "jilin": return "吉林";
- case "heilongjiang": return "黑龙江";
- case "hebei": return "河北";
- case "shandong": return "山东";
- case "henan": return "河南";
- case "shannxi": return "陕西";
- case "sichuan": return "四川";
- case "chongqing": return "重庆" ;
- case "hubei": return "湖北";
- case "anhui": return "安徽";
- case "jiangsu": return "江苏";
- case "shanghai": return "上海";
- case "zhejiang": return "浙江";
- case "fujian": return "福建" ;
- case "taiwan": return "台湾" ;
- case "jiangxi": return "江西" ;
- case "hunan": return "湖南" ;
- case "guizhou": return "贵州" ;
- case "guangxi": return "广西" ;
- case "guangdong": return "广东" ;
- case "xianggang": return "香港" ;
- case "hainan": return "海南";
- case "yunnan": return "云南";
- }
- return RtStr;
- }
- }