using System;
|
using System.Collections.Generic;
|
using FineUIPro;
|
using FineUIPro.iWareWms;
|
using iWareCommon.Common.Entity;
|
using iWareWms.Code.Excel.Service;
|
using iWareExcel.EXCEL.Service;
|
using iWareDataCore.RBAC.Service;
|
|
|
namespace iWareWms.View.RBAC.Role
|
{
|
/// <summary>
|
/// 许艺潇
|
/// 2018.06
|
/// 角色管理操作页面
|
/// </summary>
|
public partial class Role : PageBase
|
{
|
|
protected override Grid GetGrid()
|
{
|
return RoleGrid;
|
}
|
|
protected override DropDownList GetPageSizeDropDownList()
|
{
|
return ddlPageSize;
|
}
|
|
protected override List<object> GetDataSource(int pageIndex, int pageSize, out string msg, out int totalNum, out int currentPage)
|
{
|
var roles = RoleService.GetInstance().QueryByParam(new QueryParam
|
{
|
Search = new Dictionary<string, object> { { "RoleName", tbRoleName.Text.Trim() } },
|
PageIndex = pageIndex,
|
PageSize = pageSize
|
}, out msg, out totalNum, out currentPage);
|
|
var res = new List<object>();
|
roles.ForEach(x =>
|
{
|
if (x.Id != 1)
|
{
|
res.Add(x);
|
}
|
});
|
totalNum = (totalNum - 1);
|
|
return res;
|
}
|
|
protected override void Delete(int id, out string msg)
|
{
|
RoleService.GetInstance().Delete(id, out msg);
|
WriteLog("角色删除" + msg, "角色管理");
|
}
|
|
protected override void Delete(List<int> ids, out string msg)
|
{
|
RoleService.GetInstance().Delete(ids, out msg);
|
WriteLog("角色删除" + msg, "角色管理");
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
if (!IsPostBack)
|
{
|
//判断删除复选框是否选择了至少一项纪录
|
ResolveDeleteButtonForGrid(Button3, RoleGrid);
|
Button1.OnClientClick = Window1.GetShowReference("~/View/RBAC/Role/RoleDetail.aspx", "新增角色");
|
Query(1);
|
}
|
}
|
|
/// <summary>
|
/// 获取导出Excel需要的窗口
|
/// </summary>
|
/// <returns></returns>
|
protected override Window GetWindow()
|
{
|
return Window2;
|
}
|
|
|
protected override void GetPath(object userName)
|
{
|
string msg;
|
var roles = RoleService.GetInstance().QueryByParam(new QueryParam { Search = new Dictionary<string, object> { { "RoleName", tbRoleName.Text.Trim() } } }, out msg);
|
var datas = new List<object>();
|
roles.ForEach(x => datas.Add(x));
|
var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam { Filter = new Dictionary<string, object> { { "Name", "角色" } } }, out msg);
|
var path = ExcelService.GetInstance().ToExcelByEPPlus(workBooks[0], new Dictionary<string, List<object>> { { "角色", datas } }, out msg);
|
Session["ExcelPath"] = path;
|
}
|
|
protected override FineUIPro.Timer GetTimer()
|
{
|
return timer1;
|
}
|
|
}
|
}
|