Пример #1
0
        public override StandardReturType ValidateInput()
        {
            if (Input == null)
            {
                return(StandardReturType.NullInput());
            }

            if (Input.SoegObjekt == null)
            {
                return(StandardReturType.NullInput("SoegObjekt"));
            }

            if (!string.IsNullOrEmpty(Input.SoegObjekt.UUID) && !Strings.IsGuid(Input.SoegObjekt.UUID))
            {
                return(StandardReturType.InvalidUuid(Input.SoegObjekt.UUID));
            }
            // Start index & max results
            if (!string.IsNullOrEmpty(Input.FoersteResultatReference))
            {
                int startResult;
                if (!int.TryParse(Input.FoersteResultatReference, out startResult))
                {
                    return(StandardReturType.InvalidValue("FoersteResultatReference", Input.FoersteResultatReference));
                }
                if (startResult < 0)
                {
                    return(StandardReturType.ValueOutOfRange("FoersteResultatReference", Input.FoersteResultatReference));
                }
            }

            if (!string.IsNullOrEmpty(Input.MaksimalAntalKvantitet))
            {
                int maxResults;
                if (!int.TryParse(Input.MaksimalAntalKvantitet, out maxResults))
                {
                    return(StandardReturType.InvalidValue("MaksimalAntalKvantitet", Input.MaksimalAntalKvantitet));
                }
                if (maxResults < 0)
                {
                    return(StandardReturType.ValueOutOfRange("MaksimalAntalKvantitet", Input.MaksimalAntalKvantitet));
                }
            }

            // Not implemented criteria
            if (Input.SoegObjekt.SoegRegistrering != null)
            {
                return(StandardReturType.NotImplemented("SoegRegistrering"));
            }
            if (Input.SoegObjekt.SoegRelationListe != null)
            {
                return(StandardReturType.NotImplemented("SoegRelationListe"));
            }

            if (Input.SoegObjekt.SoegTilstandListe != null)
            {
                return(StandardReturType.NotImplemented("SoegTilstandListe"));
            }

            if (Input.SoegObjekt.SoegVirkning != null)
            {
                return(StandardReturType.NotImplemented("SoegVirkning"));
            }

            // Now validate attribute lists
            if (Input.SoegObjekt.SoegAttributListe != null)
            {
                if (Input.SoegObjekt.SoegAttributListe.LokalUdvidelse != null)
                {
                    return(StandardReturType.NotImplemented("SoegAttributListe.LokalUdvidelse"));
                }

                if (Input.SoegObjekt.SoegAttributListe.SoegRegisterOplysning != null)
                {
                    return(StandardReturType.NotImplemented("SoegAttributListe.SoegRegisterOplysning"));
                }

                if (Input.SoegObjekt.SoegAttributListe.SoegSundhedOplysning != null)
                {
                    return(StandardReturType.NotImplemented("SoegAttributListe.SoegSundhedOplysning"));
                }

                if (Input.SoegObjekt.SoegAttributListe.SoegEgenskab != null)
                {
                    foreach (var egen in Input.SoegObjekt.SoegAttributListe.SoegEgenskab)
                    {
                        if (egen.AndreAdresser != null)
                        {
                            return(StandardReturType.NotImplemented("AndreAdresser"));
                        }
                        if (!string.IsNullOrEmpty(egen.FoedestedNavn))
                        {
                            return(StandardReturType.NotImplemented("FoedestedNavn"));
                        }

                        if (!string.IsNullOrEmpty(egen.FoedselsregistreringMyndighedNavn))
                        {
                            return(StandardReturType.NotImplemented("FoedselsregistreringMyndighedNavn"));
                        }
                        if (egen.KontaktKanal != null)
                        {
                            return(StandardReturType.NotImplemented("KontaktKanal"));
                        }
                        if (egen.NaermestePaaroerende != null)
                        {
                            return(StandardReturType.NotImplemented("NaermestePaaroerende"));
                        }
                        if (egen.SoegVirkning != null)
                        {
                            return(StandardReturType.NotImplemented("SoegVirkning"));
                        }
                        if (egen.SoegVirkning != null)
                        {
                            return(StandardReturType.NotImplemented("SoegVirkning"));
                        }
                    }
                }
            }
            return(StandardReturType.OK());
        }