Пример #1
0
        public virtual AuditAssetSearch Update(AuditAssetSearch auditAssetSearch)
        {
            if (!auditAssetSearch.IsDirty || auditAssetSearch.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(auditAssetSearch);
            }

            IDbCommand command = CreateCommand();

            if (auditAssetSearch.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AuditAssetSearch] ([SessionId], [IpAddress], [UserId], [Date]) VALUES (@sessionId, @ipAddress, @userId, @date) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AuditAssetSearch] SET [SessionId] = @sessionId, [IpAddress] = @ipAddress, [UserId] = @userId, [Date] = @date WHERE AuditAssetSearchId = @auditAssetSearchId";
            }

            command.Parameters.Add(CreateParameter("@sessionId", auditAssetSearch.SessionId));
            command.Parameters.Add(CreateParameter("@ipAddress", auditAssetSearch.IpAddress));
            command.Parameters.Add(CreateParameter("@userId", auditAssetSearch.UserId));
            command.Parameters.Add(CreateParameter("@date", auditAssetSearch.Date));

            if (auditAssetSearch.IsNew)
            {
                auditAssetSearch.AuditAssetSearchId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@auditAssetSearchId", auditAssetSearch.AuditAssetSearchId));
                ExecuteCommand(command);
            }

            auditAssetSearch.IsDirty = false;
            auditAssetSearch.ChangedProperties.Clear();

            return(auditAssetSearch);
        }
Пример #2
0
        protected override object ReadRow(IRowReader reader)
        {
            AuditAssetSearch auditAssetSearch = AuditAssetSearch.New();

            // Table Fields
            auditAssetSearch.AuditAssetSearchId = reader.GetInt32("AuditAssetSearchId");
            auditAssetSearch.SessionId          = reader.GetString("SessionId");
            auditAssetSearch.IpAddress          = reader.GetString("IpAddress");
            auditAssetSearch.UserId             = reader.GetInt32("UserId");
            auditAssetSearch.Date = reader.GetDateTime("Date");

            // View Fields
            auditAssetSearch.SearchKeyword = reader.GetString("SearchKeyword");
            auditAssetSearch.AssetId       = reader.GetInt32("AssetId");
            auditAssetSearch.UserName      = reader.GetString("UserName");

            auditAssetSearch.IsDirty = false;
            auditAssetSearch.ChangedProperties.Clear();

            return(auditAssetSearch);
        }
Пример #3
0
 public static AuditAssetSearch Update(AuditAssetSearch auditAssetSearch)
 {
     return(AuditAssetSearchMapper.Instance.Update(auditAssetSearch));
 }
Пример #4
0
        public static AuditAssetSearch FindOne(AuditAssetSearchFinder finder)
        {
            AuditAssetSearch AuditAssetSearch = AuditAssetSearchMapper.Instance.FindOne(finder);

            return(AuditAssetSearch ?? Empty);
        }
Пример #5
0
        public static AuditAssetSearch Get(Nullable <Int32> AuditAssetSearchId)
        {
            AuditAssetSearch AuditAssetSearch = AuditAssetSearchMapper.Instance.Get(AuditAssetSearchId);

            return(AuditAssetSearch ?? Empty);
        }