Ejemplo n.º 1
0
        protected void gvComments_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int commentID = Convert.ToInt32(e.CommandArgument);

            CarrierComment comment = null;

            if (e.CommandName == "DoEdit")
            {
                ViewState["CarrierCommentID"] = e.CommandArgument.ToString();

                comment = CarrierCommentManager.Get(commentID);

                if (comment != null)
                {
                    showEditPanel();

                    txtComment.Text = comment.CommentText;
                }
            }
            else if (e.CommandName == "DoDelete")
            {
                CarrierCommentManager.Delete(commentID);

                showGridPanel();

                bindComments();
            }
        }
Ejemplo n.º 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            int commentID = 0;

            Page.Validate("Comment");
            if (!Page.IsValid)
            {
                return;
            }

            CarrierComment comment = null;

            // carrier being edited
            commentID = Convert.ToInt32(ViewState["CarrierCommentID"]);

            if (commentID == 0)
            {
                comment = new CarrierComment();

                comment.CarrierID = carrierID;

                comment.CommentDate = DateTime.Now;

                comment.Status = true;
            }

            comment.CommentText = txtComment.Text.Trim();

            comment.UserId = Core.SessionHelper.getUserId();



            try {
                CarrierCommentManager.Save(comment);

                bindComments();

                showGridPanel();

                lblMessage.Text     = "Comment saved successfully.";
                lblMessage.CssClass = "ok";
            }
            catch (Exception ex) {
                lblMessage.Text     = "Comment not saved successfully.";
                lblMessage.CssClass = "error";

                Core.EmailHelper.emailError(ex);
            }
        }
Ejemplo n.º 3
0
        private void bindComments()
        {
            gvComments.DataSource = CarrierCommentManager.GetAll(carrierID);

            gvComments.DataBind();
        }