Example #1
0
        /// <summary>
        /// This is a test
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="errorType"></param>
        /// <param name="issue"></param>
        /// <param name="valueList">Value :(0 = name, 1 = value, 2 = row, 3 = datatype)
        /// MetadataAttribute: (0=name, 1=value, 2=attributeNumber, 3= packageNumber)
        /// </param>
        public Error(ErrorType errorType, string issue, params object[] valueList)
        {
            _errorType = errorType;
            _issue     = issue;

            if (errorType.Equals(ErrorType.Value))
            {
                if (valueList[0] != null)
                {
                    _name = valueList[0].ToString();
                }
                if (valueList[1] != null)
                {
                    _value = valueList[1].ToString();
                }
                if (valueList[2] != null)
                {
                    _row = Convert.ToInt32(valueList[2]);
                }
                if (valueList[3] != null)
                {
                    _dataType = valueList[3].ToString();
                }
                if (valueList.Length > 4 && valueList[4] != null)
                {
                    _datePattern = valueList[4].ToString();
                }
            }

            if (errorType.Equals(ErrorType.MetadataAttribute))
            {
                if (valueList[0] != null)
                {
                    _name = valueList[0].ToString();
                }
                if (valueList[1] == null)
                {
                    _value = "null";
                }
                else
                {
                    _value = valueList[1].ToString();
                }
                if (valueList[2] != null)
                {
                    _number = Convert.ToInt32(valueList[2].ToString());
                }
                if (valueList[3] != null)
                {
                    _package = valueList[3].ToString();
                }
                if (valueList[4] != null)
                {
                    _packageLabel = valueList[4].ToString();
                }
            }
        }
        /// <summary>
        /// Returns true if ValidationError instances are equal
        /// </summary>
        /// <param name="other">Instance of ValidationError to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ValidationError other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     RequestId == other.RequestId ||
                     RequestId != null &&
                     RequestId.Equals(other.RequestId)
                     ) &&
                 (
                     ErrorType == other.ErrorType ||
                     ErrorType != null &&
                     ErrorType.Equals(other.ErrorType)
                 ) &&
                 (
                     ErrorCodes == other.ErrorCodes ||
                     ErrorCodes != null &&
                     ErrorCodes.Equals(other.ErrorCodes)
                 ));
        }
Example #3
0
        /// <summary>
        /// Evaluates whether an object is equal to this object.
        /// </summary>
        /// <param name="obj">The object to compare this one to.</param>
        /// <returns>(bool) whether the two objects are equal</returns>
        public bool IsEqual(object obj)
        {
            LogRecord logRecord;

            try
            {
                logRecord = (LogRecord)obj;
            }
            catch
            {
                throw new ArgumentException();
            }

            return(Timestamp.Equals(logRecord.Timestamp) &&
                   Operation.Equals(logRecord.Operation) &&
                   Identifier.Equals(logRecord.Identifier) &&
                   IPAddress.Equals(logRecord.IPAddress) &&
                   ErrorType.Equals(logRecord.ErrorType));
        }
Example #4
0
File: Error.cs Project: BEXIS2/Core
        /// <summary>
        /// This is a test
        /// </summary>
        /// <remarks></remarks>
        /// <seealso cref=""/>
        /// <param name="errorType"></param>
        /// <param name="issue"></param>
        /// <param name="valueList">Value :(0 = name, 1 = value, 2 = row, 3 = datatype)
        /// MetadataAttribute: (0=name, 1=value, 2=attributeNumber, 3= packageNumber)
        /// </param>
        public Error(ErrorType errorType ,string issue, params object[] valueList)
        {
            _errorType = errorType;
            _issue = issue;

            if (errorType.Equals(ErrorType.Value))
            {
                if (valueList[0] != null) _name = valueList[0].ToString();
                if (valueList[1] != null) _value = valueList[1].ToString();
                if (valueList[2] != null) _row = Convert.ToInt32(valueList[2]);
                if (valueList[3] != null) _dataType = valueList[3].ToString();
            }

            if (errorType.Equals(ErrorType.MetadataAttribute))
            {
                if (valueList[0] != null) _name = valueList[0].ToString();
                if (valueList[1] == null) _value = "null";
                else _value = valueList[1].ToString();
                if (valueList[2] != null) _number = Convert.ToInt32(valueList[2].ToString());
                if (valueList[3] != null) _package = valueList[3].ToString();
                if (valueList[4] != null) _packageLabel = valueList[4].ToString();
            }
        }