public void ShowData(string CreateBy, string LogType) { WebProject.BLL.SysManage.ZT_SYS_LogInfo bll_LogInfo = new WebProject.BLL.SysManage.ZT_SYS_LogInfo(); DataSet ds = null; if (CreateBy == "ALL" && LogType == "ALL") { ds = bll_LogInfo.GetList(" 1=1 "); } else if (CreateBy == "ALL" && LogType != "ALL") { ds = bll_LogInfo.GetList("LogType='" + LogType + "'"); } else if (CreateBy != "ALL" && LogType == "ALL") { ds = bll_LogInfo.GetList("CreateBy='" + CreateBy + "'"); } else if (CreateBy != "ALL" && LogType != "ALL") { ds = bll_LogInfo.GetList("CreateBy='" + CreateBy + "' and LogType='" + LogType + "'"); } if (ds.Tables[0].Rows.Count > 0) { this.lblMessage.Visible = false; this.btnDeleteSelect.Visible = true; this.GridView1.Visible = true; this.GridView1.DataSource = ds; this.GridView1.DataBind(); } else { this.lblMessage.Visible = true; this.btnDeleteSelect.Visible = false; this.GridView1.Visible = false; } }
protected void btnDeleteSelect_Click(object sender, EventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LogDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { foreach (GridViewRow gr in this.GridView1.Rows) { CheckBox cb = (CheckBox)gr.Cells[1].FindControl("Select"); if (cb.Checked) { //删除数据库信息 Label ll = (Label)gr.Cells[1].FindControl("lblLogID"); int LogID = Convert.ToInt32(ll.Text); WebProject.BLL.SysManage.ZT_SYS_LogInfo bll_LogInfo = new WebProject.BLL.SysManage.ZT_SYS_LogInfo(); bll_LogInfo.Delete(LogID); } ShowData(this.txtCreateBy.SelectedValue.ToString(), this.txtLogType.SelectedValue.ToString()); } } } }
public static void WriteLog(string LoginIP, string LogType, string FuncName, string OperatorType, string OperatorInfo) { WebProject.Model.SysManage.ZT_SYS_LogInfo model_LogInfo = new WebProject.Model.SysManage.ZT_SYS_LogInfo(); model_LogInfo.LogType = LogType; model_LogInfo.OperatorType = OperatorType; model_LogInfo.FuncName = FuncName; model_LogInfo.OperatorInfo = OperatorInfo; model_LogInfo.LoginIP = LoginIP; try { string CreateBy = SessionUtil.GetAdminSession().AdminNo; model_LogInfo.CreateBy = CreateBy; } catch { } model_LogInfo.CreateDate = DateTime.Now; WebProject.BLL.SysManage.ZT_SYS_LogInfo bll_LogInfo = new WebProject.BLL.SysManage.ZT_SYS_LogInfo(); bll_LogInfo.Add(model_LogInfo); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { if (Session["ZT_ADMIN"] == null) { Response.Redirect("Login.aspx"); } else { if (!Communal.CheckQx("LogDelete.aspx")) { Response.Redirect("RightsWarn.aspx"); } else { //删除数据库的信息 Label ll = (Label)this.GridView1.Rows[e.RowIndex].Cells[1].FindControl("lblLogID"); int LogID = Convert.ToInt32(ll.Text); WebProject.BLL.SysManage.ZT_SYS_LogInfo bll_LogInfo = new WebProject.BLL.SysManage.ZT_SYS_LogInfo(); bll_LogInfo.Delete(LogID); //重新加载信息 ShowData(this.txtCreateBy.SelectedValue.ToString(), this.txtLogType.SelectedValue.ToString()); } } }