public string this[string columnName] { get { string resultOK = null; BoxValidation vm = new BoxValidation(); if (_canValidate) { string result = vm.Validation(_validationDictionary, columnName); if (string.IsNullOrEmpty(result)) { return(result); } else { _error = true; return(result); } } return(resultOK); } }
public string this[string columnName] { get { string resultOK = null; string resultNOK = "Błąd"; if (_canValidate) { switch (columnName) { case "City": if (string.IsNullOrWhiteSpace(_city)) { _error = true; return(resultNOK); } return(resultOK); case "ContactPerson": if (string.IsNullOrWhiteSpace(_contactPerson)) { _error = true; return(resultNOK); } return(resultOK); case "PhoneNumber": if (string.IsNullOrWhiteSpace(_phoneNumber)) { _error = true; return(resultNOK); } return(resultOK); case "Street": if (string.IsNullOrWhiteSpace(_street)) { _error = true; return(resultNOK); } return(resultOK); case "ZipCode": if (string.IsNullOrWhiteSpace(_zipCode) || !string.IsNullOrWhiteSpace(_zipCode) && _zipCode.Length < 5) { _error = true; return(resultNOK); } return(resultOK); default: BoxValidation vm = new BoxValidation(); if (_canValidate) { string result = vm.Validation(_validationDictionary, columnName); if (string.IsNullOrEmpty(result)) { return(result); } _error = true; return(result); } break; } } return(resultOK); } }