protected void btnQuery_Click(object sender, EventArgs e) { Model.StationRelation msr = new Model.StationRelation(); msr.Channel_ID = Convert.ToInt32(ddlUserChannel.SelectedValue); msr.Program_ID = Convert.ToInt32(ddlUserCP.SelectedValue); msr.StationID = tbStaID.Text.Trim() == "" ? -1 : Convert.ToInt32(tbStaID.Text.Trim()); msr.StationName = tbStaName.Text.Trim() == "" ? null : tbStaName.Text.Trim(); msrs = null; if (Session["UserRole"] != null && Session["UserRole"].ToString() == "0") { // 管理员可查询所有栏目的城市列表 msrs = dbll.getStations(null, msr); } else if (Session["UserRole"] != null && Session["UserRole"].ToString() == "1") { // 制片人仅查询所属栏目的城市列表 string userID = Session["UserID"].ToString(); msrs = dbll.getStations(userID, msr); } if (msrs != null && msrs.Length > 0) { lblMessage.Text = ""; headDynRow.Visible = true; } else { lblMessage.Text = "没有查询到任何符合条件的城市!"; headDynRow.Visible = false; } gvStationInfo.DataSource = msrs; gvStationInfo.DataBind(); }