/// <summary> /// Updates the Story Board /// </summary> /// <param name="listName"></param> /// <param name="pageStoryBoard"></param> /// <param name="actionPerformed"></param> protected void UpdateStoryBoard(string listName, string auditListName, string pageId, DWBDataObjects.StoryBoard pageStoryBoard, string actionPerformed) { string strCamlQuery = string.Empty; try { objChapterBLL = new ChapterBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + pageId + "</Value></Eq></Where>"; strUserName = GetUserName(); objChapterBLL.UpdateStoryBoard(strParentSiteURL, listName, auditListName, strCamlQuery, pageId, pageStoryBoard, strUserName, actionPerformed); } 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> protected void UpdatePageOwner(DWBDataObjects.ListEntry listEntry, string listName, string auditListName, string actionPerformed, string username) { objWellBookBLL = new WellBookBLL(); objWellBookBLL.UpdatePageOwner(strParentSiteURL, listEntry, auditListName, listName, username, actionPerformed); }
/// <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> /// 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> protected bool UpdateListEntry(DWBDataObjects.ListEntry listEntry, string listName, string auditListName, string pageType, string actionPerformed) { bool blnUpdateSuccess = false; strUserName = GetUserName(); switch (pageType) { case MASTERPAGE: { objMasterBLL = new MasterPageBLL(); listEntry.MasterPage.PageOwner = strUserName; objMasterBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case TEMPLATE: { objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case TEMPLATEPAGEMAPPING: { objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateTemplatePageMapping(strParentSiteURL, listEntry, listName, auditListName, strUserName, actionPerformed, listEntry.TemplateDetails.RowId.ToString()); break; } case MASTERPAGETEMPLATEMAPPING: { objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateTemplateIDinMasterPageList(strParentSiteURL, listEntry, listName, auditListName, strUserName, actionPerformed); break; } case WELLBOOK: { objWellBookBLL = new WellBookBLL(); objWellBookBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case CHAPTER: { objChapterBLL = new ChapterBLL(); objChapterBLL.UpdateListEntry(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case CHANGEPAGEOWNER: { objWellBookBLL = new WellBookBLL(); objWellBookBLL.UpdatePageOwner(strParentSiteURL, listEntry, auditListName, listName, strUserName, actionPerformed); break; } case PAGECOMMENTS: { objWellBookBLL = new WellBookBLL(); blnUpdateSuccess = objWellBookBLL.UpdatePageComments(strParentSiteURL, listName, auditListName, listEntry, actionPerformed); break; } } return blnUpdateSuccess; }
/// <summary> /// Sets the list box values based on the CAML query /// </summary> /// <param name="lstListBox"></param> /// <param name="listName"></param> /// <param name="strCAMLQuery"></param> protected void SetListValues(ListBox lstListBox, string listName, string strCAMLQuery, DWBDataObjects.ListEntry objListEntry) { DataTable dtListData = null; DataRow drListData; ListItem lstItem; try { objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, listName, strCAMLQuery); if (dtListData != null && dtListData.Rows.Count > 0) { lstListBox.Items.Clear(); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = Convert.ToString(drListData[DWBTITLECOLUMN]); lstItem.Value = Convert.ToString(drListData[DWBIDCOLUMN]); if (objListEntry != null) { if (objListEntry.MasterPage.Templates.Contains(lstItem.Value)) lstListBox.Items.Add(lstItem); } else { lstListBox.Items.Add(lstItem); } } } } catch { throw; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Prints the Book/Chapter/Page. /// </summary> /// <param name="objPrintOptions">The PrintOptions object.</param> /// <param name="controlType">Type of the control.</param> /// <param name="mode">The mode.</param> /// <returns></returns> protected int Print(DWBDataObjects.PrintOptions objPrintOptions, string controlType, string mode) { bool blnUserControlFound = false; Telerik.Web.UI.RadTreeView trvWellBook = null; WellBookBLL objWellBookBLL; StringBuilder strPageIds; ArrayList arlPageDetails; ArrayList arlChapterCollection; string strSplitter = ";"; DWBDataObjects.BookInfo objBookInfo; DWBDataObjects.ChapterInfo objChapterInfo; XmlDocument xmlWellBookDetails = null; string intPrintedDocID = string.Empty; int intNoOfPrintedPages = 0; bool blnIsPagePrint = false; bool blnIsChapterPrint = false; bool blnIsBookPrint = false; SetUserNameDetailsforWebService(); if (string.Compare(mode, VIEW, true) != 0) { if (this.Parent.Parent.GetType().Equals(typeof(SPWebPartManager))) { foreach (Control ctrlWebPart in this.Parent.Parent.Controls) { if (ctrlWebPart.GetType().Equals(typeof(TreeViewControl))) { Control ctrlTreeView = ctrlWebPart.FindControl("RadTreeView1"); if (ctrlTreeView != null && ctrlTreeView.GetType().Equals(typeof(RadTreeView))) { trvWellBook = (RadTreeView)ctrlWebPart.FindControl("RadTreeView1"); blnUserControlFound = true; break; } if (blnUserControlFound) { break; } } } } } objWellBookBLL = new WellBookBLL(); objCommonBLL = new CommonBLL(); arlChapterCollection = new ArrayList(); /// If selected node is book node, loop into each chapter node /// If chapter node is checked, loop into each page node and create book info object /// Else if selected node is chapter node, loop into each page node /// Add only selected page details to chapter object. /// Else if selected node is page node, create bookinfo which includes only selected page. //Added By Gopinath //Date : 10/11/2010 //Description : Making Filter CAML query for Filter options which are loaded from PrintByPageType #region Building CAML Query using Print Options StringBuilder sbFilterCAMLQuery = new StringBuilder(); //Check for Current User as Page Owner string strCurrentUser = string.Empty; object ObjPrivileges = CommonUtility.GetSessionVariable(this.Page, enumSessionVariable.UserPrivileges.ToString()); DWBDataObjects.Privileges objStoredPriviledges = null; if (ObjPrivileges != null) { objStoredPriviledges = (DWBDataObjects.Privileges)ObjPrivileges; } strCurrentUser = GetUserName(); #region CAML Query if (objStoredPriviledges != null && objStoredPriviledges.SystemPrivileges != null) { if (!objStoredPriviledges.SystemPrivileges.PageOwner) { //Only for BO/AD if ((!objPrintOptions.PrintMyPages && objPrintOptions.IncludeFilter) || (objPrintOptions.PrintMyPages && objPrintOptions.IncludeFilter)) { //Page Name if ((!string.Equals(objPrintOptions.PageName, "all")) && (!string.IsNullOrEmpty(objPrintOptions.PageName))) sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Page_Name' /><Value Type='Text'>" + objPrintOptions.PageName + "</Value></Eq>"); else sbFilterCAMLQuery.Append(@"<IsNotNull><FieldRef Name='Page_Name' /></IsNotNull>"); if (string.Equals(objPrintOptions.PageName, "all")) //If page name selected then no need to consider discipline and page type. { //Discipline if ((!string.Equals(objPrintOptions.Discipline, "all")) && (!string.IsNullOrEmpty(objPrintOptions.Discipline))) sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Discipline' /><Value Type='Text'>" + objPrintOptions.Discipline + "</Value></Eq>"); else sbFilterCAMLQuery.Append(@"<IsNotNull><FieldRef Name='Discipline' /></IsNotNull>"); } else { sbFilterCAMLQuery.Append(@"<IsNotNull><FieldRef Name='Discipline' /></IsNotNull>"); } sbFilterCAMLQuery.Append("</And>"); sbFilterCAMLQuery.Insert(0, "<And>"); //Page Type if (string.Equals(objPrintOptions.PageName, "all")) //If page name selected then no need to consider discipline and page type. { #region Page Type //PageType contain values 0,1,2 if (!string.Equals(objPrintOptions.PageType, "none")) { char[] chSplitterComma = { ',' }; string[] strPageType = objPrintOptions.PageType.Split(chSplitterComma); if (strPageType != null && strPageType.Length > 0) { for (int index = 0; index < strPageType.Length; index++) { switch (strPageType[index]) { case "0": { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Connection_Type' /> <Value Type='Text'>1 - Automated</Value></Eq></And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } break; case "1": { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Connection_Type' /> <Value Type='Text'>2 - Published Document</Value></Eq></And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } break; case "2": { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Connection_Type' /> <Value Type='Text'>3 - User Defined Document</Value></Eq></And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } break; } } } } #endregion Page Type } //Signed Off if ((!string.Equals(objPrintOptions.SignedOff, "both")) && (!string.IsNullOrEmpty(objPrintOptions.SignedOff))) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Sign_Off_Status' /> <Value Type='Choice'>" + objPrintOptions.SignedOff + "</Value></Eq> </And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } //Empty Pages if ((!string.Equals(objPrintOptions.EmptyPages, "both")) && (!string.IsNullOrEmpty(objPrintOptions.EmptyPages))) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Empty' /> <Value Type='Choice'>" + objPrintOptions.EmptyPages + "</Value></Eq> </And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } if (objPrintOptions.PrintMyPages) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strCurrentUser + "</Value></Eq>"); sbFilterCAMLQuery.Append("</And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } //Open & Close <Where></Where> sbFilterCAMLQuery.Append(@"</Where>"); sbFilterCAMLQuery.Insert(0, "<Where>"); } else if (objPrintOptions.PrintMyPages && !objPrintOptions.IncludeFilter) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strCurrentUser + "</Value></Eq>"); //Open & Close <Where></Where> sbFilterCAMLQuery.Append(@"</Where>"); sbFilterCAMLQuery.Insert(0, "<Where>"); } } // For PageOwner else if (objPrintOptions.PrintMyPages && objPrintOptions.IncludeFilter) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strCurrentUser + "</Value></Eq>"); //Open & Close <Where></Where> sbFilterCAMLQuery.Append(@"</Where>"); sbFilterCAMLQuery.Insert(0, "<Where>"); } } #endregion CAML Query //Retrive only Page Id string strViewFields = "<FieldRef Name='ID' />"; #endregion Building CAML Query using Print Options if (sbFilterCAMLQuery != null && sbFilterCAMLQuery.Length > 0) { strPageIdList = new List<string>(); //Declared Globally DataTable dtPageIds = objCommonBLL.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, sbFilterCAMLQuery.ToString(), strViewFields); if (dtPageIds != null && dtPageIds.Rows.Count > 0) { foreach (DataRow drPageId in dtPageIds.Rows) { strPageIdList.Add(drPageId[0].ToString()); } } } ///End Gopinath code. switch (controlType) { case WELLBOOKVIEWERCONTROLBOOK: { #region BOOK PRINT blnIsBookPrint = true; if (trvWellBook != null) { if (trvWellBook.SelectedNode == null) { trvWellBook.Nodes[0].Selected = true; } if (trvWellBook.SelectedNode.Level == 0) { objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, trvWellBook.SelectedNode.Value, BOOKACTIONPRINT, false, objPrintOptions); if (trvWellBook.CheckedNodes.Count > 0) { foreach (RadTreeNode chapterNode in trvWellBook.SelectedNode.Nodes) { if (chapterNode.Checked) { objChapterInfo = CreateChapterInfo(chapterNode); if (objChapterInfo != null) arlChapterCollection.Add(objChapterInfo); if (objChapterInfo != null && objChapterInfo.PageInfo != null) { intNoOfPrintedPages += objChapterInfo.PageInfo.Count; } } } objBookInfo.Chapters = arlChapterCollection; objBookInfo.PageCount = intNoOfPrintedPages; if (objBookInfo.Chapters.Count == 0) objBookInfo = null; xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } else { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", ALERTNOCHAPTERNODECHECKED, true); } } } #endregion BOOK PRINT break; } case WELLBOOKVIEWERCONTROLCHAPTER: { #region CHAPTER PRINT blnIsChapterPrint = true; if (trvWellBook != null) { objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, trvWellBook.SelectedNode.ParentNode.Value, BOOKACTIONPRINT, false, objPrintOptions); if (trvWellBook.SelectedNode.Level == 1) { if (trvWellBook.SelectedNode.Checked) { objChapterInfo = CreateChapterInfo(trvWellBook.SelectedNode); if (objChapterInfo != null) arlChapterCollection.Add(objChapterInfo); objBookInfo.Chapters = arlChapterCollection; if (objBookInfo.Chapters.Count == 0) objBookInfo = null; xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } else { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", ALERTNOPAGENODECHECKED, true); } } } #endregion CHAPTER PRINT break; } case WELLBOOKVIEWERCONTROLPAGE: { #region PAGE PRINT blnIsPagePrint = true; string strPageID = string.Empty; string strChapterID = string.Empty; string strBookID = string.Empty; if (trvWellBook != null) { if (trvWellBook.SelectedNode.Level == 2) { strBookID = trvWellBook.SelectedNode.ParentNode.ParentNode.Value; strChapterID = trvWellBook.SelectedNode.ParentNode.Value; strPageID = trvWellBook.SelectedNode.Value; } } else if (string.Compare(mode, VIEW, true) == 0) { strPageID = HttpContext.Current.Request.QueryString[PAGEIDQUERYSTRING]; strChapterID = HttpContext.Current.Request.QueryString[CHAPTERIDQUERYSTRING]; DWBDataObjects.BookInfo objBookInfoSession = ((DWBDataObjects.BookInfo)HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT]); if (objBookInfoSession != null) { strBookID = objBookInfoSession.BookID; } } objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, strBookID, BOOKACTIONPRINT, false, objPrintOptions); objChapterInfo = objWellBookBLL.SetChapterDetails(strParentSiteURL, strChapterID, false); if (objChapterInfo != null) { strPageIds = new StringBuilder(); strPageIds.Append(strPageID); strPageIds.Append(strSplitter); arlPageDetails = objWellBookBLL.SetSelectedPageInfo(strParentSiteURL, strPageIds.ToString(), objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName); if (arlPageDetails != null && arlPageDetails.Count > 0) { objChapterInfo.PageInfo = arlPageDetails; } arlChapterCollection.Add(objChapterInfo); } if (arlChapterCollection != null && arlChapterCollection.Count > 0) { objBookInfo.Chapters = arlChapterCollection; } xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); #endregion PAGE PRINT break; } default: break; } if (xmlWellBookDetails == null) { return -1; } string strSiteURL = strParentSiteURL; SslRequiredWebPart objSslRequired = new SslRequiredWebPart(); strSiteURL = objSslRequired.GetSslURL(strSiteURL); PDFServiceSPProxy objPDFService; SPSecurity.RunWithElevatedPrivileges(delegate() { objPDFService = new PDFServiceSPProxy(); objPDFService.PreAuthenticate = true; objPDFService.Credentials = new NetworkCredential(strWebServiceUserName, strWebServicePassword, strWebServiceDomain); PdfBLL objPdfBLL = new PdfBLL(); if (xmlWellBookDetails != null) { try { string strBookName = xmlWellBookDetails.DocumentElement.Attributes["BookName"].Value.ToString(); string strRequestID = Guid.NewGuid().ToString(); if (blnIsPagePrint) { string strDocumentURLTemp = PortalConfiguration.GetInstance().GetKey("DWBPrintNetworkPath") + string.Format("{0}_{1}", strBookName, strRequestID) + ".pdf"; UpdatePagePrintDetails(strRequestID, strDocumentURLTemp, strSiteURL, "temp"); intPrintedDocID = objPDFService.GeneratePDFDocument(xmlWellBookDetails.DocumentElement, strParentSiteURL, strRequestID); strDocumentURL = strSiteURL + "/Pages/eWBPDFViewer.aspx?mode=page&requestID=" + strRequestID; } else if (blnIsChapterPrint) { UpdateDWBChapterPrintDetails(strCurrentUser, strRequestID, strBookName); //strCurrentUser, strRequestID, e-MailID, document URL //intPrintedDocID = objPDFService.GeneratePDFDocument(xmlWellBookDetails.DocumentElement, strParentSiteURL, strRequestID); AsyncCallback asyncCall = new AsyncCallback(CallbackMethod); objPDFService.Timeout = System.Threading.Timeout.Infinite; objPDFService.BeginGeneratePDFDocument(xmlWellBookDetails.DocumentElement, strParentSiteURL, strRequestID, asyncCall, objPDFService); } else if (blnIsBookPrint) { UpdateDWBBookPrintDetails(strCurrentUser, strRequestID, strBookName, xmlWellBookDetails); } } catch (SoapException) { throw; } } }); return 1; }