private EntityList <XUser> buildGridData() { EntityList <XUser> list = XUser.FindAll(this.ViewState["condition"] + "", null, null, (this.DataGrid1.CurrentPageIndex) * this.DataGrid1.PageSize, this.DataGrid1.PageSize); if (list.Count == 1 && Request["username"] != null && Request["username"] != "") { base.Response.Redirect("edituser.aspx?uid=" + list[0].ID); } return(list); }
private void Search_Click(object sender, EventArgs e) { if (base.CheckCookie()) { //string usersSearchCondition = Users.GetUsersSearchCondition(this.islike.Checked, this.ispostdatetime.Checked, this.Username.Text, this.nickname.Text, this.UserGroup.SelectedValue, this.email.Text, this.credits_start.Text, this.credits_end.Text, this.lastip.Text, this.posts.Text, this.digestposts.Text, this.uid.Text, this.joindateStart.SelectedDate.ToString(), this.joindateEnd.SelectedDate.AddDays(1.0).ToString()); string where = XUser.SearchWhere(this.islike.Checked, this.ispostdatetime.Checked, this.Username.Text, this.nickname.Text, Utility.ToInt(this.UserGroup.SelectedValue, 0), this.email.Text, Utility.ToInt(this.credits_start.Text, 0), Utility.ToInt(this.credits_end.Text, 0), this.lastip.Text, Utility.ToInt(this.posts.Text, 0), Utility.ToInt(this.digestposts.Text, 0), this.uid.Text, this.joindateStart.SelectedDate, this.joindateEnd.SelectedDate); this.ViewState["condition"] = where; this.searchtable.Visible = false; this.ResetSearchTable.Visible = true; //DataTable usersByCondition = Users.GetUsersByCondition(usersSearchCondition); DataTable dt = XUser.FindAll(where, null, null, 0, 1).ToDataTable(false); if (dt.Rows.Count == 1) { base.Response.Redirect("edituser.aspx?uid=" + dt.Rows[0][0].ToString() + "&condition=" + where.Replace("'", "~^").Replace("%", "~$")); return; } this.DataGrid1.CurrentPageIndex = 0; this.BindData(); } }