CeramicProject/newyt/Module_data/Securitylog.aspx.cs

92 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using Ajax;
public partial class Securitylog : CommonPage
{
//创建一个共用的角色bll
Maticsoft.BLL.nr_z_yhjs juesebll = new Maticsoft.BLL.nr_z_yhjs();
//创建一个操作记录模板
Maticsoft.Model.nr_sys_rizhi rizhi = new Maticsoft.Model.nr_sys_rizhi();
//创建一个操作记录bll
Maticsoft.BLL.nr_sys_rizhi rizhibll = new Maticsoft.BLL.nr_sys_rizhi();
Maticsoft.Model.nr_z_yhjs jsmd = new Maticsoft.Model.nr_z_yhjs();
protected void Page_Load(object sender, EventArgs e)
{
Utility.RegisterTypeForAjax(typeof(Securitylog));
if (!IsPostBack)
{
if (Session["user"] == null)
{
Response.Redirect("../index.aspx");
}
//获取角色权限
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
getbd();
pdquanxian(user.juese);
}
}
private void getbd()
{
DataSet zhds = DBHlper.Execute("select zhanghao from nr_z_yhzh where yangshi=1");
if (zhds != null)
{
cxzh.DataSource = zhds.Tables[0].DefaultView;
cxzh.DataValueField = "zhanghao";
cxzh.DataTextField = "zhanghao";
cxzh.DataBind();
}
DataSet rzds=DBHlper.Execute("select distinct leixing from nr_sys_rizhi");
if (rzds != null)
{
cxmk.DataSource = rzds.Tables[0].DefaultView;
cxmk.DataValueField = "leixing";
cxmk.DataTextField = "leixing";
cxmk.DataBind();
cxmk.Items.Insert(0, new ListItem("全部", ""));
}
ksrq.Value = DateTime.Now.ToString("yyyy-MM-dd");
jsrq.Value = DateTime.Now.ToString("yyyy-MM-dd");
}
#region
void pdquanxian(int juese)
{
Maticsoft.Model.nr_z_yhzh user = (Maticsoft.Model.nr_z_yhzh)(Session["user"]);
if (DBHlper.getzt(user.id) != 1)
{
Response.Redirect("../index.aspx");
}
if (DBHlper.GetPermission(juese, "系统日志", "nr_sys_rizhi", "查看全部") == false)
{
Response.Redirect("../Common/nopower.htm");
}
}
#endregion
protected void cxrz_Click(object sender, EventArgs e)
{
string rzjgst = "<table class='bule' style='margin-top:0px'> ";
DataSet rizhids = DBHlper.Execute("select * from nr_sys_rizhi where yonghuming='" + cxzh.Text + "'and leixing like'%" + cxmk.Text + "%' and riqi>='" + ksrq.Value + "' and riqi<='" + Convert.ToDateTime(jsrq.Value).AddDays(1) + "' order by id desc");
if (rizhids != null && rizhids.Tables[0].Rows.Count > 0)
{
foreach (DataRow r in rizhids.Tables[0].Rows)
{
rzjgst += "<tr><td style='width:150px'><span>" + r["yonghuming"] + "</span></td><td style='width:150px'><span>" + r["leixing"] + "</span></td><td style='width:150px'><span>" + r["riqi"] + "</span></td><td><span>" + r["jilu"] + "</span></td></tr>";
}
}
else
{
rzjgst += "<tr><td colspan='4'><span>没有找到相关的操作日志</span></td></tr>";
}
rzjgst+= "</table>";
div_main.InnerHtml = rzjgst;
}
}