void Orcamento_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e) { try { if (!string.IsNullOrEmpty(e.Result)) { JArray jsonArray_Item = JArray.Parse(e.Result); for (int x = 0; jsonArray_Item.Count() > x; x++) { Orcamento orcamento = new Orcamento(); orcamento.IdOrcamento = jsonArray_Item[x].Value<int>("IdOrcamento"); orcamento.idCliente = jsonArray_Item[x].Value<int>("idCliente"); orcamento.IdProduto = jsonArray_Item[x].Value<int>("IdProduto"); orcamento.NomeProduto = jsonArray_Item[x].Value<string>("NomeProduto"); orcamento.ValorProduto = jsonArray_Item[x].Value<decimal>("ValorProduto"); orcamento.Servico = jsonArray_Item[x].Value<string>("Servico"); orcamento.ValorServico = jsonArray_Item[x].Value<decimal>("ValorServico"); orcamento.ValorTotal = jsonArray_Item[x].Value<decimal>("ValorTotal"); if (Verificacao(orcamento)) { OrcamentoDB.Create(orcamento); } } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Orçamento", MessageBoxButton.OK); } }
public bool Verificacao(Orcamento pObjeto) { var verf = OrcamentoDB.GetOne(pObjeto.IdOrcamento); if (verf == null) { // return true; } else { return false; } }