当前位置: 首页>>代码示例>>C#>>正文


C# Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses方法代码示例

本文整理汇总了C#中System.Web.Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses方法的典型用法代码示例。如果您正苦于以下问题:C# Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses方法的具体用法?C# Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses怎么用?C# Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.Script.Serialization.JavaScriptSerializer的用法示例。


在下文中一共展示了Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DeSerializeWitnesses

        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;
        }
开发者ID:gnthackray1978,项目名称:and-sources,代码行数:31,代码来源:MarriageWitness.cs


注:本文中的System.Web.Script.Serialization.JavaScriptSerializer.DeserializeToMarriageWitnesses方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。