예제 #1
0
        private void Page_Load(System.Object sender, System.EventArgs e)
        {
            try {
                if ((Request.Params["ItemId"] != null))
                {
                    ItemId = Int32.Parse(Request.Params["ItemId"]);
                }
                else
                {
                    ItemId = Convert.ToInt32(System.DBNull.Value);
                }


                if (Page.IsPostBack == false)
                {
                    cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure You Wish To Delete This Comment ?');");


                    if (!Null.IsNull(ItemId))
                    {
                        RepositoryCommentController objRepositoryComments = new RepositoryCommentController();
                        RepositoryCommentInfo       objComment            = objRepositoryComments.GetSingleRepositoryComment(ItemId, ModuleId);

                        if ((objComment != null))
                        {
                            txtName.Text    = objComment.CreatedByUser.ToString();
                            txtComment.Text = objComment.Comment.ToString();
                        }
                    }
                    else
                    {
                        Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true);
                    }
                }
                else
                {
                    cmdDelete.Visible = false;
                }
            } catch (Exception exc) {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
예제 #2
0
        private void cmdUpdate_Click(object sender, EventArgs e)
        {
            try {
                // Only Update if the Entered Data is Valid

                if (Page.IsValid == true)
                {
                    RepositoryCommentController objRepositoryComments = new RepositoryCommentController();
                    RepositoryCommentInfo       objComment            = objRepositoryComments.GetSingleRepositoryComment(ItemId, ModuleId);
                    DateTime dateNow = System.DateTime.Now;

                    objComment.Comment       = txtComment.Text + "<br>comment edited by admin -- " + dateNow.ToString("ddd, dd MMM yyyy hh:mm:ss tt G\\MT");
                    objComment.CreatedByUser = txtName.Text;

                    objRepositoryComments.UpdateRepositoryComment(ItemId, ModuleId, objComment.CreatedByUser, objComment.Comment);

                    // Redirect back to the portal home page
                    Response.Redirect(DotNetNuke.Common.Globals.NavigateURL(), true);
                }
                //Module failed to load
            } catch (Exception exc) {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }