コード例 #1
0
        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()));
        }
コード例 #2
0
        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) ;
            }
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
ファイル: Posts.cs プロジェクト: ricardochaves/MasterControl
 public Posts(Meli meli, NSAADMEntities nsaadm)
 {
     m = meli;
     n = nsaadm;
 }
コード例 #5
0
ファイル: LerML.cs プロジェクト: ricardochaves/MasterControl
 public LerML(Meli meli)
 {
     m = meli;
 }
コード例 #6
0
ファイル: LerML.cs プロジェクト: ricardochaves/MasterControl
 public LerML(long ClientId, string ClientSecret)
 {
     m = new Meli(ClientId, ClientSecret);
 }