AJUDAR A CORRER CLASS

JOAOBENEVIDES 06/04/2016 16:34:32
#460621
Ola Pessoal estou fazendo um programa em windows forms , ate nosso amigo KERPLUNK me ajudou em alguma coisas tenhos esta class
public class Pedidos
{
public Order[] orders { get; set; }
public Metadata[] metadata { get; set; }
}

public class Order
{
public string id { get; set; }
public string orderSiteId { get; set; }
public string site { get; set; }
public int? paymentType { get; set; }
public DateTime? purchasedAt { get; set; }
public DateTime? approvedAt { get; set; }
public DateTime? updatedAt { get; set; }
public string status { get; set; }
public decimal? totalAmount { get; set; }
public int? totalDiscountAmount { get; set; }
public Billing billing { get; set; }
public Customer customer { get; set; }
public Freight freight { get; set; }
public Item[] items { get; set; }
public Shipping shipping { get; set; }
public Tracking[] trackings { get; set; }
public Seller seller { get; set; }
}

public class Billing
{
public string address { get; set; }
public string number { get; set; }
public string complement { get; set; }
public string quarter { get; set; }
public string reference { get; set; }
public string city { get; set; }
public string state { get; set; }
public string countryId { get; set; }
public string zipCode { get; set; }
}

public class Customer
{
public string id { get; set; }
public string name { get; set; }
public string documentNumber { get; set; }
public string type { get; set; }
public DateTime? createdAt { get; set; }
public string email { get; set; }
public DateTime? birthDate { get; set; }
public Phone[] phones { get; set; }
}

public class Phone
{
public string number { get; set; }
public string type { get; set; }
}

public class Freight
{
public int? actualAmount { get; set; }
public int? chargedAmount { get; set; }
public int? transitTime { get; set; }
public int? crossDockingTime { get; set; }
public string additionalInfo { get; set; }
public string type { get; set; }
public DateTime? scheduledAt { get; set; }
public string scheduledPeriod { get; set; }
}

public class Shipping
{
public string address { get; set; }
public string number { get; set; }
public string complement { get; set; }
public string quarter { get; set; }
public string reference { get; set; }
public string city { get; set; }
public string state { get; set; }
public string countryId { get; set; }
public string zipCode { get; set; }
public string recipientName { get; set; }
}

public class Seller
{
public string id { get; set; }
public string name { get; set; }
}

public class Item
{
public string id { get; set; }
public string skuSellerId { get; set; }
public string name { get; set; }
public decimal? salePrice { get; set; }
public bool sent { get; set; }
public Freight1 freight { get; set; }
public Giftwrap giftWrap { get; set; }
public Promotion[] promotions { get; set; }
}

public class Freight1
{
public int? actualAmount { get; set; }
public int? chargedAmount { get; set; }
public int? transitTime { get; set; }
public int? crossDockingTime { get; set; }
public string additionalInfo { get; set; }
public string type { get; set; }
public DateTime? scheduledAt { get; set; }
public string scheduledPeriod { get; set; }
}

public class Giftwrap
{
public bool available { get; set; }
public int? value { get; set; }
public bool messageSupport { get; set; }
public Giftcard giftCard { get; set; }
}

public class Giftcard
{
public string from { get; set; }
public string to { get; set; }
public string message { get; set; }
}

public class Promotion
{
public string id { get; set; }
public string name { get; set; }
public int? amount { get; set; }
public string type { get; set; }
}

public class Tracking
{
public Item1[] items { get; set; }
public string controlPoint { get; set; }
public string description { get; set; }
public DateTime? occurredAt { get; set; }
public string url { get; set; }
public string number { get; set; }
public string id { get; set; }
public string sellerDeliveryId { get; set; }
public string cte { get; set; }
public Carrier carrier { get; set; }
public Invoice invoice { get; set; }
}

public class Carrier
{
public string name { get; set; }
public string cnpj { get; set; }
}

public class Invoice
{
public string cnpj { get; set; }
public string number { get; set; }
public string serie { get; set; }
public DateTime? issuedAt { get; set; }
public string accessKey { get; set; }
public string linkXml { get; set; }
public string linkDanfe { get; set; }
}

public class Item1
{
public string id { get; set; }
public string href { get; set; }
}


faco assim
Pedidos Ped = serializer.Deserialize<Pedidos>(ret);
deserialozi nela como pegar os dados que estao dentro de pedido . ja tentei varias coisa e nada se alguem puder me auxiliar
fico grato
KERPLUNK 06/04/2016 17:01:18
#460625
Não entendi o que você quer. Você quer desserializar ou percorrer algum ítem, que aliás, sugiro usar List<T> ao invés de array.
JOAOBENEVIDES 06/04/2016 17:03:26
#460628
queria percorrer os itens
KERPLUNK 06/04/2016 17:18:20
#460631
Resposta escolhida
Então o que tem a serialização à haver? Para percorrer é simples e eu ensino em vários dos vídeos do meu canal:

forceach ordem in ped.Orders
{
MessageBox.Show(ordem.site); //aqui, faça o que quiser com o objeto [Ô]ordem[Ô] que conterá uma ordem com suas propriedades.
}
Tópico encerrado , respostas não são mais permitidas