/// <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> /// Gets the details for selected ID. /// </summary> /// <param name="selectedID">The selected ID.</param> /// <param name="listName">Name of the list.</param> /// <param name="pageType">Type of the page.</param> /// <returns></returns> protected DWBDataObjects.ListEntry GetDetailsForSelectedID(string selectedID, string listName, string pageType) { string strQueryString; DWBDataObjects.ListEntry objListEntry = null; try { strQueryString = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + selectedID + "</Value></Eq></Where>"; switch (pageType) { case MASTERPAGE: { objMasterBLL = new MasterPageBLL(); objListEntry = objMasterBLL.SetMasterPageDetail(strParentSiteURL, listName, strQueryString); break; } case TEMPLATE: { objTemplateBLL = new TemplateDetailBLL(); objListEntry = objTemplateBLL.GetTemplateDetail(strParentSiteURL, listName, strQueryString); break; } case WELLBOOK: { objWellBookBLL = new WellBookBLL(); objListEntry = objWellBookBLL.GetWellBookDetail(strParentSiteURL, listName, strQueryString); break; } case CHAPTER: { objChapterBLL = new ChapterBLL(); objListEntry = objChapterBLL.SetChapterDetail(strParentSiteURL, listName, strQueryString); break; } case USERREGISTRATION: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); objListEntry = objUserRegistrationBLL.GetUserDetails(strParentSiteURL, selectedID, listName); break; } case TEAMREGISTRATION: case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strParentSiteURL, selectedID, listName); break; } } return objListEntry; } catch { throw; } }
/// <summary> /// Updates the list entry. /// </summary> /// <param name="listEntry">The list entry.</param> /// <param name="listName">Name of the list.</param> /// <param name="pageType">Type of the page.</param> /// <param name="actionPerformed">The action performed.</param> /// <returns></returns> protected bool UpdateListEntry(DWBDataObjects.ListEntry listEntry, string listName, string pageType, string actionPerformed) { bool blnUpdateSuccess = false; strUserName = GetUserName(); switch (pageType) { case USERREGISTRATION: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); blnUpdateSuccess = objUserRegistrationBLL.UpdateListEntry(strParentSiteURL, listEntry, listName, actionPerformed); break; } case USERPRIVILEGES: { UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL(); blnUpdateSuccess = objUserRegistrationBLL.UpdatePrivileges(strParentSiteURL, listEntry, listName, actionPerformed); break; } case TEAMREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); blnUpdateSuccess = objTeamStaffRegistrationBLL.UpdateTeamListEntry(strParentSiteURL, listEntry, listName, actionPerformed); break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objTeamStaffRegistrationBLL.UpdateStaffsInTeam(strParentSiteURL, listEntry, listName); blnUpdateSuccess = true; break; } case STAFFRANK: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); blnUpdateSuccess = objTeamStaffRegistrationBLL.UpdateStaffsRank(strParentSiteURL, listEntry, listName); break; } } return blnUpdateSuccess; }
/// <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); } }