Пример #1
0
        public Sighting AddIdentification(
            string comments,
            bool isCustomIdentification,
            string category,
            string kingdom,
            string phylum,
            string className,
            string order,
            string family,
            string genus,
            string species,
            string subspecies,
            IEnumerable <string> commonGroupNames,
            IEnumerable <string> commonNames,
            IEnumerable <string> synonyms,
            DateTime createdOn,
            User createdByUser)
        {
            Check.RequireNotNull(createdByUser, "createdByUser");
            Check.RequireNotNullOrWhitespace(category, "category");
            Check.RequireNotNullOrWhitespace(kingdom, "kingdom"); // Can only check for kingdom as some Ids such as Funghi can be identified by kingdom alone
            Check.RequireNotNull(commonGroupNames, "commonGroupNames");
            Check.RequireNotNull(commonNames, "commonNames");
            Check.RequireNotNull(synonyms, "synonyms");
            Check.RequireNotNull(createdByUser, "createdByUser");

            var maxId = _identifications.Count > 0 ? _identifications.Select(x => x.SequentialId).Max() : 0;

            IdentificationNew identification = SetIdentification(
                maxId + 1,
                comments,
                isCustomIdentification,
                category,
                kingdom,
                phylum,
                className,
                order,
                family,
                genus,
                species,
                subspecies,
                commonGroupNames,
                commonNames,
                synonyms,
                createdOn,
                createdByUser);

            ApplyEvent(new DomainModelCreatedEvent <IdentificationNew>(identification, createdByUser, this));

            return(this);
        }
Пример #2
0
        public Sighting UpdateIdentification(
            int id,
            string comments,
            bool isCustomIdentification,
            string category,
            string kingdom,
            string phylum,
            string className,
            string order,
            string family,
            string genus,
            string species,
            string subspecies,
            IEnumerable <string> commonGroupNames,
            IEnumerable <string> commonNames,
            IEnumerable <string> synonyms,
            DateTime updatedOn,
            User updatedByUser)
        {
            Check.RequireNotNullOrWhitespace(category, "category");
            Check.RequireNotNullOrWhitespace(kingdom, "kingdom"); // Can only check for kingdom as some Ids such as Funghi can be identified by kingdom alone
            Check.RequireNotNull(commonGroupNames, "commonGroupNames");
            Check.RequireNotNull(commonNames, "commonNames");
            Check.RequireNotNull(synonyms, "synonyms");
            Check.RequireNotNull(updatedByUser, "updatedByUser");

            IdentificationNew identification = _identifications.Single(x => x.SequentialId == id);

            identification.UpdateDetails(
                updatedByUser,
                updatedOn,
                comments,
                isCustomIdentification,
                category,
                kingdom,
                phylum,
                className,
                order,
                family,
                genus,
                species,
                subspecies,
                commonGroupNames,
                commonNames,
                synonyms);

            ApplyEvent(new DomainModelUpdatedEvent <IdentificationNew>(identification, updatedByUser, this));

            return(this);
        }
Пример #3
0
        private IdentificationNew SetIdentification(
            int id,
            string comments,
            bool isCustomIdentification,
            string category,
            string kingdom,
            string phylum,
            string className,
            string order,
            string family,
            string genus,
            string species,
            string subspecies,
            IEnumerable <string> commonGroupNames,
            IEnumerable <string> commonNames,
            IEnumerable <string> synonyms,
            DateTime createdOn,
            User createdByUser)
        {
            var identification = new IdentificationNew(
                id,
                createdByUser,
                createdOn,
                comments,
                isCustomIdentification,
                category,
                kingdom,
                phylum,
                className,
                order,
                family,
                genus,
                species,
                subspecies,
                commonGroupNames,
                commonNames,
                synonyms);

            _identifications.Add(identification);

            return(identification);
        }