日志管理:管理用户使用系统的记录
<input type="hidden" id="YongHu" value="6" />在相应的操作模块或使用的功能,给一个id并且赋值
$("#LogManage").click(function () {
document.getElementById('zhuye').style.display = 'none';
var CaoZuoTypeID = $("#RiZhi").val();![在这里插入图片描述](https://img-blog.csdnimg.cn/20190214144731831.PNG?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDU0ODc0MQ==,size_16,color_FFFFFF,t_70)
var Name=$("#Name").val();
var UserName=$("#UserName").val();
$.getJSON("/TMH/LogManage/InsertLog?CaoZuoTypeID=" + CaoZuoTypeID + "&Name=" + Name + "&UserName=" + UserName, function (data) {
if (data == "success") {
$("#content").attr("src", "/TMH/LogManage/LogManage");
} else {
layer.alert(msg, { icon: 0, title: '提示' });
}
})
})
try
{
SYS_LogManage log = new SYS_LogManage();
log.Name = Name;
log.UserName = UserName;
log.CaoZuoTypeID = CaoZuoTypeID;
var y = DateTime.Now;
log.CaoZuoDate = y;
MyModels.SYS_LogManage.Add(log);
if(MyModels.SaveChanges() > 0)
{
strMsg = "success";
}
else
{
strMsg = "failed";
}
}
catch (Exception)
{
strMsg = "failed";
}