📄 loginlog.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections.Generic;
using MyOffice.BLL;
using MyOffice.Models;
public partial class Sysmagae_LoginLog : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack) {
btnDelete.Visible = false;
btnSelectAll.Visible = false;
lblSelectAll.Visible = false;
DateTime begin = DateTime.Parse(txtBeginTime.Text + " 00:00:00");
DateTime end = DateTime.Parse(txtEndTime.Text + " 23:59:59");
ViewState["Begin"] = begin;
ViewState["End"] = end;
/* string a = txtBeginTime.Text;
DateTime begin = DateTime.Parse(txtBeginTime.Text + " 00:00:00");
DateTime end = DateTime.Parse(txtEndTime.Text+" 23:59:59");
ViewState["Begin"] = begin;
ViewState["End"] = end;
gvLoginLog.DataSource = companyBLL.SelectTimeLogin(begin,end);
gvLoginLog.DataBind();*/
}
}
protected void imgbtnSearch_Click(object sender, ImageClickEventArgs e)
{
if (txtBeginTime.Text != "" && txtEndTime.Text != "")
{
btnDelete.Visible = true;
btnSelectAll.Visible = true;
lblSelectAll.Visible = true;
if (DateTime.Parse(txtEndTime.Text) <= DateTime.Parse(txtEndTime.Text))
{
DateTime begin = DateTime.Parse(txtBeginTime.Text + " 00:00:00");
DateTime end = DateTime.Parse(txtEndTime.Text + " 23:59:59");
ViewState["Begin"] = begin;
ViewState["End"] = end;
gvLoginLog.DataSource = companyBLL.SelectTimeLogin(begin, end);
gvLoginLog.DataBind();
}
else {
Response.Write("<script>alert('请选择正确的时间!!!');</script>");
}
}
else {
Response.Write("<script>alert('时间必选!!!');</script>");
}
}
protected void gvLoginLog_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow) {
int id = int.Parse(gvLoginLog.DataKeys[e.Row.RowIndex].Value.ToString());
LoginLogModel lilom = companyBLL.SelectLogin(id);
Label lab = (Label)e.Row.FindControl("lbIf");
if (lilom.IfSuccess == 1)
{
lab.Text = "是";
}
else {
lab.Text = "否";
}
}
}
protected void btnDelete_ServerClick(object sender, EventArgs e)
{
string id = "";
for (int number = 0; number < gvLoginLog.Rows.Count; number++) {
CheckBox cb = (CheckBox)gvLoginLog.Rows[number].FindControl("chkLoginLog");
if (cb.Checked) {
Label la = (Label)gvLoginLog.Rows[number].FindControl("lbId");
id += la.Text + ",";
}
}
if (id.Length > 0)
{
id = id.Substring(0, id.Length - 1);
int numb = companyBLL.DeleMonLoginLo(id);
if (numb == 0)
{
Response.Write("<script>alert('删除失败!!!');</script>");
}
else {
OperateLogModel oplomo = new OperateLogModel();
string useridss = (string)Session["UserId"];
oplomo.UserId = useridss;
oplomo.OperateTime = DateTime.Now;
oplomo.ObjectId = "105002";
oplomo.OperateName = "删除";
oplomo.OperateDesc = "删除登陆日志";
int inoper = SysManageBLL.InsertOperate(oplomo);
DateTime begin = (DateTime)ViewState["Begin"];
DateTime end = (DateTime)ViewState["End"];
gvLoginLog.DataSource = companyBLL.SelectTimeLogin(begin, end);
gvLoginLog.DataBind();
}
}
else {
Response.Write("<script>alert('请选择删除对象!!!');</script>");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -