/// <summary>
        /// Handles the Click event of the cmdPrintChapter control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void cmdPrintChapter_Click(object sender, EventArgs e)
        {
            string strAlertMessage = string.Empty;
            int intPrintedDocID = 0;
            string[] strPrintedDocURL = null;
            CommonBLL objCommonBLL = null;
            string strCamlQuery = string.Empty;
            PrintOptions objPrintOptions = new PrintOptions();

            try
            {
                /// If Hidden field containse "true" story board should be included in Print document
                if (string.Compare(hdnIncludeStoryBoard.Value.ToLowerInvariant(), "true", true) == 0)
                {
                    objPrintOptions.IncludeStoryBoard = true;
                }
                else if (string.Compare(hdnIncludeStoryBoard.Value.ToLowerInvariant(), "false", true) == 0)/// If Hidden field containse "false" story board shouldn't be included in Print document
                {
                    objPrintOptions.IncludeStoryBoard = false;
                }
                else  /// If Hidden field otherthan contains "true/false" story board shouldn't be included in Print document
                {
                    objPrintOptions.IncludeStoryBoard = false;
                }
                /// If Hidden field containse "true" Page Title should be included in Print document
                if (string.Compare(hdnIncludePageTitle.Value.ToLowerInvariant(), "true", true) == 0)
                {
                    objPrintOptions.IncludePageTitle = true;
                }
                else if (string.Compare(hdnIncludePageTitle.Value.ToLowerInvariant(), "false", true) == 0)/// If Hidden field containse "false" Page Title shouldn't be included in Print document
                {
                    objPrintOptions.IncludePageTitle = false;
                }
                else  /// If Hidden field otherthan contains "true/false" Page Title shouldn't be included in Print document
                {
                    objPrintOptions.IncludePageTitle = false;
                }

                //Added few more filter options as per DWBv2.0 requirement
                //Modified by Gopinath
                //Date:11/11/2010

                //PrintMyPages
                if (!string.IsNullOrEmpty(hdnPrintMyPages.Value.Trim()))
                    objPrintOptions.PrintMyPages = Convert.ToBoolean(hdnPrintMyPages.Value.Trim().ToString());

                //Include Filter
                if (!string.IsNullOrEmpty(hdnIncludeFilter.Value.Trim()))
                    objPrintOptions.IncludeFilter = Convert.ToBoolean(hdnIncludeFilter.Value.Trim().ToString());

                //SignedOff
                if (!string.IsNullOrEmpty(hdnSignedOffPages.Value.Trim()))
                    objPrintOptions.SignedOff = hdnSignedOffPages.Value.Trim().ToString();

                //EmptyPages
                if (!string.IsNullOrEmpty(hdnEmptyPages.Value.Trim()))
                    objPrintOptions.EmptyPages = hdnEmptyPages.Value.Trim().ToString();

                //PageType
                if (!string.IsNullOrEmpty(hdnPageType.Value.Trim()))
                    objPrintOptions.PageType = hdnPageType.Value.Trim().ToString();

                //PageName
                if (!string.IsNullOrEmpty(hdnPageName.Value.Trim()))
                    objPrintOptions.PageName = hdnPageName.Value.Trim().ToString();

                //Discipline
                if (!string.IsNullOrEmpty(hdnDiscipline.Value.Trim()))
                    objPrintOptions.Discipline = hdnDiscipline.Value.Trim().ToString();

                intPrintedDocID = Print(objPrintOptions, WELLBOOKVIEWERCONTROLCHAPTER, HttpContext.Current.Request.QueryString[MODEQUERYSTRING]);

                /// Open the generated document to show in IE
                if (intPrintedDocID > 0)
                {
                    objCommonBLL = new CommonBLL();
                    strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" +
                   intPrintedDocID.ToString() + "</Value></Eq></Where>";
                    strPrintedDocURL = objCommonBLL.GetPrintedDocumentUrl(strParentSiteURL, PRINTEDDOCUMNETLIBRARY, strCamlQuery);
                    strAlertMessage = objCommonBLL.GetAlertMessage(strParentSiteURL, "Chapter");
                    if (strPrintedDocURL != null && strPrintedDocURL.Length > 0)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentprinted", "alert('"+ strAlertMessage +"');", true);
                    }
                }
                else if (intPrintedDocID == -1)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE);
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "NoDocumentsFound", @"<Script language='javaScript'>alert('Please change the filter criteria');</Script>");
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE);
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", "alert(' "+ ALERTDOCUMENTNOTPRINTED + " ')", true);
                }
            }
            catch (System.Web.Services.Protocols.SoapException soapEx)
            {
                CommonUtility.HandleException(strParentSiteURL, soapEx,1);
                lblException.Text = ALERTDOCUMENTNOTPRINTED;
                lblException.Visible = true;
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strParentSiteURL, soapEx.StackTrace, soapEx.Message, "Chapter.btnPrint_Click");

            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(strParentSiteURL, webEx,1);
                lblException.Text = ALERTDOCUMENTNOTPRINTED;
                lblException.Visible = true;
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strParentSiteURL, webEx.StackTrace, webEx.Message, "Chapter.btnPrint_Click");

            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(strParentSiteURL, ex,1);
                lblException.Text = ALERTDOCUMENTNOTPRINTED;
                lblException.Visible = true;
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strParentSiteURL, ex.StackTrace, ex.Message, "Chapter.btnPrint_Click");

            }
            finally
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE);
            }
        }
        /// <summary>
        /// Handles the Click event of the btnPrint control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void btnPrint_Click(object sender, EventArgs e)
        {
            string strAlertMessage = string.Empty;
            try
            {
                int intPrintedDocID = 0;
                string[] strPrintedDocURL = null;
                CommonBLL objCommonBLL = null;
                string strCamlQuery = string.Empty;
                PrintOptions objPrintOptions = new PrintOptions();

                //Set PrintOptions object properties through hidden fields
                objPrintOptions = SetPrintOptionsProperties(objPrintOptions);

                intPrintedDocID = Print(objPrintOptions, WELLBOOKVIEWERCONTROLBOOK, HttpContext.Current.Request.QueryString[MODEQUERYSTRING]);

                /// Open the generated document to show in IE
                if (intPrintedDocID > 0)
                {
                    objCommonBLL = new CommonBLL();
                    strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" +
                   intPrintedDocID.ToString() + "</Value></Eq></Where>";
                    strPrintedDocURL = objCommonBLL.GetPrintedDocumentUrl(strParentSiteURL, PRINTEDDOCUMNETLIBRARY, strCamlQuery);
                    strAlertMessage = objCommonBLL.GetAlertMessage(strParentSiteURL, "Book");
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentprinted", "alert('" + strAlertMessage + "');", true);
                }
                else if (intPrintedDocID == -1)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE);
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "NoDocumentsFound", @"<Script language='javaScript'>alert('Please change the filter criteria');</Script>");
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE);
                    this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", ALERTDOCUMENTNOTPRINTED, true);
                }
            }
            catch (System.Web.Services.Protocols.SoapException soapEx)
            {
                CommonUtility.HandleException(strParentSiteURL, soapEx, 1);
                lblException.Text = ALERTDOCUMENTNOTPRINTED;
                lblException.Visible = true;
                ExceptionBlock.Visible = true;
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strParentSiteURL, soapEx.StackTrace, soapEx.Message, "WellBookSummary.btnPrint_Click");

            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(strParentSiteURL, webEx, 1);
                lblException.Text = ALERTDOCUMENTNOTPRINTED;
                lblException.Visible = true;
                ExceptionBlock.Visible = true;
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strParentSiteURL, webEx.StackTrace, webEx.Message, "WellBookSummary.btnPrint_Click");

            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(strParentSiteURL, ex, 1);
                lblException.Text = ALERTDOCUMENTNOTPRINTED;
                lblException.Visible = true;
                ExceptionBlock.Visible = true;
                PdfBLL objPdfBLL = new PdfBLL();
                objPdfBLL.PrintLog(strParentSiteURL, ex.StackTrace, ex.Message, "WellBookSummary.btnPrint_Click");

            }
            finally
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE);
            }
        }
        /// <summary>
        /// Publishes the Well book.
        /// </summary>
        /// <param name="rowId">The book id.</param>
        private void Publish(int rowId)
        {
            WellBookBLL objWellBook = new WellBookBLL();
            CommonBLL objCommonBLL = new CommonBLL();
            string strActionPerformed = string.Empty;
            string strAlertMessage = string.Empty;

            /// Validate the new book name is not already exists in DWB Books list
            if (!CheckDuplicateName(txtNewBookName.Text.Trim(), DWBTITLECOLUMN, DWBBOOKLIST))
            {
                PrintOptions objPrintOptions = new PrintOptions();
                objPrintOptions.IncludeStoryBoard = false;
                objPrintOptions.IncludePageTitle = true;
                objPrintOptions.IncludeBookTitle = true;
                objPrintOptions.IncludeTOC = true;
                System.Xml.XmlDocument objDWBBookXML = objWellBook.GenerateDWBBookXML(strParentSiteURL, rowId, BOOKACTIONPUBLISH, true,objPrintOptions);

                string strSiteURL = strParentSiteURL;
                SslRequiredWebPart objSslRequired = new SslRequiredWebPart();

                strSiteURL = objSslRequired.GetSslURL(strSiteURL);

                string strBookName = objDWBBookXML.DocumentElement.Attributes["BookName"].Value.ToString();
                string strRequestID = Guid.NewGuid().ToString();
                string strCurrentUser = GetUserName();
                string strLiveBookName = txtNewBookName.Text.Trim();
                UpdateDWBBookPrintDetails(strCurrentUser, strRequestID, strBookName, strLiveBookName, objDWBBookXML, rowId);
                TerminateLiveBook(rowId, DWBBOOKLIST);
                pnlPublishBook.Visible = false;
                strAlertMessage = objCommonBLL.GetAlertMessage(strParentSiteURL, "Publish");
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentprinted", "alert(' " + strAlertMessage + "');window.close();", true);
            }
            else
            {
                ExceptionBlock.Visible = true;
                lblException.Visible = true;
                lblException.Text = BOOKTITLEEXISTSMESSAGE;
            }
        }