protected void Button7_Click(object sender, EventArgs e) { Session["pagina"] = "InicioML.aspx"; m = new Meli(AplicacaoML.RetornaIDAplicacaoML(), AplicacaoML.RetornaKeyAplicacaoML()); Response.Redirect(m.GetAuthUrl(AplicacaoML.RetornaURLLoginAplicacaoML())); }
protected void Page_Load(object sender, EventArgs e) { try { Meli m; string pg; string codigo = Request.QueryString["code"]; if ((string)Session["pagina"] != null) { pg = (string)Session["pagina"]; } else { pg = "InicioML.aspx"; } if (Session["M"] == null) { //m = new Meli(5971480328026573, "HvQavElFhrbqlGCaTMWIrtQklsqnwlIM"); m = new Meli(AplicacaoML.RetornaIDAplicacaoML(), AplicacaoML.RetornaKeyAplicacaoML()); } else { m = (Meli)Session["M"]; } string redirectUrl = AplicacaoML.RetornaURLLoginAplicacaoML();// ServidorWeb.Properties.Settings.Default.URL_Login; m.Authorize(codigo, redirectUrl); Session["M"] = m; NSAADMEntities n; ConstruirEF cf = new ConstruirEF(); n = (NSAADMEntities)cf.RecuperaEntity(Entities.MercadoLivre); DadosML d; d = (from p in n.DadosMLs where p.id == "Meli" select p).First(); d.ClientSecret = AplicacaoML.RetornaKeyAplicacaoML(); // m.ClientSecret; d.ClientId = m.ClientId.ToString(); d.AccessToken = m.AccessToken; d.RefreshToken = m.RefreshToken; n.SaveChanges(); Response.Redirect(pg, false); } catch (Exception ex) { throw new Exception ("Erro no load do login.aspx", ex) ; } }
public ControlaMeli() { try { ConstruirEF cf = new ConstruirEF(); n = (NSAADMEntities)cf.RecuperaEntity(Entities.MercadoLivre); d = (from p in n.DadosMLs where p.id == "Meli" select p).First(); m = new Meli(Convert.ToInt64(d.ClientId), d.ClientSecret, d.AccessToken, d.RefreshToken); } catch (Exception ex) { throw new Exception(String.Format("Erro no New do ControlaMeli"), ex); } }
public Posts(Meli meli, NSAADMEntities nsaadm) { m = meli; n = nsaadm; }
public LerML(Meli meli) { m = meli; }
public LerML(long ClientId, string ClientSecret) { m = new Meli(ClientId, ClientSecret); }