コード例 #1
0
ファイル: City.cs プロジェクト: KommuSoft/CplKul2012
        protected override bool isValid(out string exceptionMessage)
        {
            if (name.Length == 0) {
                return makeExceptionMessage (out exceptionMessage, "The name of the city is invalid");
            }

            if (!validCountry (country, out exceptionMessage)) {
                return false;
            }

            CountryRequest cor = new CountryRequest ();
            string countryName = cor.fetchFromID (country) [0].name;
            CityRequest cr = new CityRequest ();
            if (cr.fetchFromNameAndCountry (name, countryName).Count () != 0) {
                return makeExceptionMessage (out exceptionMessage, "The name of the city already exists for a city in the country " + countryName);
            }

            return makeExceptionMessage(out exceptionMessage);
        }