protected override object ReadRow(IRowReader reader)
        {
            AuditAssetSearchKeyword auditAssetSearchKeyword = AuditAssetSearchKeyword.New();

            // Table Fields
            auditAssetSearchKeyword.AuditAssetSearchKeywordId = reader.GetInt32("AuditAssetSearchKeywordId");
            auditAssetSearchKeyword.AuditAssetSearchId        = reader.GetInt32("AuditAssetSearchId");
            auditAssetSearchKeyword.SearchKeyword             = reader.GetString("SearchKeyword");


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

            return(auditAssetSearchKeyword);
        }
        public virtual AuditAssetSearchKeyword Update(AuditAssetSearchKeyword auditAssetSearchKeyword)
        {
            if (!auditAssetSearchKeyword.IsDirty || auditAssetSearchKeyword.IsNull)
            {
                // Nothing to do - no point hammering the database unnecessarily
                return(auditAssetSearchKeyword);
            }

            IDbCommand command = CreateCommand();

            if (auditAssetSearchKeyword.IsNew)
            {
                // Adding
                command.CommandText = "INSERT INTO [AuditAssetSearchKeyword] ([AuditAssetSearchId], [SearchKeyword]) VALUES (@auditAssetSearchId, @searchKeyword) ; SELECT @@identity AS NewId;";
            }
            else
            {
                // Updating
                command.CommandText = "UPDATE [AuditAssetSearchKeyword] SET [AuditAssetSearchId] = @auditAssetSearchId, [SearchKeyword] = @searchKeyword WHERE AuditAssetSearchKeywordId = @auditAssetSearchKeywordId";
            }

            command.Parameters.Add(CreateParameter("@auditAssetSearchId", auditAssetSearchKeyword.AuditAssetSearchId));
            command.Parameters.Add(CreateParameter("@searchKeyword", auditAssetSearchKeyword.SearchKeyword));

            if (auditAssetSearchKeyword.IsNew)
            {
                auditAssetSearchKeyword.AuditAssetSearchKeywordId = Convert.ToInt32(ExecScalar(command));
            }
            else
            {
                command.Parameters.Add(CreateParameter("@auditAssetSearchKeywordId", auditAssetSearchKeyword.AuditAssetSearchKeywordId));
                ExecuteCommand(command);
            }

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

            return(auditAssetSearchKeyword);
        }
Ejemplo n.º 3
0
        public static AuditAssetSearchKeyword FindOne(AuditAssetSearchKeywordFinder finder)
        {
            AuditAssetSearchKeyword AuditAssetSearchKeyword = AuditAssetSearchKeywordMapper.Instance.FindOne(finder);

            return(AuditAssetSearchKeyword ?? Empty);
        }
Ejemplo n.º 4
0
 public static AuditAssetSearchKeyword Update(AuditAssetSearchKeyword auditAssetSearchSector)
 {
     return(AuditAssetSearchKeywordMapper.Instance.Update(auditAssetSearchSector));
 }
Ejemplo n.º 5
0
        public static AuditAssetSearchKeyword Get(Nullable <Int32> AuditAssetSearchKeywordId)
        {
            AuditAssetSearchKeyword AuditAssetSearchKeyword = AuditAssetSearchKeywordMapper.Instance.Get(AuditAssetSearchKeywordId);

            return(AuditAssetSearchKeyword ?? Empty);
        }