gyhlw_dotnet/网站项目/VRS/Management/AdminRole.aspx.cs

85 lines
2.5 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
namespace VRS.Management
{
public partial class AdminRole : BaseListPage
{
DataService.BLL.admin_config bll_config = new DataService.BLL.admin_config();
DataService.BLL.admin_role bll = new DataService.BLL.admin_role();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
protected override void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataLoad();
}
}
protected override void DataLoad()
{
//var config = bll_config.GetModelList(" is_use =1 ").FirstOrDefault();
//var app_key = config.app_key;
StringBuilder query = new StringBuilder(" 1 = 1 ");
if (!string.IsNullOrWhiteSpace(role_name.Text.Trim()))
{
query.AppendFormat(" AND role_name LIKE '%{0}%' ", role_name.Text.Trim());
}
var data = bll.GetList(query.ToString());
dataList.DataSource = data;
dataList.Rebind();
}
protected override void GridList_PageIndexChanged(object sender, GridPageChangedEventArgs e)
{
DataLoad();
}
protected override void GridList_PageSizeChanged(object sender, GridPageSizeChangedEventArgs e)
{
DataLoad();
}
protected override void GridList_SortCommand(object sender, GridSortCommandEventArgs e)
{
DataLoad();
}
protected override void GrdList_DeleteCommand(object sender, GridCommandEventArgs e)
{
string Id = (e.Item as GridDataItem).OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Id"].ToString();
bll.Delete(Id);
DataLoad();
}
protected override void AjaxManager_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
}
protected void btnSelect_Click(object sender, EventArgs e)
{
DataLoad();
}
protected void btnDelete_Click(object sender, EventArgs e)
{
var model = bll.GetModel(IdInput.Value);
if (bll.Delete(IdInput.Value))
{
log.write_log("删除角色成功。" + "角色名称:" + model.role_name + "角色id" + IdInput.Value);
}
DataLoad();
}
}
}