⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 validationcontext.cs

📁 基于DotNet的开源工作流引擎
💻 CS
字号:
using System;
using System.Collections;
using System.Text;
using log4net;

namespace NetBpm.Workflow.Definition.Impl
{
	public class ValidationContext
	{
		private IList _errors = new ArrayList();
		private IList _scope = new ArrayList();
		private static readonly ILog log = LogManager.GetLogger(typeof (CreationContext));

		public ValidationContext()
		{
		}

		public IList Errors
		{
			get { return this._errors; }

			set { this._errors = value; }

		}

		public void AddError(String errorMsg)
		{
			log.Error(errorMsg);
			this._errors.Add(errorMsg);
		}

		public bool HasErrors()
		{
			return (_errors.Count > 0);
		}

		public void Check(bool condition, String errorMsg)
		{
			if (!condition)
			{
				StringBuilder buffer = new StringBuilder();
				IEnumerator iter = _scope.GetEnumerator();
				while (iter.MoveNext())
				{
					buffer.Append(iter.Current);
					buffer.Append(" : ");
				}
				buffer.Append(errorMsg);
				log.Error(buffer.ToString());
				_errors.Add(buffer.ToString());
			}
		}

		public void PushScope(String msg)
		{
			_scope.Add(msg);
		}

		public void PopScope()
		{
			_scope.Remove(_scope.Count);
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -