protected void Page_Load(object sender, EventArgs e) { NSAADMEntities n; ConstruirEF cf = new ConstruirEF(); n = (NSAADMEntities)cf.RecuperaEntity(Entities.MercadoLivre); //***************************************** Request.InputStream.Position = 0; System.IO.StreamReader str = new System.IO.StreamReader(Request.InputStream); CallBackTemp c = new CallBackTemp(); c = JsonConvert.DeserializeObject<CallBackTemp>(str.ReadToEnd()); //***************************************** try { CallBackML teste = (from p in n.CallBackMLs where p.resource == c.resource select p).First(); } catch (Exception) { CallBackML call = new CallBackML(); call.received = c.received; call.resource = c.resource; call.sent = c.sent; call.topic = c.topic; call.userID = c.user_id; n.CallBackMLs.AddObject(call); n.SaveChanges(); if (c.topic == "questions") { ControlaMeli cm = new ControlaMeli(); ControlaPerguntas cp = new ControlaPerguntas(); cp.GravaPergunta(cm.RetonarQuestion(c.resource), cm.n); } if (c.topic == "orders") { ControlaMeli cm = new ControlaMeli(); ControlaOrdens co = new ControlaOrdens(); ConverterObjetoMLparaEF conv = new ConverterObjetoMLparaEF(); co.GravaOrdem(cm.RetornaOrder(c.resource),cm.n); } } }
protected void Button9_Click(object sender, EventArgs e) { try { ControlaMeli cm = new ControlaMeli(); ControlaOrdens co = new ControlaOrdens(); ConverterObjetoMLparaEF conv = new ConverterObjetoMLparaEF(); co.GravaOrdem(cm.RetornaOrder("/orders/779622738"), cm.n); } catch (Exception ex) { throw new Exception("Erro no Button9_Click.", ex); } }