Exemple #1
0
        protected void btnSaveCustomField_Click(object sender, ImageClickEventArgs e)
        {
            AWAPI_Data.Data.awBlogPostComment comment = new AWAPI_Data.Data.awBlogPostComment();
            Int64 id = 0;

            try
            {
                comment.title       = _title.Text;
                comment.description = _description.Text;
                comment.status      = Convert.ToInt32(_status.SelectedValue);
                comment.firstName   = _firstName.Text;
                comment.lastName    = _lastName.Text;
                comment.email       = _email.Text;
                if (!String.IsNullOrEmpty(_userId.Text))
                {
                    comment.userId = Convert.ToInt64(_userId.Text);
                }
                comment.userName = _userName.Text;

                if (_id.Text.Trim() == "")  //add new
                {
                    id = _blogLib.AddBlogPostComment(PostId,
                                                     comment.userId,
                                                     comment.title,
                                                     comment.description,
                                                     comment.email,
                                                     comment.userName,
                                                     comment.firstName,
                                                     comment.lastName,
                                                     comment.status);
                }
                else  //Update
                {
                    id = Convert.ToInt64(_id.Text);
                    _blogLib.UpdateBlogPostComment(id,
                                                   comment.title,
                                                   comment.description,
                                                   comment.email,
                                                   comment.userName,
                                                   comment.firstName,
                                                   comment.lastName,
                                                   comment.status);
                }
                _id.Text = id.ToString();

                PopulateComments();
                ShowHideControls(true);

                App_Code.Misc.WriteMessage(_msg, "Comment has been saved.");
            }
            catch (Exception ex)
            {
                App_Code.Misc.WriteMessage(App_Code.Misc.MessageType.ERROR, _msg, ex.Message);
            }
        }
Exemple #2
0
        void PopulateComment(long commentId)
        {
            ResetControls();
            AWAPI_Data.Data.awBlogPostComment comment = _blogLib.GetBlogPostComment(commentId);
            if (comment == null)
            {
                return;
            }

            _id.Text              = commentId.ToString();
            _title.Text           = comment.title;
            _description.Text     = comment.description;
            _status.SelectedValue = comment.status.ToString();
            _firstName.Text       = comment.firstName;
            _lastName.Text        = comment.lastName;
            _email.Text           = comment.email;
            _userId.Text          = comment.userId.ToString();
            _userName.Text        = comment.userName;

            ShowHideControls(true);
        }