protected void Page_Load(object sender, EventArgs e)
        {
            cm = new ControlaMeli();

            var a = (from p in cm.n.ML_Order where !p.ML_FeedbackSeller.Any(x => x.rating != "positive") select p);

            GridView1.DataSource = a;
            GridView1.DataBind();

            Label1.Text = (a.Sum(x => x.total_amount) * 0.01).ToString();
        }
        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 Page_Load(object sender, EventArgs e)
        {
            cm = new ControlaMeli();

            TrataPerguntasDoCallBack();
            cb.LimpaCallBack();

            var x = cp.RetonaPerguntas(TipoRetonaPerguntas.NAORESPONDIDA, cm.n);

            var a = (from p in x select new { p.id_question, p.text });

            GridView1.DataSource = a;
            GridView1.DataBind();
        }
        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);
            }
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            ControlaMeli cm = new ControlaMeli();
            ConverterObjetoMLparaEF conv = new ConverterObjetoMLparaEF();

            var x = (from p in cm.n.CallBackMLs where p.topic == "questions" select p);

            foreach (CallBackML c in x.ToList())
            {
                if (c.topic == "questions")
                {

                    Question q = cm.RetonarQuestion(c.resource);

                    ControlaPerguntas p = new ControlaPerguntas();
                    p.GravaPergunta(q, cm.n);

                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {

                cm = new ControlaMeli();
                codigo = Convert.ToDecimal(Request.QueryString["code"]);

                TextBox2.Text = " Não deixe de ver nossos outros produtos. Muito Obrigado.";

                mlq = cp.RetornaPergunta(codigo, cm.n);

                txtPergunta.Text = mlq.text;

                CasdastraExibiItem();

                try
                {
                    var y = cm.RetornaUsuario( mlq.id_from.ToString());
                    TextBox1.Text = "Olá " + y.nickname + ". ";
                }
                catch (Exception)
                {

                    TextBox1.Text = "Olá amigo, ";
                }

                decimal[] ids = {codigo};

                var OutrasPerguntas = cp.RetonaPerguntas(Convert.ToDecimal(mlq.id_from), cm.n);
                var a = (from p in OutrasPerguntas where !ids.Contains(Convert.ToDecimal(p.id_question)) select new { p.text, p.Answer_text });
                GridView1.DataSource = a;
                GridView1.DataBind();

            }
            catch (Exception ex)
            {

                throw new Exception("Erro na rotina Page_Load", ex);
            }
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         cm = new ControlaMeli();
     }
     catch (Exception ex)
     {
         throw new Exception("Erro no Load do ImportaVendasML.aspx.", ex);
     }
 }