public string this[string propertyName] { get { try { string validationResult = String.Empty; if (ValidationEnabled) { switch (propertyName) { case "ID": if (AddEnabled && _dbservicewms.CountBoxIDs(ID) != 0 || ID.Length == 0) { validationResult = ResourceReader.GetString("ERR_BOXID_EXISTS"); } break; case "SKUID": if (_dbservicewms.FindSKUID(SKUID) == null || SKUID == null || SKUID.Length == 0) { validationResult = ResourceReader.GetString("ERR_SKUID_NONE"); } break; } } Validator.AddOrUpdate(propertyName, validationResult == String.Empty); AllPropertiesValid = Validator.IsValid(); return(validationResult); } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); Validator.AddOrUpdate(propertyName, false); AllPropertiesValid = Validator.IsValid(); return(ResourceReader.GetString("ERR_EXCEPTION")); } } }