Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.ComponentModel;
- /// <summary>
- /// Summary description for BusinessObjectBase
- /// </summary>
- public class BusinessObjectBase : IDataErrorInfo
- {
- private Dictionary<string, string> _validationErrors;
- protected Dictionary<string, string> ValidationErrors
- {
- get
- {
- return this._validationErrors ?? (this._validationErrors = new Dictionary<string, string>());
- }
- }
- public BusinessObjectBase()
- {
- //
- // TODO: Add constructor logic here
- //
- }
- public bool IsValid
- {
- get { return this.ValidationErrors.Count == 0; }
- }
- public string Error
- {
- get
- {
- return !this.IsValid ? "Objektets tillstånd är ogiltigt." : null;
- }
- }
- public string this[string propertyName]
- {
- get
- {
- string error;
- if (this.ValidationErrors.TryGetValue(propertyName, out error))
- {
- return error;
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement