protected void Repeater1_OnItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandName == "Edit") { string LogsID = ((HiddenField)e.Item.FindControl("HiddenField1")).Value; Response.Redirect("LogDetail.aspx?LogsID=" + LogsID + "&AccountNum=" + AccountNum + "&UserID=" + UserID); } else if (e.CommandName == "Check") { string LogsID = ((HiddenField)e.Item.FindControl("HiddenField1")).Value; Response.Redirect("LogShow.aspx?LogsID=" + LogsID + "&AccountNum=" + AccountNum + "&UserID=" + UserID); } else if (e.CommandName == "Delete") { string LogsID = ((HiddenField)e.Item.FindControl("HiddenField1")).Value; Info_Logs_BLL infoLogsBll = new Info_Logs_BLL(); Info_Logs_Model infoLogsModel = infoLogsBll.GetModel(new Guid(LogsID)); infoLogsModel.isDelete = true; infoLogsModel.UpdateUser = new Guid(UserID); infoLogsModel.UpdateTime = DateTime.Now; infoLogsBll.Update(infoLogsModel); GetLogsList(); // infoLogsBll.Update("") } if (e.CommandName == "ADD") { Response.Redirect("LogDetail.aspx?UserID=" + UserID + "&AccountNum=" + AccountNum); } }
protected void Button1_Click(object sender, EventArgs e) { string LogsTitle = TextBox1.Text; string LogsContent = TextArea1.Value; Info_Logs_BLL infoLogsBll = new Info_Logs_BLL(); if (LogsID != null) { Info_Logs_Model infoLogsModel = infoLogsBll.GetModel(new Guid(LogsID)); // 更新 infoLogsModel.LogsTitle = LogsTitle; infoLogsModel.LogsContent = LogsContent; infoLogsModel.isDelete = false; infoLogsModel.UpdateTime = DateTime.Now; infoLogsModel.UpdateUser = infoLogsModel.CreateUser; // 添加日志 Sys_ProcessLog_Model sysProcessLogModel = new Sys_ProcessLog_Model(); sysProcessLogModel.ID = Guid.NewGuid(); sysProcessLogModel.LogType = (int)SystemLogType.LogsAdd; sysProcessLogModel.LogDescription = "更新了一条日志"; sysProcessLogModel.CreateUser = new Guid(UserID); sysProcessLogModel.CreateTime = DateTime.Now; bool result = infoLogsBll.Update(infoLogsModel, sysProcessLogModel); if (result) { Response.Write("更新成功"); Response.Redirect("LogList.aspx?LogsID=" + LogsID + "&AccountNum=" + AccountNum + "&UserID=" + UserID); } } // 为空.添加 if (UserID != null) { // 两种写法 Info_Logs_Model infoLogsModel = new Info_Logs_Model() { LogsTitle = LogsTitle, LogsContent = LogsContent, isDelete = false, CreateTime = DateTime.Now, CreateUser = new Guid(UserID) }; // 添加日志 Sys_ProcessLog_Model sysProcessLogModel = new Sys_ProcessLog_Model(); sysProcessLogModel.ID = Guid.NewGuid(); sysProcessLogModel.LogType = (int)SystemLogType.LogsAdd; sysProcessLogModel.LogDescription = "添加了一条日志"; sysProcessLogModel.CreateUser = new Guid(UserID); sysProcessLogModel.CreateTime = DateTime.Now; bool result = infoLogsBll.Add(infoLogsModel, sysProcessLogModel); if (result) { Response.Write("添加成功"); Response.Redirect("LogList.aspx?LogsID=" + LogsID + "&AccountNum=" + AccountNum + "&UserID=" + UserID); } } }