Пример #1
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;
        }
Пример #2
0
        /// <summary>
        /// Sets the collection of chapter detail.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="bookID">The book ID.</param>
        /// <param name="action">The action.</param>
        /// <returns>ArrayList</returns>
        private ArrayList SetChapterDetail(string siteURL, string bookID, string action)
        {
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtChapters = null;
            DataRow objDataRow;
            ChapterInfo objChapterInfo = null;
            ArrayList arlChapterDetails = null;
            try
            {
                objCommonDAL = new CommonDAL();
                //strCamlQuery = @"<OrderBy><FieldRef Name='Chapter_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + bookID + "</Value>" + "</Eq></And></Where>";
                #region DREAM 4.0 - eWB2.0 - Deletion module
                /// Modify CAML query to exclude the chapters marked ad ToBeDeleted = Yes displaying from TreeView.
                strCamlQuery = @"<OrderBy><FieldRef Name='Chapter_Sequence' /></OrderBy><Where><And><And><Eq><FieldRef Name='Terminate_Status' /> <Value Type='Choice'>No</Value></Eq><Or><IsNull><FieldRef Name='ToBeDeleted' /></IsNull><Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></Or></And><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + bookID + "</Value>" + "</Eq></And></Where>";
                #endregion
                strViewFields = @"<FieldRef Name='Chapter_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' /><FieldRef Name='Book_ID' /><FieldRef Name='Actual_Asset_Value' /><FieldRef Name='Column_Name' /><FieldRef Name='Asset_Type' /><FieldRef Name='Asset_Value' />";
                dtChapters = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery, strViewFields);

                arlChapterDetails = new ArrayList();
                for (int intIndex = 0; intIndex < dtChapters.Rows.Count; intIndex++)
                {
                    objChapterInfo = new ChapterInfo();
                    objDataRow = dtChapters.Rows[intIndex];
                    objChapterInfo.AssetType = objDataRow["Asset_Type"].ToString();
                    objChapterInfo.AssetValue = objDataRow["Asset_Value"].ToString();
                    objChapterInfo.ChapterID = objDataRow[IDCOLUMN].ToString();
                    objChapterInfo.ChapterTitle = objDataRow[TITLECOLUMN].ToString();
                    objChapterInfo.ActualAssetValue = objDataRow["Actual_Asset_Value"].ToString();
                    objChapterInfo.ColumnName = objDataRow["Column_Name"].ToString();

                    objChapterInfo.PageInfo = SetChapterPageInfo(siteURL, objChapterInfo.ChapterID, objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName);
                    if (objChapterInfo.PageInfo.Count > 0)
                    {
                        /// Add chapter to collection only if the Chapter contains >=1 pages.
                        arlChapterDetails.Add(objChapterInfo);
                        if (string.Compare(action, "print", true) == 0 || string.Compare(action, "pdf", true) == 0)
                        {
                            /// Set IsPrintable to true
                            /// This method is called for Publish/Print complete book
                            objChapterInfo.IsPrintable = true;
                        }
                    }
                }
                if (dtChapters != null)
                {
                    dtChapters.Dispose();
                }
                return arlChapterDetails;
            }
            catch (Exception)
            {
                throw;
            }
        }
Пример #3
0
        /// <summary>
        /// Sets the chapter details.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="ChapterID">The chapter ID.</param>
        /// <param name="chapterSelected">if set to <c>true</c> [chapter selected].</param>
        /// <returns></returns>
        public ChapterInfo SetChapterDetails(string siteURL, string ChapterID, bool chapterSelected)
        {
            ChapterInfo objChapterInfo = null;
            string strCamlQuery = string.Empty;
            DataTable dtChapters = null;
            DataRow objDataRow;
            try
            {
                objCommonBLL = new CommonBLL();
                strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + ChapterID + "</Value></Eq></Where>";
                dtChapters = objCommonBLL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery);

                for (int intIndex = 0; intIndex < dtChapters.Rows.Count; intIndex++)
                {
                    objChapterInfo = new ChapterInfo();
                    objDataRow = dtChapters.Rows[intIndex];
                    objChapterInfo.AssetType = objDataRow["Asset_Type"].ToString();
                    objChapterInfo.AssetValue = objDataRow["Asset_Value"].ToString();
                    objChapterInfo.ChapterID = objDataRow[IDCOLUMN].ToString();
                    objChapterInfo.ChapterTitle = objDataRow[TITLECOLUMN].ToString();
                    objChapterInfo.ActualAssetValue = objDataRow["Actual_Asset_Value"].ToString();
                    objChapterInfo.ColumnName = objDataRow["Column_Name"].ToString();
                    if (chapterSelected)
                    {
                        /// Call SetPageInfo method and assign the Page Collection
                        objChapterInfo.PageInfo = SetChapterPageInfo(siteURL, objChapterInfo.ChapterID, objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            if (dtChapters != null)
            {
                dtChapters.Dispose();
            }
            return objChapterInfo;
        }
Пример #4
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);
        }