代码拉取完成,页面将自动刷新
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 Wuqi.Webdiyer;
using System.Data.SqlClient;
using dal.tooldal;
public partial class sysnumbersearch : WebPage
{
public string _username = "";
public string _truename = "";
public string _mobile = "";
public string _date;
protected void Page_Load(object sender, EventArgs e)
{
this.VerifyPage();
try
{
_username = Request.QueryString.Get("u");
_truename = Request.QueryString["t"];
_date = Request.QueryString["d"];
_mobile = Request.QueryString["m"];
}
catch { }
this.sUserName.Value = _username;
this.sTrueName.Value = _truename;
this.sMobile.Value = _mobile;
this.sDate.Value = _date.ToString();
if (CheckCurUser())
{
if (!Page.IsPostBack)
{
DataBindlist();
}
}
else
{
this.message.Visible = true;
}
}
public bool CheckCurUser()
{
bool ret = false;
if (CurrentUser.UserPID == -1)
ret = true;
else
ret = false;
return ret;
}
protected void DataBindlist()
{
string mysql = "";
string mysql0 = "";
if (_username != "")
{
mysql += " and UserName like '%"+_username+"%'";
mysql0 += " and a.UserName like '%" + _username + "%'";
}
if (_truename != "")
{
mysql += " and TrueName like '%" + _truename + "%'";
mysql0 += " and a.TrueName like '%" + _truename + "%'";
}
if (_mobile != "")
{
mysql += " and Mobile like '%" + _mobile + "%'";
mysql0 += " and a.Mobile like '%" + _mobile + "%'";
}
if (_date!= "")
{
mysql += " and CONVERT(VARCHAR, [AddTime], 121) like '%" + _date + "%'";
mysql0 += " and CONVERT(VARCHAR, [a.AddTime], 121) like '%" + _date + "%'";
}
string sqlCount = string.Format("Select Count(1) From [Table_MyUsers] where 1=1" + mysql);
int recordcount = GetData.GetScalar(sqlCount);
if (recordcount == 0)
{
this.message.Visible = true;
}
pagelist.AlwaysShow = true;
pagelist.RecordCount = recordcount; //读出数据库里一共有多少条数据
string sql = "select a.*,b.UserTel from [Table_MyUsers] as a LEFT JOIN [Table_UserTel] as b on a.UserID=b.UserID where 1=1" + mysql0 + " order by a.UserID desc";
SqlDataAdapter ad = new SqlDataAdapter(sql, GetData.strConn);
DataSet ds = new DataSet();
ad.Fill(ds, pagelist.PageSize * (pagelist.CurrentPageIndex - 1), pagelist.PageSize, "temp");
rep_parent.DataSource = ds.Tables["temp"];
rep_parent.DataBind();
}
protected void PageChanging(object src, PageChangingEventArgs e)
{
pagelist.CurrentPageIndex = e.NewPageIndex;
DataBindlist();
}
protected void rep_parent_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
LinkButton lbtn = (LinkButton)e.Item.FindControl("DelBtn");
lbtn.Attributes.Add("onclick", "return confirm('确定要清空吗?');");
}
protected void rep_parent_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Deleted")
{
string s = e.CommandArgument.ToString();
UserTel ut = new UserTel();
ut.userid = int.Parse(s);
ut.usertel = "";
ut.Update(ut);
DataBindlist();
}
}
#region 返回用户检索条件语句
public string SearchSqlWord(string _UserName,string _TrueName,string _Mobile,string _Date)
{
string Ret = "";
if (_UserName != "")
{
Ret += " and UserName like '%" + _UserName + "%'";
}
if (_TrueName != "")
{
Ret += " and TrueName like '%" + _TrueName + "%'";
}
if (_Mobile != "")
{
Ret += " and Mobile like '%" + _Mobile + "%'";
}
if (_Date != "")
{
Ret += " and AddTime = '%" + _Date + "%'";
}
return Ret;
}
#endregion
protected void AllBtn_Click(object sender, EventArgs e)
{
Response.Redirect("sysnumber.aspx");
}
public int CountTel(string s)
{
int ret = 0;
if (s == "")
{
ret = 0;
}
else
{
WebKey wk = new WebKey();
char dot = Convert.ToChar(wk.Dot());
ret = s.Split(dot).Length;
}
return ret;
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。