示例#1
0
        private void ParseContactElement(dynamic data, ContactReturn result)
        {
            string  name  = data.name;
            dynamic value = data.value;

            switch (name)
            {
            case "handle":
                result.Handle = value.@string;
                break;

            case "id":
                result.Id = value.@int;
                break;

            case "given":
                result.Given = value.@string;
                break;

            case "family":
                result.Family = value.@string;
                break;

            case "email":
                result.Email = value.@string;
                break;

            case "streetaddr":
                result.Streetaddr = value.@string;
                break;

            case "zip":
                result.Zip = value.@string;
                break;

            case "city":
                result.City = value.@string;
                break;

            case "country":
                result.Country = value.@string;
                break;

            case "phone":
                result.Phone = value.@string;
                break;

            case "type":
                result.Type = value.@int;
                break;

            default:
                break;
            }
        }
示例#2
0
        private ContactReturn ParseContactReturn(dynamic methodResponse)
        {
            var result = new ContactReturn();
            var data   = [email protected];

            {
                var member = [email protected];
                if (member is JArray)
                {
                    foreach (var m in member)
                    {
                        ParseContactElement(m, result);
                    }
                }
                else
                {
                    ParseContactElement(member, result);
                }
            }
            return(result);
        }