155 lines
5.3 KiB
C#
155 lines
5.3 KiB
C#
namespace FineUIPro.Web.SysManage
|
|
{
|
|
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
|
|
public partial class UpdatePassword : PageBase
|
|
{
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
// 绑定表格
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT Persons.PersonId,Persons.Account,Persons.JobNum,Persons.Password,Persons.PersonName,Persons.RoleIds,Persons.UnitId,Persons.IsPost,CASE WHEN Persons.IsPost=1 THEN '是' ELSE '否' END AS IsPostName,Roles.RoleName,Unit.UnitName,Unit.UnitCode
|
|
From dbo.Person_Persons AS Persons
|
|
LEFT JOIN Sys_Role AS Roles ON Roles.RoleId=Persons.RoleIds
|
|
LEFT JOIN Base_Unit AS Unit ON Unit.UnitId=Persons.UnitId
|
|
WHERE Persons.Account !='hfnbd'";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (this.CurrUser.PersonId != BLL.Const.sysglyId && this.CurrUser.PersonId != BLL.Const.hfnbdId)
|
|
{
|
|
strSql += " AND PersonId = @PersonId";
|
|
listStr.Add(new SqlParameter("@PersonId", this.CurrUser.PersonId));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
|
|
{
|
|
strSql += " AND PersonName LIKE @PersonName";
|
|
listStr.Add(new SqlParameter("@PersonName", "%" + this.txtUserName.Text.Trim() + "%"));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
|
|
#region 分页
|
|
/// <summary>
|
|
/// 分页
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 分页显示条数下拉框
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 排序
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 删除数据
|
|
/// <summary>
|
|
/// 批量删除数据
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnArrowRefresh_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
{
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
BLL.Person_PersonsService.UpdatePassword(rowID, BLL.Const.Password);
|
|
}
|
|
BindGrid();
|
|
ShowNotify("密码已重置为原始密码!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请至少选中一行!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string Id = Grid1.SelectedRowID;
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("UpdatePasswordEdit.aspx?userId={0}", Id, "编辑 - ")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Grid行双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
btnEdit_Click(null, null);
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
}
|
|
} |