gyhlw_dotnet/网站项目/VRS/Management/ZHC/Dev.aspx.cs

86 lines
2.5 KiB
C#
Raw Permalink 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.ZHC
{
public partial class Dev : BaseListPage
{
DataService.BLL.zhc_dev bll = new DataService.BLL.zhc_dev();
DataService.BLL.admin_log log = new DataService.BLL.admin_log();
protected override void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
VerifyPermissions("10007");
DataLoad();
}
}
protected override void DataLoad()
{
StringBuilder query = new StringBuilder(" 1 = 1 ");
if (!string.IsNullOrWhiteSpace(name.Text.Trim()))
{
query.AppendFormat(" AND name LIKE '%{0}%' ", name.Text.Trim());
}
if (!string.IsNullOrWhiteSpace(info.Text.Trim()))
{
query.AppendFormat(" AND info LIKE '%{0}%' ", info.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.name + "设备ID" + IdInput.Value);
}
DataLoad();
}
}
}