Example #1
0
        /// <summary>
        /// Se encarga de persistir los datos.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void PerformAnswer(object sender, EventArgs e)
        {
            try
            {
                //Una implementación no muy buena
                int id = Convert.ToInt32(SessionUtilHelper.GetIdFromSession(Session));
                ItemCommentManager itemCommentManager = new ItemCommentManager();
                ItemComment        itemommentRef      = itemCommentManager.Get(id);

                ItemComment itemComment = new ItemComment();
                itemComment.Resource          = itemommentRef.Resource;
                itemComment.SentenceReference = itemommentRef;
                UCFormInquiry.PopulateModel(itemComment);

                bool success = itemCommentManager.Save(itemComment);

                if (!success && itemCommentManager.HasErrors)
                {
                    Alert.Show("Error", itemCommentManager.ErrorDescription);
                }
                else
                {
                    LoadGridView();
                }
            } catch (Exception exception)
            {
                Alert.Show("Excepción", exception.Message);
            }
            SessionUtilHelper.FlushId(Session);
        }
Example #2
0
        /// <summary>
        /// Muestra el formulario para realizar responder la pregunta.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void PerformGenericAction(object sender, UbiquicityEventArg e)
        {
            int id = Convert.ToInt32(e.TheObject.ToString());
            ItemCommentManager itemCommentManager = new ItemCommentManager();
            ItemComment        itemComment        = itemCommentManager.Get(id);

            if (itemComment == null && itemCommentManager.HasErrors)
            {
                Alert.ShowUP("Error", itemCommentManager.ErrorDescription);
            }
            else
            {
                //Si existe la referencia, entonces a sido respondida
                if (itemComment.SentenceReference == null)
                {
                    UCFormInquiry.CleanForm();
                    UCFormInquiry.FillForm(itemComment);
                    SessionUtilHelper.KeepInSession(id.ToString(), Session);
                    ScriptManager.RegisterStartupScript(upUCModalForm, upUCModalForm.GetType(), "openModalCreate", "$('#modalInquiry').modal('show');", true);
                    upUCModalForm.Update();
                }
                else
                {
                    Alert.ShowUP("Respuesta", "Esta pregunta ya ha sido respondida; no hay acciones disponibles.");
                }
            }
        }
Example #3
0
 protected override void PageLoad(object sender, EventArgs e)
 {
     GridView = UCcrudGrid;
     GridView.ShowGenericActionButton("Acción");
     GridView.HideEditButton();
     GridView.HideNewButton();
     Manager = new ItemCommentManager();
 }
Example #4
0
        /// <summary>
        /// Recupera todos los comentarios para el producto cuyo detalle se quiere ver.
        /// </summary>
        /// <param name="map"></param>
        /// <returns></returns>
        private List <ItemComment> LoadComments(int id)
        {
            try
            {
                ItemCommentManager commentManager = new ItemCommentManager();
                itemRepeater.DataSource = commentManager.GetByResource(id);
                itemRepeater.DataBind();
                commentInput.InnerText = "";
            }
            catch (Exception exception)
            {
                //((front) Master).Alert.Show("Exception", exception.Message);
            }

            return(null);
        }
Example #5
0
        /// <summary>
        /// Crea un comentario.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnComentar_Click(object sender, EventArgs e)
        {
            try
            {
                ItemCommentManager commentManager = new ItemCommentManager();

                ItemComment itemComment = new ItemComment();
                itemComment.Sentence    = commentInput.InnerText;
                itemComment.User        = (User)Session["SessionCreated"];
                itemComment.Resource.Id = Convert.ToInt32(((Button)sender).CommandArgument);

                commentManager.Save(itemComment);
                LoadComments(Convert.ToInt32(SessionUtilHelper.GetIdFromSession(Session)));
                //upItemShop.Update();
            }
            catch (Exception exception)
            {
                //TODO - agregar control de error
                //((front)Master).Alert.Show("Exception", exception.Message);
            }
        }