/// <summary> /// Save click Handler. /// Saves the comment to SharePoint list and close the popup window. /// </summary> /// <param name="sender">Sender object.</param> /// <param name="e">EventArg</param> protected void btnSave_Click(object sender, EventArgs e) { TreeNodeSelection objTreeNodeSelection = null; UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); UserDetails objUserDetails = null; bool blnUpdateSuccess = false; try { objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; if (objTreeNodeSelection != null) { strPageID = objTreeNodeSelection.PageID; } strUserName = GetUserName(); objUserDetails = objUserRegistrationBLL.GetUserDesicipline(strParentSiteURL, strUserName, USERLIST); if (objUserDetails != null) { strDiscipline = objUserDetails.Discipline; strDisciplineID = objUserDetails.DisciplineID; } /// Save the Comments to the DWB Comment list and refresh the parent window PageCommentsDetails objPageCommentsDetails = new PageCommentsDetails(); objPageCommentsDetails.Comments = txtPageComments.Text.Trim(); objPageCommentsDetails.Discipline = strDiscipline; objPageCommentsDetails.DisciplineID = strDisciplineID; objPageCommentsDetails.PageID = strPageID; objPageCommentsDetails.UserName = strUserName; if (chkShareComments.Checked) { objPageCommentsDetails.ShareComments = STATUSTERMINATED; } else { objPageCommentsDetails.ShareComments = STATUSACTIVE; } ListEntry objListEntry = new ListEntry(); objListEntry.PageComments = objPageCommentsDetails; blnUpdateSuccess = UpdateListEntry(objListEntry, PAGESCOMMENTSLIST, CHAPTERPAGESMAPPINGAUDITLIST, PAGECOMMENTS, AUDITACTIONCOMMENTADDED); if (blnUpdateSuccess) { txtPageComments.Text = string.Empty; } } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Sends server control content to a provided <see cref="T:System.Web.UI.HtmlTextWriter"></see> object, which writes the content to be rendered on the client. /// </summary> /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"></see> object that receives the server control content.</param> protected override void Render(HtmlTextWriter writer) { pnlComment.Visible = false; if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && !((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsChapterSelected && !((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsBookSelected) { TreeNodeSelection objTreeNodeSelection = null; objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; if (objTreeNodeSelection != null) { strPageID = objTreeNodeSelection.PageID; } try { strUserName = GetUserName(); UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); UserDetails objUserDetails = objUserRegistrationBLL.GetUserDesicipline(strParentSiteURL, strUserName, USERLIST); if (objUserDetails != null) { strDiscipline = objUserDetails.Discipline; strDisciplineID = objUserDetails.DisciplineID; } if (ShowButton(WELLBOOKVIEWERCONTROLCOMMENTS, string.Empty, string.Empty, string.Empty, string.Empty)) { pnlComment.Visible = true; /// Get the Comments for selected Page, User Discipline GetPageComments(strPageID, strDiscipline, strUserName); } } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } base.Render(writer); } }