示例#1
0
		/// <summary>
		/// 根据环境信息初始化Log。
		/// 初始化的属性包括:CorrelationID、RequestContextString、Operator、RealOperator
		/// </summary>
		/// <returns></returns>
		public static AUOperationLog CreateLogFromEnvironment()
		{
			AUOperationLog log = new AUOperationLog();

			log.CorrelationID = Trace.CorrelationManager.ActivityId.ToString();
			log.RequestContextString = EnvironmentHelper.GetEnvironmentInfo();
			log.CreateTime = SCActionContext.Current.TimePoint;

			if (DeluxePrincipal.IsAuthenticated)
			{
				log.Operator = DeluxeIdentity.CurrentUser;
				log.RealOperator = DeluxeIdentity.CurrentRealUser;
			}

			return log;
		}
示例#2
0
        /// <summary>
        /// 根据环境信息初始化Log。
        /// 初始化的属性包括:CorrelationID、RequestContextString、Operator、RealOperator
        /// </summary>
        /// <returns></returns>
        public static AUOperationLog CreateLogFromEnvironment()
        {
            AUOperationLog log = new AUOperationLog();

            log.CorrelationID        = Trace.CorrelationManager.ActivityId.ToString();
            log.RequestContextString = EnvironmentHelper.GetEnvironmentInfo();
            log.CreateTime           = SCActionContext.Current.TimePoint;

            if (DeluxePrincipal.IsAuthenticated)
            {
                log.Operator     = DeluxeIdentity.CurrentUser;
                log.RealOperator = DeluxeIdentity.CurrentRealUser;
            }

            return(log);
        }
示例#3
0
        /// <summary>
        /// 插入一个新的<see cref="AUOperationLog"/>到数据库中,操作完毕通过其ID属性获取新插入的ID。
        /// </summary>
        /// <param name="log"></param>
        public void Insert(AUOperationLog log)
        {
            log.NullCheck("log");

            log.CreateTime = SCActionContext.Current.TimePoint;
            StringBuilder strB = new StringBuilder(256);

            strB.Append(ORMapping.GetInsertSql(log, this.GetMappingInfo(), TSqlBuilder.Instance));
            strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
            strB.Append("SELECT SCOPE_IDENTITY()");

            AUCommon.DoDbAction(() =>
            {
                Decimal newID = (Decimal)DbHelper.RunSqlReturnScalar(strB.ToString(), this.GetConnectionName());

                log.ID = Decimal.ToInt32(newID);
            });
        }
		/// <summary>
		/// 插入一个新的<see cref="AUOperationLog"/>到数据库中,操作完毕通过其ID属性获取新插入的ID。
		/// </summary>
		/// <param name="log"></param>
		public void Insert(AUOperationLog log)
		{
			log.NullCheck("log");

			log.CreateTime = SCActionContext.Current.TimePoint;
			StringBuilder strB = new StringBuilder(256);

			strB.Append(ORMapping.GetInsertSql(log, this.GetMappingInfo(), TSqlBuilder.Instance));
			strB.Append(TSqlBuilder.Instance.DBStatementSeperator);
			strB.Append("SELECT SCOPE_IDENTITY()");

			AUCommon.DoDbAction(() =>
			{
				Decimal newID = (Decimal)DbHelper.RunSqlReturnScalar(strB.ToString(), this.GetConnectionName());

				log.ID = Decimal.ToInt32(newID);
			});
		}