Represents an custom error that can be associated with a .
Exemple #1
0
 /// <include file='doc\DataRow.uex' path='docs/doc[@for="DataRow.GetColumnError2"]/*' />
 /// <devdoc>
 ///    <para>Gets the error description of
 ///       the specified <see cref='System.Data.DataColumn'/>.</para>
 /// </devdoc>
 public string GetColumnError(DataColumn column)
 {
     CheckColumn(column);
     if (error == null)
     {
         error = new DataError();
     }
     return(error.GetColumnError(column));
 }
Exemple #2
0
 /// <include file='doc\DataRow.uex' path='docs/doc[@for="DataRow.SetColumnError2"]/*' />
 /// <devdoc>
 /// <para>Sets the error description for a column specified as a <see cref='System.Data.DataColumn'/>.</para>
 /// </devdoc>
 public void SetColumnError(DataColumn column, string error)
 {
     CheckColumn(column);
     if (this.error == null)
     {
         this.error = new DataError();
     }
     if (GetColumnError(column) != error)
     {
         this.error.SetColumnError(column, error);
         RowErrorChanged();
     }
 }
Exemple #3
0
        public void SetColumnError(DataColumn column, string error)
        {
            IntPtr ptr;

            this.CheckColumn(column);
            Bid.ScopeEnter(out ptr, "<ds.DataRow.SetColumnError|API> %d#, column=%d, error='%ls'\n", this.ObjectID, column.ObjectID, error);
            try
            {
                if (this.error == null)
                {
                    this.error = new DataError();
                }
                if (this.GetColumnError(column) != error)
                {
                    this.error.SetColumnError(column, error);
                    this.RowErrorChanged();
                }
            }
            finally
            {
                Bid.ScopeLeave(ref ptr);
            }
        }
        /// <summary>
        /// Sets current position of recDataAccess.Record based on the input parameter record bookmark
        /// </summary>
        /// <param name="dataError">Determines whether to throw in case the bookmark is not valid.</param>
        /// <param name="bookmark">Bookmark of the record. Must not be null.</param>
        internal override void SetPosition(DataError dataError, byte[] bookmark)
        {
            if (bookmark == null)
            {
                throw new ArgumentNullException("bookmark");
            }

            Debug.Assert(this.Record != null);

            NavRecordId recordId = new NavRecordId(bookmark);
            if (this.Record.ALRecordId != recordId)
            {
                if (this.Record.ALCurrentKeyIndex == NavKeyRef.ALPrimaryKeyIndex && dataError == DataError.TrapError)
                {
                    if (!this.Record.ALGet(dataError, recordId))
                    {
                        this.Record.SetPrimaryKeyFieldValues(recordId);
                    }
                }
                else
                {
                    this.Record.ALGet(dataError, recordId);
                }
            }
        }
 /// <summary>
 /// Sets current position of recDataAccess.Record based on the record bookmark
 /// </summary>
 /// <param name="dataError">Determines whether to throw in case the bookmark is not valid.</param>
 /// <param name="bookmark">Bookmark of the record.</param>
 internal virtual void SetPosition(DataError dataError, byte[] bookmark)
 {
 }
        /// <summary>
        /// Abstraction around NavRecord.Insert
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <param name="runApplicationTrigger">Indicates whether to run OnInsert table trigger.</param>
        /// <param name="belowRec">Parameter is not used.</param>
        /// <returns>Returns true on success.</returns>
        public virtual Boolean Insert(DataError errorLevel, Boolean runApplicationTrigger, Boolean belowRec)
        {
            if (this.Record == null)
            {
                return false;
            }

            return this.Record.Insert(errorLevel, runApplicationTrigger, true);
        }
        /// <summary>
        /// Abstraction around NavRecord.RENAME
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <returns>Returns true on success.</returns>
        public virtual Boolean Rename(DataError errorLevel)
        {
            if (this.Record == null)
            {
                return false;
            }

            this.Record.Rename(false, errorLevel);
            return true;
        }
 /// <devdoc>
 /// <para>Sets the error description for a column specified as a <see cref='System.Data.DataColumn'/>.</para>
 /// </devdoc>
 public void SetColumnError(DataColumn column, string error) {
     CheckColumn(column);
     
     IntPtr hscp;
     Bid.ScopeEnter(out hscp, "<ds.DataRow.SetColumnError|API> %d#, column=%d, error='%ls'\n", ObjectID, column.ObjectID, error);
     try {            
         if (this.error == null)  this.error = new DataError();
         if(GetColumnError(column) != error) {
             this.error.SetColumnError(column, error);
             RowErrorChanged();
         }
     }
     finally {
         Bid.ScopeLeave(ref hscp);
     }
 }
 /// <summary>
 /// Sets current position of recDataAccess.Record based on the record bookmark
 /// </summary>
 /// <param name="dataError">Determines whether to throw in case the bookmark is not valid.</param>
 /// <param name="bookmark">Bookmark of the record. Must not be null.</param>
 internal override void SetPosition(DataError dataError, byte[] bookmark)
 {
     if (bookmark == null)
     {
         throw new ArgumentNullException("bookmark");
     }
     if (this.Form.Bookmark.GetBytes() != bookmark)
     {
         this.Form.SetBookmark(dataError, bookmark);
     }
 }
        /// <summary>
        /// Abstraction around NavRecord.DELETE
        /// </summary>
        /// <param name="errorLevel">The error level.</param>
        /// <param name="runTrigger">Indicates whether to run triggers.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Delete(DataError errorLevel, Boolean runTrigger)
        {
            if (this.SourceMetadata != null && this.SourceMetadata.DeleteAllowed)
            {
                if (this.Form.Delete())
                {
                    return base.Delete(errorLevel, runTrigger);
                }
            }

            return false;
        }
        /// <summary>
        /// Abstraction around NavRecord.RENAME
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Rename(DataError errorLevel)
        {
            // Rename runs the record OnRename trigger, and afterwards sets notification through Form.Rename
            if (base.Rename(errorLevel))
            {
                this.Form.Rename();
                return true;
            }

            return false;
        }
        /// <summary>
        /// Abstraction around NavRecord.Modify
        /// </summary>
        /// <param name="errorLevel">The error level.</param>
        /// <param name="runTrigger">Indicates whether to run triggers.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Modify(DataError errorLevel, Boolean runTrigger)
        {
            if (this.SourceMetadata != null && this.SourceMetadata.ModifyAllowed)
            {
                if (this.Form.Modify())
                {
                    return base.Modify(errorLevel, runTrigger);
                }
            }

            return false;
        }
        /// <summary>
        /// Abstraction around NavRecord.Insert
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <param name="runApplicationTrigger">Indicates whether to run OnInsert table trigger.</param>
        /// <param name="belowXRec">Flag passed through to form triggers indicating whether there is a previous row to copy from.</param>
        /// <returns>Returns true on success.</returns>
        public override Boolean Insert(DataError errorLevel, Boolean runApplicationTrigger, bool belowXRec)
        {
            if (this.SourceMetadata != null && this.SourceMetadata.InsertAllowed)
            {
                if (this.Form.Insert(belowXRec))
                {
                    return base.Insert(errorLevel, runApplicationTrigger, belowXRec);
                }
            }

            return false;
        }
 public void SetColumnError(DataColumn column, string error)
 {
     IntPtr ptr;
     this.CheckColumn(column);
     Bid.ScopeEnter(out ptr, "<ds.DataRow.SetColumnError|API> %d#, column=%d, error='%ls'\n", this.ObjectID, column.ObjectID, error);
     try
     {
         if (this.error == null)
         {
             this.error = new DataError();
         }
         if (this.GetColumnError(column) != error)
         {
             this.error.SetColumnError(column, error);
             this.RowErrorChanged();
         }
     }
     finally
     {
         Bid.ScopeLeave(ref ptr);
     }
 }
 public string GetColumnError(DataColumn column)
 {
     this.CheckColumn(column);
     if (this.error == null)
     {
         this.error = new DataError();
     }
     return this.error.GetColumnError(column);
 }
Exemple #16
0
        /// <summary>
        /// Sets the error description for a column specified as a <see cref='System.Data.DataColumn'/>.
        /// </summary>
        public void SetColumnError(DataColumn column, string error)
        {
            CheckColumn(column);

            long logScopeId = DataCommonEventSource.Log.EnterScope("<ds.DataRow.SetColumnError|API> {0}, column={1}, error='{2}'", _objectID, column.ObjectID, error);
            try
            {
                if (_error == null) _error = new DataError();
                if (GetColumnError(column) != error)
                {
                    _error.SetColumnError(column, error);
                    RowErrorChanged();
                }
            }
            finally
            {
                DataCommonEventSource.Log.ExitScope(logScopeId);
            }
        }
Exemple #17
0
 /// <summary>
 /// Gets the error description of the specified <see cref='System.Data.DataColumn'/>.
 /// </summary>
 public string GetColumnError(DataColumn column)
 {
     CheckColumn(column);
     if (_error == null) _error = new DataError();
     return _error.GetColumnError(column);
 }
        /// <summary>
        /// Abstraction around NavRecord.DELETE
        /// </summary>
        /// <param name="errorLevel">Indicates how to handle errors.</param>
        /// <param name="runApplicationTrigger">Indicates whether to run OnDelete table trigger.</param>
        /// <returns>Returns true on success.</returns>
        public virtual Boolean Delete(DataError errorLevel, Boolean runApplicationTrigger)
        {
            if (this.Record == null)
            {
                return false;
            }

            return this.Record.Delete(errorLevel, runApplicationTrigger, true);
        }