Example #1
0
        public virtual LogCustomerEvent UpdateLogCustomerEvent(LogCustomerEvent entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            LogCustomerEvent other = GetLogCustomerEvent(entity.DbRecNo);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update LOG_CustomerEvent set  [CustomerID]=@CustomerID
							, [EventID]=@EventID
							, [Timestamp]=@Timestamp
							, [Data]=@Data 
							 where DBRecNo=@DBRecNo"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@DBRecNo", entity.DbRecNo)
                , new SqlParameter("@CustomerID", entity.CustomerId ?? (object)DBNull.Value)
                , new SqlParameter("@EventID", entity.EventId ?? (object)DBNull.Value)
                , new SqlParameter("@Timestamp", entity.Timestamp ?? (object)DBNull.Value)
                , new SqlParameter("@Data", entity.Data ?? (object)DBNull.Value)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetLogCustomerEvent(entity.DbRecNo));
        }
Example #2
0
        public virtual LogCustomerEvent InsertLogCustomerEvent(LogCustomerEvent entity)
        {
            LogCustomerEvent other = new LogCustomerEvent();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into LOG_CustomerEvent ( [CustomerID]
				,[EventID]
				,[Timestamp]
				,[Data] )
				Values
				( @CustomerID
				, @EventID
				, @Timestamp
				, @Data );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@DBRecNo", entity.DbRecNo)
                    , new SqlParameter("@CustomerID", entity.CustomerId ?? (object)DBNull.Value)
                    , new SqlParameter("@EventID", entity.EventId ?? (object)DBNull.Value)
                    , new SqlParameter("@Timestamp", entity.Timestamp ?? (object)DBNull.Value)
                    , new SqlParameter("@Data", entity.Data ?? (object)DBNull.Value)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetLogCustomerEvent(Convert.ToInt32(identity)));
            }
            return(entity);
        }
Example #3
0
        public virtual LogCustomerEvent LogCustomerEventFromDataRow(DataRow dr)
        {
            if (dr == null)
            {
                return(null);
            }
            LogCustomerEvent entity = new LogCustomerEvent();

            entity.DbRecNo    = (System.Int32)dr["DBRecNo"];
            entity.CustomerId = dr["CustomerID"] == DBNull.Value?(System.Int32?)null   : (System.Int32?)dr["CustomerID"];
            entity.EventId    = dr["EventID"] == DBNull.Value?(System.Int32?)null      : (System.Int32?)dr["EventID"];
            entity.Timestamp  = dr["Timestamp"] == DBNull.Value?(System.DateTime?)null : (System.DateTime?)dr["Timestamp"];
            entity.Data       = dr["Data"].ToString();
            return(entity);
        }
Example #4
0
 public virtual LogCustomerEvent DeleteLogCustomerEvent(LogCustomerEvent entity)
 {
     this.DeleteLogCustomerEvent(entity.DbRecNo);
     return(entity);
 }
 public LogCustomerEvent InsertLogCustomerEvent(LogCustomerEvent entity)
 {
     return(_iLogCustomerEventRepository.InsertLogCustomerEvent(entity));
 }
 public LogCustomerEvent UpdateLogCustomerEvent(LogCustomerEvent entity)
 {
     return(_iLogCustomerEventRepository.UpdateLogCustomerEvent(entity));
 }