using FineUIPro; using FineUIPro.iWareWms; using iWareCommon.Common.Entity; using iWareCommon.Common.EnumType; using iWareDataCore.RBAC.Service; using iWareExcel.EXCEL.Service; using iWareWms.Code.Excel.Service; using System; using System.Collections.Generic; namespace iWareWms.View.RBAC.User { /// /// 许艺潇 /// 2018.06 /// 用户管理操作页面 /// public partial class User : PageBase { protected override Grid GetGrid() { return UserGrid; } protected override DropDownList GetPageSizeDropDownList() { return ddlPageSize; } protected override List GetDataSource(int pageIndex, int pageSize, out string msg, out int totalNum, out int currentPage) { var users = UserService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "Name", tbName.Text.Trim() }, { "Position", tbPosition.Text.Trim() } }, Filter = new Dictionary { { "Status", ddlStatus.SelectedValue }, { "label", 0 } }, PageIndex = pageIndex, PageSize = pageSize }, out msg, out totalNum, out currentPage); var res = new List(); users.ForEach(x =>{ if(x.Id!=1) { res.Add(x); } }); totalNum = (totalNum - 1); return res; } protected override void Delete(int id, out string msg) { UserService.GetInstance().Delete(id,out msg); WriteLog("用户删除" + msg, "用户管理"); } protected override void Delete(List ids, out string msg) { UserService.GetInstance().Delete(ids, out msg); WriteLog("用户删除" + msg, "用户管理"); } protected override void ChangeStatus(List ids, int enable, out string msg) { UserService.GetInstance().ChangeStatus(ids, enable, out msg); } protected override void GridRowCommand(object sender, GridCommandEventArgs e) { base.GridRowCommand(sender, e); if (e.CommandName == "Reset") { string msg; UserService.GetInstance().ResetPassword(int.Parse(GetGrid().DataKeys[e.RowIndex][0].ToString()), out msg); if (string.IsNullOrEmpty(msg)) { msg="重置密码成功"; } Alert.ShowInTop(msg); WriteLog("用户重置密码" + msg, "用户管理"); } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //判断删除复选框是否选择了至少一项纪录 ResolveDeleteButtonForGrid(Button3, UserGrid); //判断启用状态复选框是否选择了至少一项纪录 ResolveEnableStatusButtonForGrid(MenuButton1, UserGrid, true); //判断禁用状态复选框是否选择了至少一项纪录 ResolveEnableStatusButtonForGrid(MenuButton2, UserGrid, false); //查询框中的用户状态 ddlStatus.Items.Add("全部", ""); foreach (var status in Enum.GetValues(typeof( EStatus))) { ddlStatus.Items.Add(status.ToString(), ((int)status).ToString()); } Button1.OnClientClick = Window1.GetShowReference("~/View/RBAC/User/UserDetail.aspx", "新增用户"); Query(1); } } protected override Window GetWindow() { return Window2; } protected override void GetPath(object userName) { string msg; var users = UserService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary { { "Name", tbName.Text.Trim() }, { "Position", tbPosition.Text.Trim() } }, Filter = new Dictionary { { "Status", ddlStatus.SelectedValue } }, }, out msg); var datas = new List(); users.ForEach(x => datas.Add(x)); var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary { { "Name", "用户" } } }, out msg); var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary> { { "用户", datas } }, out msg); Session["ExcelPath"] = path; } protected override FineUIPro.Timer GetTimer() { return timer1; } } }