public static string Validate(IOrganisationElement item) { if (item.Name != null && item.Name.Length > 50) { return "Значение поля 'Название' не может быть длиннее 50 символов"; } if (item.Description != null && item.Description.Length > 50) { return "Значение поля 'Примечание' не может быть длиннее 50 символов"; } return string.Empty; }
public static bool Validate(IOrganisationElement item) { if (item.Name != null && item.Name.Length > 50) { ServiceFactory.MessageBoxService.Show("Значение поля 'Название' не может быть длиннее 50 символов"); return false; } if (item.Description != null && item.Description.Length > 50) { ServiceFactory.MessageBoxService.Show("Значение поля 'Примечание' не может быть длиннее 50 символов"); return false; } return true; }