Example #1
0
        public AopResult Begin(AopEnum action, AopInfo aopInfo)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                switch (action)
                {
                case AopEnum.Delete:
                    sb.AppendFormat("数据被删除,删除条件为:{0}", aopInfo.Where);
                    break;
                }

                if (!string.IsNullOrWhiteSpace(sb.ToString()))
                {
                    using (EditLog log = new EditLog())
                    {
                        log.TableName = aopInfo.TableName;
                        log.KeyID     = Convert.ToString(aopInfo.Row.PrimaryCell.Value);
                        log.Content   = sb.ToString();
                        log.UserID    = UserAuth.UserID;
                        log.EditTime  = DateTime.Now;
                        log.Insert(InsertOp.None);
                    }
                }
            }
            catch (Exception err)
            {
                Log.WriteLogToTxt("AopError:" + err.Message);
            }
            return(AopResult.Default);
        }
Example #2
0
        public AopResult Begin(AopEnum action, AopInfo aopInfo)
        {
            try
            {
                StringBuilder sb = new StringBuilder();
                switch (action)
                {
                    case AopEnum.Delete:
                        sb.AppendFormat("数据被删除,删除条件为:{0}", aopInfo.Where);
                        break;
                }

                if (!string.IsNullOrWhiteSpace(sb.ToString()))
                {
                    using (EditLog log = new EditLog())
                    {
                        log.TableName = aopInfo.TableName;
                        log.KeyID = Convert.ToString(aopInfo.Row.PrimaryCell.Value);
                        log.Content = sb.ToString();
                        log.UserID = UserAuth.UserID;
                        log.EditTime = DateTime.Now;
                        log.Insert(InsertOp.None);
                    }
                }
            }
            catch (Exception err)
            {
                Log.WriteLogToTxt("AopError:" + err.Message);
            }
            return AopResult.Default;
        }