コード例 #1
0
ファイル: RecordLogAttribute.cs プロジェクト: wpmyj/six
        /// <summary>
        ///  OnResultExecuted 在执行操作结果后由 ASP.NET MVC 框架调用。
        /// </summary>
        /// <param name="filterContext"></param>
        public override void OnResultExecuted(ResultExecutedContext filterContext)
        {
            //base.OnResultExecuted(filterContext);
            LogContent logmodel = new LogContent();

            logmodel.Log_ID        = Guid.NewGuid().ToString();
            logmodel.Event_Type    = 3;
            logmodel.EventCategory = "";         //登陆系统
            logmodel.Event_ID      = 1;
            logmodel.ComputerName  = _ipAddress; //Request.UserHostAddress;
            logmodel.Mac_Address   = GetMacAddress();
            logmodel.Source        = "";
            logmodel.SourceType    = "1";
            logmodel.UserName      = _userName;
            logmodel.Description   = _description;//在记录数据库操作时,可以在petapoco底层将sql语句放入其中。
            try
            {
                RecordLog.RecordDBInfo(logmodel);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }