コード例 #1
0
        public static List<MarriageWitness> DeSerializeWitnesses(string witnessDtos, ServiceMarriage marriage)
        {
            var witnesses = new List<MarriageWitness>();

            var serializer = new JavaScriptSerializer();
            var marriages = serializer.DeserializeToMarriageWitnesses(witnessDtos, marriage.MarriageDate.ParseToValidYear(), marriage.MarriageDate,
                                                                      marriage.MarriageLocation, marriage.LocationId.ToGuid());

            foreach (WitnessDto witnessDto in marriages)
            {
                var person = new ServicePerson();
                var nMarriageWitness = new MarriageWitness();

                person.ReferenceYear = witnessDto.Year;
                person.ReferenceDate = witnessDto.Date;
                person.ReferenceLocation = witnessDto.Location;
                person.ReferenceLocationId = witnessDto.LocationId.ToString();
                person.ChristianName = witnessDto.Name;
                person.Surname = witnessDto.Surname;
                person.OthersideChristianName = "";
                person.OthersideSurname = "";
                person.OthersideRelationship = "";
                person.Notes = "Witness to marriage of " + marriage.MaleSName + " and " + marriage.FemaleSName + " " + marriage.MarriageDate + " at " + marriage.MarriageLocation;

                nMarriageWitness.Description = witnessDto.Description;
                nMarriageWitness.Person = person;
                witnesses.Add(nMarriageWitness);
            }

            return witnesses;
        }