/// <summary> /// Added By Gopinath /// Date : 02-11-2010 /// Reason : Loading the page with populated drodowns on Init method. /// </summary> protected void Page_Init() { try { #region On First Post back if (!Page.IsPostBack) { //Modified By: Gopinath //Date : 04/11/2010 //Reason : Code modified to check the BookId and ChapterId from Webpart session Properties //Fetch bookId from WebPart session when book selected if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null) { objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; LoadStoryBoardInfo(objTreeNodeSelection); chkPrintMyPagesOnly.Attributes.Add("onclick", "javascript:return checkPrintMyPages('" + chkPrintMyPagesOnly.ClientID + "','" + rblIncludeFilter.ClientID + "' );"); cboPageName.Attributes.Add("onChange", "javascript:return AutoSelectDisciplinePerPageName();"); } } #endregion On First Post back } #region Exception Block catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } #endregion Exception Block }
/// <summary> /// Sets the body web part property. /// </summary> /// <param name="objRadTreeNode">The obj RAD tree node.</param> private void SetBodyWebPartProperty(RadTreeNode objRadTreeNode) { objTreeNodeValues = new TreeNodeSelection(); if (objRadTreeNode != null) { if (objRadTreeNode.Level == 0) { Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETAB_JS_KEY, HIDETAB_JS); objTreeNodeValues.IsBookSelected = true; objTreeNodeValues.BookID = objRadTreeNode.Value; } else if (objRadTreeNode.Level == 1) { Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETAB_JS_KEY, HIDETAB_JS); objTreeNodeValues.IsChapterSelected = true; objTreeNodeValues.ChapterID = objRadTreeNode.Value; objTreeNodeValues.BookID = objRadTreeNode.ParentNode.Value; } else { if (string.Equals(objRadTreeNode.ToolTip, CONNECTION_TYPE3_PAGES)) { objTreeNodeValues.IsTypeIIISelected = true; objTreeNodeValues.ChapterID = objRadTreeNode.ParentNode.Value; objTreeNodeValues.BookID = objRadTreeNode.ParentNode.ParentNode.Value; objTreeNodeValues.PageID = objRadTreeNode.Value; } else if (string.Equals(objRadTreeNode.ToolTip, CONNECTION_TYPE2_PAGES)) { objTreeNodeValues.IsTypeIISelected = true; objTreeNodeValues.ChapterID = objRadTreeNode.ParentNode.Value; objTreeNodeValues.BookID = objRadTreeNode.ParentNode.ParentNode.Value; objTreeNodeValues.PageID = objRadTreeNode.Value; } else { objTreeNodeValues.IsTypeISelected = true; objTreeNodeValues.ChapterID = objRadTreeNode.ParentNode.Value; objTreeNodeValues.BookID = objRadTreeNode.ParentNode.ParentNode.Value; objTreeNodeValues.PageID = objRadTreeNode.Value; objTreeNodeValues.ReportName = objRadTreeNode.ToolTip; } } } HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES] = objTreeNodeValues; }
/// <summary> /// Raises the webpart Onload event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"></see> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { // base.OnLoad(e); EnsureChildControls(); try { pnlWellBookTreeView = new Panel(); pnlWellBookTreeView.ID = "Panel1"; this.Controls.Add(pnlWellBookTreeView); trvWellBookViewer = new RadTreeView(); trvWellBookViewer.ID = "RadTreeView1"; trvWellBookViewer.CheckBoxes = true; // if (this.Page.Request.Params[EVENTTARGET] == null || (!this.Page.Request.Params[EVENTTARGET].ToLowerInvariant().Equals("customisechaptersinsession"))) // { LoadRootNodes(trvWellBookViewer, TreeNodeExpandMode.ServerSideCallBack); // } trvWellBookViewer.NodeExpand += new RadTreeViewEventHandler(treeView_NodeExpand); trvWellBookViewer.NodeClick += new RadTreeViewEventHandler(treeView_NodeClick); trvWellBookViewer.CheckAllNodes(); trvWellBookViewer.TriStateCheckBoxes = true; trvWellBookViewer.CheckChildNodes = true; pnlWellBookTreeView.Controls.Add(trvWellBookViewer); this.Controls.Add(pnlWellBookTreeView); if (!Page.IsPostBack) { objTreeNodeValues = new TreeNodeSelection(); if (trvWellBookViewer != null) { if (trvWellBookViewer.FindNodeByValue(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]) != null) { trvWellBookViewer.FindNodeByValue(HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]).Selected = true; } if (trvWellBookViewer.SelectedNode != null && (trvWellBookViewer.SelectedNode.Level == 0 || trvWellBookViewer.SelectedNode.Level == 1)) { Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETAB_JS_KEY, HIDETAB_JS); } } objTreeNodeValues.IsBookSelected = true; objTreeNodeValues.BookID = HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]; HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES] = objTreeNodeValues; } ExpandChapterNode(); this.Page.Title = WELLBOOK_VIEWER_TITLE; } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// Overriding Render is removed since RadListBox creates error in case of Render overriding. /// Functionlities achieved in Render method in earlier releases are moved to OnPreRender /// <summary> /// Raises the <see cref="E:System.Web.UI.Control.PreRender"></see> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs"></see> object that contains the event data.</param> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); btnPrint.OnClientClick = base.RegisterJavaScript(); if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && ((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsBookSelected) { pnlTemplate.Visible = true; objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; strWellBookId = objTreeNodeSelection.BookID; btnBatchImport.OnClientClick = "return openBatchImport('" + strWellBookId + "');"; LoadWellBookData(); } else { pnlTemplate.Visible = false; } }
/// <summary> /// Signs Off book or Cancel Signs off the book. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSignOff_Click(object sender, EventArgs e) { objWellBookBLL = new WellBookBLL(); try { if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && ((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsBookSelected) { objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; strWellBookId = objTreeNodeSelection.BookID; } string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + strWellBookId + "</Value></Eq></Where>"; /// Get the Book Details for the selected Book Id and populate the controls with data objListEntry = GetDetailsForSelectedID(strWellBookId, DWBBOOKLIST, WELLBOOK); if (objListEntry != null && objListEntry.WellBookDetails != null) { #region DREAM 4.0 - eWB 2.0 - Customise Chapters strWellBookName = objListEntry.WellBookDetails.Title; #endregion if (objListEntry.WellBookDetails.SignOffStatus.ToLowerInvariant().CompareTo(STATUSSIGNEDOFF) == 0) { objWellBookBLL.ChangeSignOffStatus(strParentSiteURL, STATUSACTIVE, DWBBOOKLIST, GetUserName(), strWellBookId, AUDITACTIONUNSIGNEDOFF); } else { objWellBookBLL.ChangeSignOffStatus(strParentSiteURL, STATUSTERMINATED, DWBBOOKLIST, GetUserName(), strWellBookId, AUDITACTIONSIGNEDOFF); } } } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } finally { this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE); } }
/// <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(System.Web.UI.HtmlTextWriter writer) { btnPrint.OnClientClick = base.RegisterJavaScript(); if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && ((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsChapterSelected) { objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; strSelectedID = objTreeNodeSelection.ChapterID; int.TryParse(objTreeNodeSelection.BookID, out intBookID); try { objListEntry = GetDetailsForSelectedID(strSelectedID, DWBCHAPTERLIST, CHAPTER); if (objListEntry != null) { BindUIControls(); } } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); lblException.Text = webEx.Message; lblException.Visible = true; } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } base.Render(writer); } }
/// <summary> /// Added by Gopinath /// Date :25/11/2010 /// Reason : For code review comment, split the code and extracted as method. /// </summary> /// <param name="objTreeNodeSelection">TreeNodeSelection</param> private void LoadStoryBoardInfo(TreeNodeSelection objTreeNodeSelection) { #region Check for User selection either Book or Chapter //For Book if (objTreeNodeSelection.IsBookSelected) { strWellBookId = objTreeNodeSelection.BookID; if (string.IsNullOrEmpty(strWellBookId)) return; EnablePrintMyPagesForBook(strWellBookId); //Fill Page Name and Discipline dropdowns PopulateDropDowns(strWellBookId); //If book and chapter selected Type is true. If selects Page its false blnType = true; } //For Chapter else if (objTreeNodeSelection.IsChapterSelected) { strWellBookId = objTreeNodeSelection.BookID; strWellChapterId = objTreeNodeSelection.ChapterID; if (string.IsNullOrEmpty(strWellChapterId)) return; EnablePrintMyPagesForChapter(strWellBookId); //Fill Page Name and Discipline dropdowns PopulateDropDowns(strWellBookId); //If book and chapter selected Type is true. If selects Page its false blnType = true; } //For Page else { pnlPrintMyPages.Visible = false; pnlFilterOptions.Visible = false; //Type is Page. blnType = false; } #endregion Check for User selection either Book or Chapter }
/// <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) { try { btnPrint.Attributes.Add(ONCLICKEVENTNAME, base.RegisterJavaScript()); if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && ((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsTypeIISelected) { AdvancedSearchContent.Visible = true; objTreeNode = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; PageID = objTreeNode.PageID; ChapterID = objTreeNode.ChapterID; LoadMetaData(); btnUpdate.Attributes.Add(ONCLICKEVENTNAME, "javascript:UpdatePageContents('" + PageID + "','2');"); } else if (HttpContext.Current.Request.QueryString[MODEQUERYSTRING] != null) { AdvancedSearchContent.Visible = true; PageID = HttpContext.Current.Request.QueryString[PAGEIDQUERYSTRING]; ChapterID = HttpContext.Current.Request.QueryString[CHAPTERIDQUERYSTRING]; LoadMetaData(); btnUpdate.Attributes.Add(ONCLICKEVENTNAME, "javascript:UpdatePageContents('" + PageID + "','2');"); } } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); RenderException(webEx.Message); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } base.Render(writer); }
/// <summary> /// Updates whether the document has been signed off or not /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BtnSignOff_ServerClick(object sender, EventArgs e) { try { objCommon = new CommonBLL(); if (HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES] != null && ((TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]).IsTypeIISelected) { objTreeNode = (TreeNodeSelection)HttpContext.Current.Session[SESSIONWEBPARTPROPERTIES]; PageID = objTreeNode.PageID; ChapterID = objTreeNode.ChapterID; } else if (HttpContext.Current.Request.QueryString[MODEQUERYSTRING] != null) { PageID = HttpContext.Current.Request.QueryString[PAGEIDQUERYSTRING]; ChapterID = HttpContext.Current.Request.QueryString[CHAPTERIDQUERYSTRING]; } LoadMetaData(); if (string.Equals(btnSignOff.Text, CANCELSIGNOFF)) { objCommon.SignOffPage(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, hidPageId.Value, CHAPTERPAGESMAPPINGAUDITLIST, false); } else { objCommon.SignOffPage(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, hidPageId.Value, CHAPTERPAGESMAPPINGAUDITLIST, true); } LoadMetaData(); } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx); RenderException(webEx.Message); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }