Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="exception"></param>
        /// <param name="className"></param>
        /// <param name="fieldName"></param>
        public void SetErrorInfo(
            Control owner,
            Exception exception,
            string className,
            string fieldName)
        {
            if (owner == null)
            {
                owner = this.CurrentOwner;
            }
            ErrorInfoData temperror = this.Errors.Find(delegate(ErrorInfoData e) { return(className == e.ClassName && fieldName == e.FieldName && e.Message == exception.Message); });

            if (temperror != null)
            {
                this.Errors.Remove(temperror);
            }

            ErrorInfoData error = new ErrorInfoData(
                ErrorInfoType.Error,
                owner,
                exception,
                null,
                null,
                className,
                fieldName);

            InsertError(owner, error);
        }
Beispiel #2
0
 private void InsertError(Control owner, ErrorInfoData error)
 {
     if (this.InvokeRequired)
     {
         InsertErrorDelegate insertDelegate = new InsertErrorDelegate(InnerInsertError);
         this.Invoke(insertDelegate, owner, new List <ErrorInfoData> {
             error
         });
     }
     else
     {
         InnerInsertError(owner, new List <ErrorInfoData> {
             error
         });
     }
 }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="message"></param>
        /// <param name="className"></param>
        /// <param name="fieldName"></param>
        public void SetErrorInfo(
            Control owner,
            string message,
            string className,
            string fieldName)
        {
            if (owner == null)
            {
                owner = this.CurrentOwner;
            }
            ErrorInfoData error = new ErrorInfoData(
                owner,
                ExceptionHelper.MaskSqlServerException(message),
                className,
                fieldName);

            InsertError(owner, error);
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="exception"></param>
        /// <param name="control"></param>
        /// <param name="image"></param>
        public void SetErrorInfo(
            Control owner,
            Exception exception,
            Control control,
            Image image)
        {
            if (owner == null)
            {
                owner = this.CurrentOwner;
            }
            ErrorInfoData error = new ErrorInfoData(
                ErrorInfoType.Error,
                owner,
                exception,
                image,
                control);

            InsertError(owner, error);
        }
Beispiel #5
0
 /// <summary>
 /// 批量设置异常信息
 /// </summary>
 /// <param name="errors"></param>
 public void SetErrorInfo(List <ErrorInfoData> errors)
 {
     if (errors == null || errors.Count <= 0)
     {
         return;
     }
     for (int i = 0; i < errors.Count; i++)
     {
         ErrorInfoData error = errors[i];
         if (error.Owner == null)
         {
             error.Owner = this.CurrentOwner;
         }
         ErrorInfoData temperror = this.Errors.Find(delegate(ErrorInfoData e) { return(error.ClassName == e.ClassName && error.FieldName == e.FieldName && e.Message == error.Message); });
         if (temperror != null)
         {
             this.Errors.Remove(temperror);
         }
     }
     this.InsertErrors(errors);
 }