/// <summary>
 /// Creates the list viewer XML.
 /// </summary>
 /// <param name="records">The records.</param>
 /// <returns></returns>
 public XmlDocument CreateWellBookTreeXML(BookInfo bookInfo)
 {
     if (bookInfo != null)
     {
         objXmlDocument = new XmlDocument();
         objXmlDocument = CreateRootElement(bookInfo);
     }
     return objXmlDocument;
 }
        /// <summary>
        /// Creates the entity.
        /// </summary>
        /// <param name="objRequestInfo">The requestinfo object.</param>
        /// <param name="EntitiesElement">The entities element.</param>
        private void CreateChapter(BookInfo bookInfo, XmlNode bookNode)
        {
            XmlElement ChapterElement;

            foreach (ChapterInfo objChapter in bookInfo.Chapters)
            {
                ChapterElement = objXmlDocument.CreateElement("Chapter");
                bookNode.AppendChild(ChapterElement);
                if (objChapter.AssetType.Length > 0)
                {
                    XmlAttribute AssetAttribute = objXmlDocument.CreateAttribute("AssetType");
                    ChapterElement.Attributes.Append(AssetAttribute);
                    AssetAttribute.Value = objChapter.AssetType;
                }
                if (objChapter.AssetValue.Length > 0)
                {
                    XmlAttribute AssetValueAttribute = objXmlDocument.CreateAttribute("AssetValue");
                    ChapterElement.Attributes.Append(AssetValueAttribute);
                    AssetValueAttribute.Value = objChapter.AssetValue;
                }
                if (objChapter.ChapterID.Length > 0)
                {
                    XmlAttribute ChapterIDAttribute = objXmlDocument.CreateAttribute("ChapterID");
                    ChapterElement.Attributes.Append(ChapterIDAttribute);
                    ChapterIDAttribute.Value = objChapter.ChapterID;
                }
                if (objChapter.ChapterTitle.Length > 0)
                {
                    XmlAttribute ChapterTitleAttribute = objXmlDocument.CreateAttribute("ChapterTitle");
                    ChapterElement.Attributes.Append(ChapterTitleAttribute);
                    ChapterTitleAttribute.Value = objChapter.ChapterTitle;
                }
                if (objChapter.ActualAssetValue.Length > 0)
                {
                    XmlAttribute ActualAssetValue = objXmlDocument.CreateAttribute("ActualAssetValue");
                    ChapterElement.Attributes.Append(ActualAssetValue);
                    ActualAssetValue.Value = objChapter.ActualAssetValue;
                }
                XmlAttribute IsPrintable = objXmlDocument.CreateAttribute("IsPrintable");
                ChapterElement.Attributes.Append(IsPrintable);
                IsPrintable.Value = objChapter.IsPrintable.ToString();
                if (objChapter.PageInfo != null)
                {
                    // if(string.Equals(objChapter.ChapterID, chapterID))
                    CreatePageInfo(objChapter.PageInfo, ChapterElement);
                }
                #region DREAM 4.0 - eWB2.0 - Customise Chapters
                XmlAttribute Display = objXmlDocument.CreateAttribute("Display");
                ChapterElement.Attributes.Append(Display);
                Display.Value = objChapter.Display.ToString();
                #endregion
            }
        }
Пример #3
0
        /// <summary>
        /// Creates the chapter list XML incase of the preference xml 
        /// for the logged in user and selected book is not available in Doc Lib.
        /// </summary>
        /// <param name="wellBookDetails">The well book details.</param>
        /// <returns></returns>
        private XmlDocument CreateChapterListXml(XmlDocument wellBookDetails)
        {
            XmlDocument chapterListXml = new XmlDocument();
            CommonBLL objCommonBLL = new CommonBLL();
            if (wellBookDetails != null)
            {
                XmlNodeList xmlChapterNodes = wellBookDetails.SelectNodes("/BookInfo/Chapter");
                ChapterInfo objChapterInfo;
                BookInfo objBookInfo = new BookInfo();
                objBookInfo.BookName = wellBookDetails.SelectSingleNode("/BookInfo").Attributes["BookName"].Value;
                objBookInfo.BookID = wellBookDetails.SelectSingleNode("/BookInfo").Attributes["BookID"].Value;
                System.Collections.ArrayList arlChapters = new System.Collections.ArrayList();
                foreach (XmlNode xmlChapterNode in xmlChapterNodes)
                {
                    objChapterInfo = new ChapterInfo();
                    objChapterInfo.ChapterTitle = xmlChapterNode.Attributes["ChapterTitle"].Value;
                    objChapterInfo.ChapterID = xmlChapterNode.Attributes["ChapterID"].Value;
                    objChapterInfo.Display = true;
                    arlChapters.Add(objChapterInfo);
                }

                objBookInfo.Chapters = arlChapters;

                chapterListXml = objCommonBLL.CreateWellBookDetailXML(objBookInfo);
            }
            return chapterListXml;
        }
Пример #4
0
        /// <summary>
        /// Sets the book detail data object.
        /// </summary>
        public BookInfo SetBookDetailDataObject(string siteURL, string bookID, string action, bool bookSelected, PrintOptions objPrintOptions)
        {
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtBooks = null;
            DataRow objDataRow;
            BookInfo objBookInfo = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objBookInfo = new BookInfo();
                objBookInfo.BookID = bookID;
                strCamlQuery = @"<Where><And><Eq><FieldRef Name='ID' /><Value Type='Number'>" +
                    bookID + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>";
                strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Owner' /><FieldRef Name='Team_ID' />";
                dtBooks = objCommonDAL.ReadList(siteURL, DWBBOOKLIST, strCamlQuery, strViewFields);
                for (int intIndex = 0; intIndex < dtBooks.Rows.Count; intIndex++)
                {
                    objDataRow = dtBooks.Rows[intIndex];
                    objBookInfo.BookName = objDataRow[TITLECOLUMN].ToString();
                    objBookInfo.BookOwner = objDataRow["Owner"].ToString();
                    objBookInfo.BookTeamID = objDataRow["Team_ID"].ToString();
                    objBookInfo.Action = action;
                    objBookInfo.IsPrintable = true;
                    objBookInfo.IsTOCApplicatble = objPrintOptions.IncludeTOC;
                    if (bookSelected)
                    {
                        objBookInfo.Chapters = SetChapterDetail(siteURL, bookID, action);
                        int intPageCount = 0;
                        if (objBookInfo.Chapters != null && objBookInfo.Chapters.Count > 0)
                        {
                            foreach (ChapterInfo objChapterInfo in objBookInfo.Chapters)
                            {
                                intPageCount += objChapterInfo.PageInfo.Count;
                            }
                            intPageCount += objBookInfo.Chapters.Count;
                        }
                        objBookInfo.PageCount = intPageCount;
                    }

                    objBookInfo.IsStoryBoardApplicable = objPrintOptions.IncludeStoryBoard;
                    objBookInfo.IsPageTitleApplicable = objPrintOptions.IncludePageTitle;
                    objBookInfo.IsBookTitleApplicable = objPrintOptions.IncludeBookTitle;
                }
            }
            catch (Exception)
            {
                throw;
            }
            if (dtBooks != null)
            {
                dtBooks.Dispose();
            }
            return objBookInfo;
        }
Пример #5
0
 /// <summary>
 /// Creates the Well Book Details XML.
 /// </summary>
 /// <param name="bookInfo">BookInfo object.</param>
 /// <returns>XmlDocument.</returns>
 public XmlDocument CreateWellBookDetailXML(BookInfo bookInfo)
 {
     WellBookTreeXMLGeneratorBLL objXmlGenerator = new WellBookTreeXMLGeneratorBLL();
     return (objXmlGenerator.CreateWellBookTreeXML(bookInfo));
 }
Пример #6
0
        /// This method can be removed.
        /// <summary>
        /// Saves the customise chapter preference to session.
        /// Reorderxml is received from HiddenField value. 
        /// </summary>
        /// <param name="bookID">The book ID.</param>
        /// <param name="bookName">Name of the book.</param>
        /// <param name="reorderXml">The reorder XML.</param>
        protected void SaveCustomiseChapterPreferenceToSession(string bookID, string bookName, string reorderXml)
        {
            XmlDocument chapterListXml = new XmlDocument();
            CommonBLL objCommonBLL = new CommonBLL();

            DWBDataObjects.ChapterInfo objChapterInfo;
            DWBDataObjects.BookInfo objBookInfo = new DWBDataObjects.BookInfo();
            objBookInfo.BookName = bookName;
            objBookInfo.BookID = bookID;
            ArrayList arlChapters = new ArrayList();
            //foreach (RadListBoxItem listItem in radListBox.Items)
            //{
            //    objChapterInfo = new DWBDataObjects.ChapterInfo();
            //    objChapterInfo.ChapterTitle = listItem.Text;
            //    objChapterInfo.ChapterID = listItem.Value;
            //    if (listItem.Checked)
            //    {
            //        objChapterInfo.Display = true;
            //    }
            //    arlChapters.Add(objChapterInfo);
            //}

            //objBookInfo.Chapters = arlChapters;

            chapterListXml = objCommonBLL.CreateWellBookDetailXML(objBookInfo);
            if (chapterListXml != null && !string.IsNullOrEmpty(reorderXml))
            {
                reorderXml = reorderXml.Insert(0, chapterListXml.OuterXml.Substring(0, chapterListXml.OuterXml.LastIndexOf("/>")) + ">");
                reorderXml = reorderXml.Insert(reorderXml.Length - 1, "</BookInfo>");

            }
            if (HttpContext.Current.Session[CHAPTERPREFERENCEXML] != null)
            {
                HttpContext.Current.Session.Remove(CHAPTERPREFERENCEXML);
            }

            HttpContext.Current.Session[CHAPTERPREFERENCEXML] = reorderXml;
        }
Пример #7
0
        /// <summary>
        /// Saves the customise chapter preference to session object.
        /// Add the ChapterOrder attribute to SESSION_TREEVIEWXML object.
        /// </summary>
        /// <param name="bookID">The book ID.</param>
        /// <param name="bookName">Name of the book.</param>
        /// <param name="radListBox">The RAD list box.</param>
        protected void SaveCustomiseChapterPreferenceToSession(string bookID, string bookName, RadListBox radListBox)
        {
            XmlDocument chapterListXml = new XmlDocument();
            CommonBLL objCommonBLL = new CommonBLL();

            DWBDataObjects.ChapterInfo objChapterInfo;
            DWBDataObjects.BookInfo objBookInfo = new DWBDataObjects.BookInfo();
            objBookInfo.BookName = bookName;
            objBookInfo.BookID = bookID;
            ArrayList arlChapters = new ArrayList();
            foreach (RadListBoxItem listItem in radListBox.Items)
            {
                objChapterInfo = new DWBDataObjects.ChapterInfo();
                objChapterInfo.ChapterTitle = listItem.Text;
                objChapterInfo.ChapterID = listItem.Value;
                if (listItem.Checked)
                {
                    objChapterInfo.Display = true;
                }
                arlChapters.Add(objChapterInfo);
            }

            objBookInfo.Chapters = arlChapters;

            chapterListXml = objCommonBLL.CreateWellBookDetailXML(objBookInfo);
            if (HttpContext.Current.Session[CHAPTERPREFERENCEXML] != null)
            {
                HttpContext.Current.Session.Remove(CHAPTERPREFERENCEXML);
            }
            /// Chapter preference XML created and stored to session.
            HttpContext.Current.Session[CHAPTERPREFERENCEXML] = chapterListXml.OuterXml;

            ///Adding ChapterOrder attribute to SESSION_TREEVIEWXML object.
            XmlDocument xmlDocWellBookDetails = new XmlDocument();
            xmlDocWellBookDetails.LoadXml((string)HttpContext.Current.Session[SESSION_TREEVIEWXML]);

            ReOrderChapterNode(xmlDocWellBookDetails, chapterListXml);
        }
        /// <summary>
        /// Creates the root element.
        /// </summary>
        /// <param name="objRequestInfo">The request info object.</param>
        /// <returns></returns>
        private XmlDocument CreateRootElement(BookInfo bookInfo)
        {
            //Creating the root Xml Element BookInfo.
            XmlElement BookElement = objXmlDocument.CreateElement("BookInfo");
            objXmlDocument.AppendChild(BookElement);

            //Creating the BookInfo node with Name attribute.
            XmlNode BookNode = objXmlDocument.DocumentElement;

            if (bookInfo.Chapters != null)
            {
                //Method call to create Chapters Node.
                CreateChapter(bookInfo, BookNode);
            }
            if (bookInfo.BookID.Length > 0)
            {
                XmlAttribute BookID = objXmlDocument.CreateAttribute("BookID");
                BookElement.Attributes.Append(BookID);
                BookID.Value = bookInfo.BookID;
            }
            if (bookInfo.BookName.Length > 0)
            {
                XmlAttribute BookName = objXmlDocument.CreateAttribute("BookName");
                BookElement.Attributes.Append(BookName);
                BookName.Value = bookInfo.BookName;
            }
            if (bookInfo.BookOwner.Length > 0)
            {
                XmlAttribute BookOwner = objXmlDocument.CreateAttribute("BookOwner");
                BookElement.Attributes.Append(BookOwner);
                BookOwner.Value = bookInfo.BookOwner;
            }
            if (bookInfo.PageCount > 0)
            {
                XmlAttribute PageCount = objXmlDocument.CreateAttribute("PageCount");
                BookElement.Attributes.Append(PageCount);
                PageCount.Value = bookInfo.PageCount.ToString();
            }
            if (bookInfo.Action.Length > 0)
            {
                XmlAttribute Action = objXmlDocument.CreateAttribute("Type");
                BookElement.Attributes.Append(Action);
                Action.Value = bookInfo.Action;
            }
            XmlAttribute IsPrintable = objXmlDocument.CreateAttribute("IsPrintable");
            XmlAttribute IsTOCApplicable = objXmlDocument.CreateAttribute("IsTOCApplicable");
            XmlAttribute IsStoryBoardApplicable = objXmlDocument.CreateAttribute("IsStoryBoardApplicable");
            /// Added for Print Options CR Implementation
            XmlAttribute IsPageTitleApplicable = objXmlDocument.CreateAttribute("IsPageTitleApplicable");
            XmlAttribute IsBookTitleApplicable = objXmlDocument.CreateAttribute("IsBookTitleApplicable");

            BookElement.Attributes.Append(IsPrintable);
            BookElement.Attributes.Append(IsTOCApplicable);
            BookElement.Attributes.Append(IsStoryBoardApplicable);
            /// Added for Print Options CR Implementation
            BookElement.Attributes.Append(IsPageTitleApplicable);
            BookElement.Attributes.Append(IsBookTitleApplicable);
            IsPrintable.Value = bookInfo.IsPrintable.ToString();
            IsTOCApplicable.Value = bookInfo.IsTOCApplicatble.ToString();
            IsStoryBoardApplicable.Value = bookInfo.IsStoryBoardApplicable.ToString();
            /// Added for Print Options CR Implementation
            IsPageTitleApplicable.Value = bookInfo.IsPageTitleApplicable.ToString();
            IsBookTitleApplicable.Value = bookInfo.IsBookTitleApplicable.ToString();
            //returns the final SearchRequest Xml.
            return objXmlDocument;
        }
Пример #9
0
 /// <summary>
 /// Shows the sign off.
 /// </summary>
 private void ShowSignOff()
 {
     string strMode = string.Empty;
     if (HttpContext.Current.Session[SESSION_TREEVIEWDATAOBJECT] != null)
     {
         objBookInfo = ((BookInfo)HttpContext.Current.Session[SESSION_TREEVIEWDATAOBJECT]);
         if (objBookInfo != null)
         {
             strBookOwner = objBookInfo.BookOwner;
             strBookTeamID = objBookInfo.BookTeamID;
         }
     }
     strMode = HttpContext.Current.Request.QueryString[QUERYSTRING_MODE];
     if (!string.IsNullOrEmpty(strMode) && strMode.Equals(VIEW))
     {
         blnSignOff = false;
     }
     else if (ShowButton(strBookOwner, strBookTeamID, strPageOwner, strDiscipline))
     {
         blnSignOff = true;
     }
     if (blnSignOff)
     {
         if (btnSignOff != null)
         {
             if (string.Equals(lblSignedOff.Text, "No"))
                 btnSignOff.Text = SIGNOFF_TEXT;
             else
                 btnSignOff.Text = CANCEL_SIGNOFF_TEXT;
         }
     }
 }
Пример #10
0
 /// <summary>
 /// Sets the request info object.
 /// </summary>
 private void SetRequestInfoObject()
 {
     string strChapterID = string.Empty;
     string strAssetType = string.Empty;
     if (HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID] != null)
         strChapterID = Convert.ToString(HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID]);
     objBookInfo = ((BookInfo)HttpContext.Current.Session[SESSION_TREEVIEWDATAOBJECT]);
     if (objBookInfo != null)
     {
         strBookOwner = objBookInfo.BookOwner;
         strBookTeamID = objBookInfo.BookTeamID;
         foreach (ChapterInfo objChapterInfo in objBookInfo.Chapters)
         {
             if (string.Equals(objChapterInfo.ChapterID, ChapterID))
             {
                 strIdentifierValue[0] = objChapterInfo.ActualAssetValue;
                 strAssetType = objChapterInfo.ColumnName;
                 if (string.Equals(objChapterInfo.AssetType, ASSETTYPE_WELL))
                     strAssetType = UWI;
                 else if (string.Equals(objChapterInfo.AssetType, ASSETTYPE_FIELD))
                     strAssetType = FIELD_IDENTIFIER;
                 else
                     strAssetType = UWBI;
                 /// If $ is present in Page Title replace with Asset Value
                 /// Else prefix with Asset Value.
                 if (lblTitleTemplate.Text.IndexOf("$") == 0)
                 {
                     lblTitleTemplate.Text = lblTitleTemplate.Text.Replace("$", objChapterInfo.AssetValue);
                 }
                 else
                 {
                     lblTitleTemplate.Text = string.Concat(objChapterInfo.AssetValue, "-", lblTitleTemplate.Text);
                 }
             }
         }
         objRequestInfo = SetBasicDataObjects(SearchName.ToString(), strAssetType, strIdentifierValue, false, false, intMaxRecords);
     }
 }
Пример #11
0
        /// <summary>
        /// Print the current Page/Selected Pages
        /// </summary>
        private int PrintPage(PrintOptions objPrintOptions)
        {
            bool blnUserControlFound = false;
            RadTreeView objTreeViewWellBook = null;
            WellBookBLL objWellBookBLL = null;
            StringBuilder strPageIds = null;
            ArrayList arlPageDetails = null;
            ArrayList arlChapterCollection = null;
            string strSplitter = ";";
            BookInfo objBookInfo = null;
            ChapterInfo objChapterInfo = null;
            XmlDocument xmlWellBookDetails = null;
            string intPrintedDocID = string.Empty;
            string strChapterIDForPage = string.Empty;
            string strSelectedPageID = string.Empty;
            string strBookID = string.Empty;
            objWellBookBLL = new WellBookBLL();
            objCommonBLL = new CommonBLL();
            arlChapterCollection = new ArrayList();
            /// If in View Mode, take page ID and chapter ID from Query string
            if (HttpContext.Current.Request.QueryString[QUERYSTRING_MODE] == null)
            {
                if (this.Parent.GetType().Equals(typeof(SPWebPartManager)))
                {
                    foreach (Control ctrlWebPart in this.Parent.Controls)
                    {
                        if (ctrlWebPart.GetType().Equals(typeof(TreeViewControl.TreeViewControl)))
                        {

                            Control ctrlTreeView = ctrlWebPart.FindControl("RadTreeView1");
                            if (ctrlTreeView != null && ctrlTreeView.GetType().Equals(typeof(RadTreeView)))
                            {
                                objTreeViewWellBook = (RadTreeView)ctrlWebPart.FindControl("RadTreeView1");
                                blnUserControlFound = true;
                                break;
                            }
                            if (blnUserControlFound)
                            {
                                break;
                            }
                        }
                    }
                }

                if (objTreeViewWellBook != null)
                {
                    /// 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.

                    if (objTreeViewWellBook.SelectedNode.Level == 2)
                    {
                        strBookID = objTreeViewWellBook.SelectedNode.ParentNode.ParentNode.Value;
                        strChapterIDForPage = objTreeViewWellBook.SelectedNode.ParentNode.Value;
                        strSelectedPageID = objTreeViewWellBook.SelectedNode.Value;
                    }
                }
            }
            else
            {
                if (string.Compare(HttpContext.Current.Request.QueryString[QUERYSTRING_MODE], VIEW) == 0)
                {
                    strSelectedPageID = HttpContext.Current.Request.QueryString[QUERYSTRING_PAGEID];
                    strChapterIDForPage = HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID];
                    BookInfo objBookInfoSession = ((BookInfo)HttpContext.Current.Session[SESSION_TREEVIEWDATAOBJECT]);
                    if (objBookInfoSession != null)
                    {
                        strBookID = objBookInfoSession.BookID;
                    }
                }
            }
            strParentSiteURL = SPContext.Current.Site.Url.ToString();
            objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, strBookID, BOOKACTION_PRINT, false,objPrintOptions);
            objChapterInfo = objWellBookBLL.SetChapterDetails(strParentSiteURL, strChapterIDForPage, false);
            if (objBookInfo != null)
            {
                if (objChapterInfo != null)
                {
                    strPageIds = new StringBuilder();
                    strPageIds.Append(strSelectedPageID);
                    strPageIds.Append(strSplitter);
                    arlPageDetails = objWellBookBLL.SetSelectedPageInfo(strParentSiteURL, strPageIds.ToString(), objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName);
                    if (arlPageDetails != null && arlPageDetails.Count > 0)
                    {
                        objChapterInfo.PageInfo = arlPageDetails;
                        objBookInfo.PageCount = arlPageDetails.Count;
                    }
                    arlChapterCollection.Add(objChapterInfo);
                }
                if (arlChapterCollection != null && arlChapterCollection.Count > 0)
                {
                    objBookInfo.Chapters = arlChapterCollection;
                }
                xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo);
            }
            string strSiteURL = strParentSiteURL;

            strSiteURL = GetSslURL(strSiteURL);

            PDFServiceSPProxy objPDFService;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                objPDFService = new PDFServiceSPProxy();
                objPDFService.PreAuthenticate = true;
                SetUserNameDetailsforWebService();
                objPDFService.Credentials = new NetworkCredential(strWebServiceUserName, strWebServicePassword, strWebServiceDomain);
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strSiteURL, string.Format("WebService URL : {0}", objPDFService.Url), "Type I Page", "WebService URL");
                if (xmlWellBookDetails != null)
                {
                    string strBookName = xmlWellBookDetails.DocumentElement.Attributes["BookName"].Value.ToString();
                    string strRequestID = Guid.NewGuid().ToString();
                    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;
                }
            });
            return 1;
        }