/// <summary> /// 新增/删除/修改 sys_Event /// </summary> /// <param name="fam">sys_EventTable实体类</param> /// <returns>返回0操正常</returns> public override int sys_EventInsertUpdate(sys_EventTable fam) { int rInt = 0; using (SqlConnection Conn = GetSqlConnection()) { SqlCommand cmd = new SqlCommand("sys_EventInsertUpdateDelete", Conn); cmd.CommandType = CommandType.StoredProcedure; //设置参数 cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录 cmd.Parameters.Add("@EventID", SqlDbType.Int).Value = fam.EventID; //事件ID号 cmd.Parameters.Add("@E_U_LoginName", SqlDbType.NVarChar).Value = fam.E_U_LoginName; //用户名 cmd.Parameters.Add("@E_UserID", SqlDbType.Int).Value = fam.E_UserID; //操作时用户ID与sys_Users中UserID cmd.Parameters.Add("@E_DateTime", SqlDbType.DateTime).Value = fam.E_DateTime; //事件发生的日期及时间 cmd.Parameters.Add("@E_ApplicationID", SqlDbType.Int).Value = fam.E_ApplicationID; //所属应用程序ID与sys_Applicatio cmd.Parameters.Add("@E_A_AppName", SqlDbType.NVarChar).Value = fam.E_A_AppName; //所属应用名称 cmd.Parameters.Add("@E_M_Name", SqlDbType.NVarChar).Value = fam.E_M_Name; //PageCode模块名称与sys_Module相同 cmd.Parameters.Add("@E_M_PageCode", SqlDbType.VarChar).Value = fam.E_M_PageCode; //发生事件时模块名称 cmd.Parameters.Add("@E_From", SqlDbType.NVarChar).Value = fam.E_From; //来源 cmd.Parameters.Add("@E_Type", SqlDbType.Int).Value = fam.E_Type; //日记类型,1:操作日记2:安全日志3 cmd.Parameters.Add("@E_IP", SqlDbType.VarChar).Value = fam.E_IP; //客户端IP地址 cmd.Parameters.Add("@E_Record", SqlDbType.NVarChar).Value = fam.E_Record; //详细描述 Conn.Open(); rInt = Convert.ToInt32(cmd.ExecuteScalar()); cmd.Dispose(); Conn.Dispose(); Conn.Close(); } return rInt; }
/// <summary> /// 写入日志到DB /// </summary> /// <param name="E_Type">日志类型:日记类型,1:操作日记2:安全日志</param> /// <param name="E_Record">日志内容</param> /// <param name="userid">关联用户id</param> public static void EventWriteDB(int E_Type, string E_Record, int userid) { sys_EventTable s_Et = new sys_EventTable(); s_Et.E_DateTime = DateTime.Now; s_Et.E_From = Common.GetScriptUrl; s_Et.E_IP = Common.GetIPAddress(); s_Et.E_Record = E_Record; s_Et.E_UserID = userid; s_Et.E_U_LoginName = UserData.Get_sys_UserTable(s_Et.E_UserID).U_LoginName; s_Et.E_Type = E_Type; s_Et.DB_Option_Action_ = "Insert"; Permission PMI = FrameWorkPermission.Get_Permission; if (PMI != null) { s_Et.E_ApplicationID = PMI.ApplicationID; s_Et.E_A_AppName = BusinessFacade.sys_ApplicationsDisp(PMI.ApplicationID).A_AppName; s_Et.E_M_PageCode = PMI.PageCode; s_Et.E_M_Name = BusinessFacade.sys_ModuleDisp(PMI.ApplicationID, PMI.PageCode).M_CName; } BusinessFacade.sys_EventInsertUpdate(s_Et); }
/// <summary> /// 将记录集转为sys_EventTable实体类 /// </summary> /// <param name="dr">记录集</param> /// <returns>sys_EventTable</returns> protected object Populatesys_Event(IDataReader dr) { sys_EventTable nc = new sys_EventTable(); if (!Convert.IsDBNull(dr["EventID"])) nc.EventID = Convert.ToInt32(dr["EventID"]); // 事件ID号 if (!Convert.IsDBNull(dr["E_U_LoginName"])) nc.E_U_LoginName = Convert.ToString(dr["E_U_LoginName"]).Trim(); // 用户名 if (!Convert.IsDBNull(dr["E_UserID"])) nc.E_UserID = Convert.ToInt32(dr["E_UserID"]); // 操作时用户ID与sys_Users中UserID if (!Convert.IsDBNull(dr["E_DateTime"])) nc.E_DateTime = Convert.ToDateTime(dr["E_DateTime"]); // 事件发生的日期及时间 if (!Convert.IsDBNull(dr["E_ApplicationID"])) nc.E_ApplicationID = Convert.ToInt32(dr["E_ApplicationID"]); // 所属应用程序ID与sys_Applicatio if (!Convert.IsDBNull(dr["E_A_AppName"])) nc.E_A_AppName = Convert.ToString(dr["E_A_AppName"]).Trim(); // 所属应用名称 if (!Convert.IsDBNull(dr["E_M_Name"])) nc.E_M_Name = Convert.ToString(dr["E_M_Name"]).Trim(); // PageCode模块名称与sys_Module相同 if (!Convert.IsDBNull(dr["E_M_PageCode"])) nc.E_M_PageCode = Convert.ToString(dr["E_M_PageCode"]).Trim(); // 发生事件时模块名称 if (!Convert.IsDBNull(dr["E_From"])) nc.E_From = Convert.ToString(dr["E_From"]).Trim(); // 来源 if (!Convert.IsDBNull(dr["E_Type"])) nc.E_Type = Convert.ToInt32(dr["E_Type"]); // 日记类型,1:操作日记2:安全日志3 if (!Convert.IsDBNull(dr["E_IP"])) nc.E_IP = Convert.ToString(dr["E_IP"]).Trim(); // 客户端IP地址 if (!Convert.IsDBNull(dr["E_Record"])) nc.E_Record = Convert.ToString(dr["E_Record"]).Trim(); // 详细描述 return nc; }
/// <summary> /// 新增/删除/修改 sys_Event /// </summary> /// <param name="fam">sys_EventTable实体类</param> /// <returns>返回0操正常</returns> public abstract int sys_EventInsertUpdate(sys_EventTable fam);
/// <summary> /// 新增/删除/修改 sys_Event /// </summary> /// <param name="fam">sys_EventTable实体类</param> /// <returns>返回0操正常</returns> public static int sys_EventInsertUpdate(sys_EventTable fam) { return DataProvider.Instance().sys_EventInsertUpdate(fam); }
/// <summary> /// 根据ID返回 sys_EventTable实体类 单笔资料 /// </summary> /// <param name="EventID">事件ID号</param> /// <returns>返回sys_EventTable实体类 EventID为0则无记录</returns> public static sys_EventTable sys_EventDisp(int EventID) { sys_EventTable fam = new sys_EventTable(); QueryParam qp = new QueryParam(); qp.PageIndex = 1; qp.PageSize = 1; qp.Where = " Where sys_Event.EventID = " + EventID; int RecordCount = 0; ArrayList lst = sys_EventList(qp, out RecordCount); if (RecordCount > 0) { fam = (sys_EventTable)lst[0]; } return fam; }