public void GravaPergunta(ML_Question q, NSAADMEntities n)
        {
            try
            {
                var i = (from p in n.ML_Question where p.id == q.id select p).First();

                i.Answer_date_created = q.Answer_date_created;
                i.Answer_status = q.Answer_status;
                i.Answer_text = q.Answer_text;
                i.answered_questions = q.answered_questions;

                n.SaveChanges();

            }
            catch (Exception ex)
            {

                throw new Exception("Erro na rotina GravaPergunta(ML_Question q, NSAADMEntities n)", ex);
            }
        }
Ejemplo n.º 2
0
        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);
            }
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the ML_Question EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToML_Question(ML_Question mL_Question)
 {
     base.AddObject("ML_Question", mL_Question);
 }
 /// <summary>
 /// Create a new ML_Question object.
 /// </summary>
 /// <param name="id">Initial value of the id property.</param>
 public static ML_Question CreateML_Question(global::System.Decimal id)
 {
     ML_Question mL_Question = new ML_Question();
     mL_Question.id = id;
     return mL_Question;
 }
        public ML_Question ConverteQuestion(Question q)
        {
            ML_Question mlq = new ML_Question();

            if (q.answer != null)
            {
                mlq.Answer_date_created = q.answer.date_created;
                mlq.Answer_status = q.answer.status;
                mlq.Answer_text = q.answer.text;
            }

            if (q.from != null)
            {
                mlq.id_from = q.from.id;
                mlq.answered_questions = q.from.answered_questions;
            }
            mlq.date_created = q.date_created;
            mlq.id = q.id;
            if (q.item_id != null)
            {
                mlq.item_id = q.item_id;
            }
            mlq.seller_id = q.seller_id;
            mlq.status = q.status;
            mlq.text = q.text;
            mlq.id_question = q.id;

            return mlq;
        }