Example #1
0
        /// <summary>
        /// Crea un comentario.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void PerformComment(object sender, EventArgs e)
        {
            try
            {
                int invoiceItemId = Convert.ToInt32(SessionUtilHelper.GetIdFromSession(Session));

                ItemCommentSupportManager commentManager     = new ItemCommentSupportManager();
                InvoiceItemSupport        invoiceItemSupport = new InvoiceItemSupport();

                invoiceItemSupport.InvoiceItem.Id = invoiceItemId;
                ItemCommentSupport itemCommentSupport = new ItemCommentSupport();

                itemCommentSupport.Sentence   = commentInput.InnerText;
                itemCommentSupport.User       = SessionHelper.GetUser();
                itemCommentSupport.IsOperator = false;
                itemCommentSupport.Date       = DateTime.Now;
                invoiceItemSupport.Comments.Add(itemCommentSupport);

                commentManager.Save(invoiceItemSupport);
                LoadCommentsSupport(invoiceItemId);
            }
            catch (Exception exception)
            {
                //TODO - agregar control de error
                //((front)Master).Alert.Show("Exception", exception.Message);
            }
        }
        private ItemCommentSupport ConvertToModel(DataRow data)
        {
            ItemCommentSupport itemComment = new ItemCommentSupport();

            itemComment.Id            = int.Parse(data["id"].ToString());
            itemComment.Sentence      = data["sentence"].ToString();
            itemComment.Date          = Convert.ToDateTime(data["date"]);
            itemComment.User.Id       = int.Parse(data["userid"].ToString());
            itemComment.IsOperator    = Convert.ToBoolean(data["isOperator"]);
            itemComment.IsClosed      = Convert.ToBoolean(data["isClosed"]);
            itemComment.InvoiceItemId = int.Parse(data["invoiceItemid"].ToString());

            return(itemComment);
        }
        public bool Save(InvoiceItemSupport invoiceItemSupport)
        {
            ItemCommentSupport itemCommentSupport = invoiceItemSupport.Comments[0];

            base.Save(itemCommentSupport);

            Dal       dal   = new Dal();
            Hashtable table = new Hashtable();

            table.Add("@messageId", itemCommentSupport.Id);
            table.Add("@isOperator", itemCommentSupport.IsOperator);
            table.Add("@invoiceItemId", invoiceItemSupport.InvoiceItem.Id);

            return(dal.Write(table, "spWriteItemCommentSupport") > 0);
        }
 private bool IsValid(ItemCommentSupport itemCommentSupport)
 {
     return(VLetterNumbers(itemCommentSupport.Sentence, 1, 250, "Comentario", "IsValid"));
 }