本文整理汇总了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;
}