/// <summary>
 /// Updates the page sign off status
 /// </summary>
 /// <param name="rowid"></param>
 /// <param name="signOffStatus"></param>
 protected void UpdatePageSignOffStatus(int rowid, string signOffStatus)
 {
     objWellBook = new WellBookBLL();
     strSiteURL = SPContext.Current.Site.Url.ToString();
     if (signOffStatus.Equals("PageSignOff"))
     {
         objWellBook.UpdateWellBookPageSignOffStatus(strSiteURL, CHAPTERPAGEMAPPINGLIST, STATUS_SIGNEDOFF, rowid, AUDIT_ACTION_SIGNEDOFF);
     }
     else
     {
         objWellBook.UpdateWellBookPageSignOffStatus(strSiteURL, CHAPTERPAGEMAPPINGLIST, STATUS_UNSIGNEDOFF, rowid, AUDIT_ACTION_UNSIGNEDOFF);
     }
 }
 /// <summary>
 /// Updates the DWB book print details.
 /// </summary>
 /// <param name="currentUser">The current user.</param>
 /// <param name="requestID">The request ID.</param>
 /// <param name="bookName">Name of the book.</param>
 /// <param name="liveBookName">Name of the live book.</param>
 /// <param name="xmlDoc">The XML doc.</param>
 /// <param name="bookID">The book ID.</param>
 private void UpdateDWBBookPrintDetails(string currentUser, string requestID, string bookName, string liveBookName, XmlDocument xmlDoc, int bookID)
 {
     string strDocumentURL = PortalConfiguration.GetInstance().GetKey("DWBPublishNetworkPath") + bookName + ".pdf";
     //Call BLL method to update the list named "DWB Chapter Print Details" with the above details.
     WellBookBLL objBookBLL = new WellBookBLL();
     objBookBLL.UpdateBookPublishDetails(requestID, strDocumentURL, strParentSiteURL, currentUser, true, liveBookName, xmlDoc, bookID);
 }
Exemple #3
0
        /// <summary>
        /// Sets the master page details.
        /// </summary>
        private void GetMasterPageDetails()
        {
            switch (strListType)
            {
                case CHAPTERPAGES:
                    objChapterBll = new ChapterBLL();
                    objListEntry = objChapterBll.GetChapterPages(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>");
                    break;
                case BOOKPAGES:
                    objWellBook = new WellBookBLL();
                    objListEntry = objWellBook.GetBookPages(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>");
                    break;
                case TEMPLATEMASTERPAGES:
                    {
                        objTemplateBLL = new TemplateDetailBLL();
                        string strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>";

                        string strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Asset_Type' /><FieldRef Name='Connection_Type' /><FieldRef Name='Page_Owner' /><FieldRef Name='Page_Sequence' /><FieldRef Name='Page_URL' /><FieldRef Name='Discipline' /><FieldRef Name='Standard_Operating_Procedure' /><FieldRef Name='Page_Title_Template' /><FieldRef Name='Template_ID' /><FieldRef Name='Master_Page_Name' /><FieldRef Name='Master_Page_ID' />";
                        objListEntry = objTemplateBLL.GetMasterPageDetails(strParentSiteURL, TEMPLATEPAGESMAPPINGLIST, strCAMLQuery, strViewFields);
                        break;
                    }
                default:
                    objListEntry = GetDetailsForSelectedID(strSelectedID, MASTERPAGELIST, MASTERPAGE);
                    break;
            }
        }
Exemple #4
0
        /// <summary>
        /// Gets the well book detail XML.
        /// </summary>
        /// <param name="action">The action.</param>
        /// <returns></returns>
        private XmlDocument GetWellBookDetailXML(string action)
        {
            XmlDocument xmlWellBookDetails = null;
            string strBookID = string.Empty;
            string strChapterID = string.Empty;
            if (HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID] != null)
            {
                strBookID = HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID];
            }
            if (strBookID.Length > 0)
            {
                WellBookBLL objWellBookBLL = new WellBookBLL();
                PrintOptions objPrintOptions = new PrintOptions();
                objPrintOptions.IncludeBookTitle = false;
                objPrintOptions.IncludePageTitle = false;
                objPrintOptions.IncludeStoryBoard = false;

                BookInfo objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, strBookID, action, true, objPrintOptions);
                CommonBLL objCommonBLL = new CommonBLL();
                HttpContext.Current.Session[SESSION_TREEVIEWDATAOBJECT] = objBookInfo;
                if (HttpContext.Current.Request.QueryString[QUERYSTRING_IDVALUE] != null)
                {
                    strChapterID = HttpContext.Current.Request.QueryString[QUERYSTRING_IDVALUE];
                }
                if (HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID] != null)
                {
                    strChapterID = HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID];
                }
                xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo);
            }
            return xmlWellBookDetails;
        }
        /// <summary>
        /// DoWork is virtual method of LongRunningOperationJob base class and overrided into BatchImportLongRunningProcess.
        /// </summary>
        public override void DoWork()
        {
            this.StatusDescription = "Batch Import started...";
            this.UpdateStatus();
            string strError = string.Empty;
            this.Title = "Batch Import";
            this.WaitMessage = "Please wait while all the documents are uploaded...";
            this.RedirectWhenFinished = false;
            this.UserCanCancel = true;

            this.MillisecondsToWaitForFinish = 100;
            this.TotalOperationsToBePerformed = 100;
            string strCompletePath = string.Empty;
            string strFileName = string.Empty;
            int intCounter = 1;
            DataTable dtBatchLog = new DataTable();
            dtBatchLog.Columns.Add("PageName");
            dtBatchLog.Columns.Add("ChapterName");
            dtBatchLog.Columns.Add("DateAndTime");
            dtBatchLog.Columns.Add("Status");
            dtBatchLog.Columns.Add("Detail");

            foreach (DataRow eachRow in dtBatchUpload.Rows)
            {
                strError = string.Empty;
                this.StatusDescription = "Uploading Document " + intCounter.ToString();
                this.UpdateStatus();
                try
                {
                    #region Call UploadFile to document library
                    if (this.UserRequestedCancel)
                    {
                        break;
                    }
                    else
                    {
                        //Fetch the complete path from data table
                        strCompletePath = eachRow["CompleteSharedPath"].ToString();
                        if (!string.IsNullOrEmpty(strCompletePath))
                        {
                            strFileName = strCompletePath.Substring(strCompletePath.LastIndexOf("\\") + 1);
                            UploadFileToDocumentLibrary(strCompletePath, strFileName, eachRow["PageId"].ToString());
                        }

                    }
                    #endregion Call UploadFile to document library
                }
                catch (FileNotFoundException fnfException)
                {
                    strError = fnfException.Message;
                    dtBatchLog.Rows.Add(eachRow["PageName"].ToString(), eachRow["ChapterName"].ToString(), DateTime.Now, "Fail", strError);
                    continue;
                }
                catch (Exception Ex)
                {
                    strError = Ex.Message;
                    dtBatchLog.Rows.Add(eachRow["PageName"].ToString(), eachRow["ChapterName"].ToString(), DateTime.Now, "Fail", strError);
                    continue;
                }

                if (string.IsNullOrEmpty(strError))
                {
                    dtBatchLog.Rows.Add(eachRow["PageName"].ToString(), eachRow["ChapterName"].ToString(), DateTime.Now, "Success", "");
                }

                this.OperationsPerformed++;
            }

            //Add BatchLog data table to sharepoint list.
            objWellBookBLL = new WellBookBLL();
            objWellBookBLL.SaveBatchImportLog(Web.Url, BATCHIMPORTLOGLISTNAME, dtBatchLog);

            if (this.UserRequestedCancel)
            {
                this.StatusDescription = "Batch Import Could not complete as you have canceled the process in between.";
            }
            else
            {
                this.StatusDescription = "Batch Import Process completed successfully, Please check the logs to know more details.";
            }
            this.NavigateWhenDoneUrl = "/Pages/BatchImportStatus.aspx?status=" + this.StatusDescription;
            this.UpdateStatus();
        }
Exemple #6
0
        /// <summary>
        /// Handles the Button click  event of the SignOff Button
        /// Added By: Praveena 
        /// Date:11/09/2010
        /// Reason: Button click  event of the SignOff Button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnSignOff_Click(object sender, EventArgs e)
        {
            try
            {
                if (rblSignOffStatus.SelectedIndex == -1)
                {
                    string strPageStatus = HttpContext.Current.Request.QueryString["pageStatus"];
                    if (string.Equals(strPageStatus, "SignedOff"))
                    {
                        btnSignOff.Text = UNSIGNOFF;
                    }
                    else if (string.Equals(strPageStatus, "NotSignedOff"))
                    {
                        btnSignOff.Text = SIGNOFF;
                    }
                }
                else if (rblSignOffStatus.SelectedIndex == 0)
                {
                    btnSignOff.Text = UNSIGNOFF;
                }
                else
                {
                    btnSignOff.Text = SIGNOFF;
                }
                string strSignOffPages = string.Empty;
                strSignOffPages = hdnSignOffPageIds.Value;
                string strAction = string.Empty;

                /// Update the Chapter Pages Mapping List and Audit List

                objWellBook = new WellBookBLL();
                if (string.Equals(btnSignOff.Text, SIGNOFF))
                {
                    strAction = "PageSignOff";
                    UpdateBulkPageSignOffStatus(strSignOffPages, strAction);
                }
                else if (string.Equals(btnSignOff.Text, UNSIGNOFF))
                {
                    strAction = "PageUnsignOff";
                    UpdateBulkPageSignOffStatus(strSignOffPages, strAction);
                }
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), webEx);
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                hdnSignOffPageIds.Value = string.Empty;
            }
        }
Exemple #7
0
        /// <summary>
        /// Sets the Well Book Owners from Asset Team Mapping list
        /// </summary>
        /// <param name="lstWellbookOwners"></param>
        /// <param name="strSourcelistName"></param>
        /// <param name="strAddedListvalues"></param>
        /// <param name="blnEdit"></param>
        /// <param name="strSeletectedID"></param>
        protected void SetWellBookOwners(ListBox lstWellbookOwners, string strSourcelistName, string
            strAddedListvalues, bool blnEdit, string strSeletectedID)
        {
            DataTable objListData = null;
            DataTable objExistingEntries = null;
            DataRow objListRow;
            string strCurrentUsername = string.Empty;
            string strQuerystring = string.Empty;
            ListItem lstItem;
            try
            {
                strCurrentUsername = GetUserName();
                objWellBookBLL = new WellBookBLL();
                strQuerystring = @"<Where>
                 <Contains>
                    <FieldRef Name='Privileges' />
                    <Value Type='Text'>WO</Value>
                 </Contains>
                 </Where>";
                objListData = objWellBookBLL.GetListDetails(strParentSiteURL, strSourcelistName,
                    strQuerystring);
                if (objListData != null && objListData.Rows.Count > 0)
                {
                    /// Loop through the values in Asset team mapping based
                    lstWellbookOwners.Items.Clear();

                    for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++)
                    {
                        objListRow = objListData.Rows[intRowIndex];
                        lstItem = new ListItem();
                        lstItem.Text = objListRow[DWBTITLECOLUMN].ToString();
                        lstItem.Value = objListRow[DWBTITLECOLUMN].ToString();
                        lstWellbookOwners.Items.Add(lstItem);

                    }

                    if (blnEdit)
                    {
                        strQuerystring = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" +
                            strSeletectedID + "</Value></Eq></Where>";

                        objExistingEntries = objWellBookBLL.GetListDetails(strParentSiteURL, strAddedListvalues,
                            strQuerystring);
                        string strexistingWellbookOnwer = string.Empty;
                        if (objExistingEntries != null && objExistingEntries.Rows.Count > 0)
                        {
                            for (int intRowIndex = 0; intRowIndex < objExistingEntries.Rows.Count; intRowIndex++)
                            {
                                objListRow = objExistingEntries.Rows[intRowIndex];
                                strexistingWellbookOnwer = objListRow["Well_Book_Owner"].ToString();
                            }
                            foreach (ListItem objListItem in lstWellbookOwners.Items)
                            {
                                if (strexistingWellbookOnwer.Contains(objListItem.Value))
                                {
                                    objListItem.Selected = true;
                                }
                            }
                        }
                    }
                }
            }
            catch
            { throw; }
            finally
            {
                if (objListData != null)
                    objListData.Dispose();
                if (objExistingEntries != null)
                    objExistingEntries.Dispose();
            }
        }
Exemple #8
0
 /// <summary>
 /// Gets
 /// </summary>
 /// <param name="cboList"></param>
 /// <param name="listname"></param>
 /// <param name="strCAMLQuery"></param>
 protected void GetTeamUsers(DropDownList cboList, string listname, string strCAMLQuery)
 {
     objWellBookBLL = new WellBookBLL();
     cboList.Items.Clear();
     cboList.DataSource = objWellBookBLL.GetOwnerForTeam(strParentSiteURL, listname, strCAMLQuery);
     cboList.DataTextField = "value";
     cboList.DataValueField = "key";
     cboList.DataBind();
 }
        /// <summary>
        /// Gets the list of page owners.
        /// Modified By: Praveena  
        /// Date:03/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="username">User Name.</param>
        void GetOwnerPageDetails(string username, string pageName, string terminatedStatus, System.Text.StringBuilder chapterNames)
        {
            try
            {
                DataTable dtResulttable = null;
                DataTable dtTabletoBind = null;
                PageOwnerGridViewPanelID.Visible = true;
                lblNoDetails.Visible = false;
                string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID' />
                 <Value Type='Number'>" + strSelectedID + "</Value></Eq></Where>";
                objWellBook = new WellBookBLL();
                dtResulttable = objWellBook.GetPagesForOwner(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery, username, pageName, terminatedStatus, chapterNames);
                if (dtResulttable != null && dtResulttable.Rows.Count > 0)
                {
                    dtTabletoBind = dtResulttable.DefaultView.ToTable("BindTable", true, "ChapterName", CONNECTIONTYPECOLUMN, PAGENAMECOLUMN, DISCIPLINECOLUMN, OWNERCOLUMN,
                         EMPTYCOLUMN, SIGNOFFSTATUSCOLUMN, DWBIDCOLUMN);
                    pageOwnerGridview.DataSource = dtTabletoBind;
                    pageOwnerGridview.DataBind();
                    if (dtTabletoBind.Rows.Count == 0)
                    {
                        lblNoDetails.Visible = true;
                        PageSelectionVisible = false;
                        cboNewOwner.Visible = false;
                        btnCancel.Visible = false;
                        btnSaveAndChangeMore.Visible = false;
                        btnSave.Visible = false;
                        lblNewOwner.Visible = false;
                    }
                    else
                    {
                        lblNoDetails.Visible = false;
                        PageSelectionVisible = true;
                        cboNewOwner.Visible = true;
                        btnCancel.Visible = true;
                        btnSaveAndChangeMore.Visible = true;
                        btnSave.Visible = true;
                        lblNewOwner.Visible = true;

                    }
                }
                GetTeamUsers();
                if (dtResulttable != null)
                {
                    dtResulttable.Dispose();
                }
                if (dtTabletoBind != null)
                {
                    dtTabletoBind.Dispose();
                }
                /// Calling Javascript method DWBFixCheckBoxAlignment(gridID) to set the CheckBox column alignment as "center"
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "FixGridWidth", "DWBFixCheckBoxAlignment('" + pageOwnerGridview.ClientID + "');", true);
            }
            catch (Exception ex)
            {

                CommonUtility.HandleException(strParentSiteURL, ex);

            }
        }
Exemple #10
0
        /// <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;
        }
        /// <summary>
        /// Uploads the each page to doc lib.
        /// </summary>
        /// <param name="dtBatchUpload">The dt batch upload.</param>
        private void UploadEachPageToDocLib(DataTable dtBatchUpload)
        {
            try
            {
                //SPWEB used for Current Batch import log running process.
                SPWeb Web = SPContext.Current.Web;

                //Clear the Batch Import log List before starting the Batch new import process.
                objWellBookBLL = new WellBookBLL();
                objWellBookBLL.ClearBatchImportLog(Web.Url, BATCHIMPORTLOGLISTNAME);

                BatchImportLongRunningProcess objBatchImportLong = new BatchImportLongRunningProcess(Web, dtBatchUpload);
                UpdateAuditTrailForBatchImport();
                Web.AllowUnsafeUpdates = true;
                Web.Update();
                objBatchImportLong.Start(Web);
                string url = string.Format("{0}{1}?JobId={2}", Web.Url, "/_layouts/LongRunningOperationProgress.aspx", objBatchImportLong.JobId);
                SPUtility.Redirect(url, SPRedirectFlags.Default, this.Context);
            }
            catch (Exception)
            {
                throw;
            }
        }
 /// <summary>
 /// To Update Batch Import Audit History 
 /// </summary>
 private void UpdateAuditTrailForBatchImport()
 {
     objWellBookBLL=new WellBookBLL();
     objWellBookBLL.UpdateBatchImportAuditHistory(strParentSiteURL,strWellBookId, AUDIT_ACTION_BATCHIMPORT);
 }
Exemple #13
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;
        }
Exemple #14
0
        /// <summary>
        /// Added By Gopinath
        /// Date : 27/11/2010
        /// Reason : PageOwner exists any of chapter list and pages print button should dispaly.
        /// </summary>
        /// <param name="BookID"></param>
        /// <returns></returns>
        protected bool CheckPageOwnerInBookList(string BookID)
        {
            DataView dvResultView = null;
            DataTable dtPageOwner = null;
            DataTable dtBookSummary = null;
            StringBuilder strChapterId = new StringBuilder();
            DataRow drSummaryRow;
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            string strCurrentUserName = string.Empty;
            bool blnCurrentPOExists = false;

            if (!string.IsNullOrEmpty(BookID))
            {
                strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + BookID + "</Value></Eq></Where>";
                strViewFields = @"<FieldRef Name='ID'/>";
                objCommonBLL = new CommonBLL();
                DataTable dtresult = objCommonBLL.ReadList(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery);

                //Check for chapterIDs
                if (dtresult != null && dtresult.Rows.Count > 0)
                {
                    objWellBookBLL = new WellBookBLL();
                    dtresult = objWellBookBLL.GetPagesForBook(strParentSiteURL, BookID, "No");

                    if (dtresult != null && dtresult.Rows.Count > 0)
                    {
                        dvResultView = dtresult.DefaultView;
                        if (dvResultView != null && dvResultView.Count > 0)
                        {
                            dtPageOwner = dvResultView.ToTable(true, "Owner");
                        }
                    }
                    if (dtPageOwner != null && dtPageOwner.Rows.Count > 0)
                    {
                        strCurrentUserName = GetUserName();

                        foreach (DataRow drRow in dtPageOwner.Rows)
                        {
                            //if(drRow["Owner"].ToString()
                            if (string.Compare(drRow["Owner"].ToString(), strCurrentUserName, true)==0)
                            {
                                blnCurrentPOExists = true;
                                break;
                            }
                        }
                    }
                }
                if (dtPageOwner != null)
                {
                    dtPageOwner.Dispose();
                }
                if (dtresult != null)
                {
                    dtresult.Dispose();
                }
            }

            return blnCurrentPOExists;
        }
Exemple #15
0
        /// <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;
        }
Exemple #16
0
        /// <summary>
        /// Gets the details for selected ID.
        /// </summary>
        /// <param name="selectedID">The selected ID.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="pageType">Type of the page.</param>
        /// <returns></returns>
        protected DWBDataObjects.ListEntry GetDetailsForSelectedID(string selectedID, string listName, string pageType)
        {
            string strQueryString;
            DWBDataObjects.ListEntry objListEntry = null;
            try
            {
                strQueryString = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + selectedID + "</Value></Eq></Where>";
                switch (pageType)
                {
                    case MASTERPAGE:
                        {
                            objMasterBLL = new MasterPageBLL();
                            objListEntry = objMasterBLL.SetMasterPageDetail(strParentSiteURL, listName,
                                strQueryString);
                            break;
                        }
                    case TEMPLATE:
                        {
                            objTemplateBLL = new TemplateDetailBLL();
                            objListEntry = objTemplateBLL.GetTemplateDetail(strParentSiteURL, listName,
                                strQueryString);
                            break;
                        }
                    case WELLBOOK:
                        {
                            objWellBookBLL = new WellBookBLL();
                            objListEntry = objWellBookBLL.GetWellBookDetail(strParentSiteURL, listName,
                                strQueryString);
                            break;
                        }
                    case CHAPTER:
                        {
                            objChapterBLL = new ChapterBLL();
                            objListEntry = objChapterBLL.SetChapterDetail(strParentSiteURL, listName, strQueryString);
                            break;
                        }

                    case USERREGISTRATION:
                        {
                            UserRegistrationBLL objUserRegistrationBLL = new UserRegistrationBLL();
                            objListEntry = objUserRegistrationBLL.GetUserDetails(strParentSiteURL, selectedID, listName);
                            break;
                        }

                    case TEAMREGISTRATION:
                    case STAFFREGISTRATION:
                        {
                            TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL();
                            objListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strParentSiteURL, selectedID, listName);
                            break;
                        }
                }
                return objListEntry;
            }
            catch
            {
                throw;
            }
        }
Exemple #17
0
 /// <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);
 }
Exemple #18
0
        /// <summary>
        /// Gets the well book summary.
        /// </summary>
        /// <param name="BookID">The book ID.</param>
        /// <returns></returns>
        protected DataTable GetWellBookSummary(string BookID)
        {
            DataView dvResultView = null;
            DataTable dtPageOwner = null;
            int intTotal = 0;
            int intSignOff = 0;
            int intNotSignOff = 0;
            int intEmpty = 0;
            int intFooterTotal = 0;
            int intFooterSignOff = 0;
            int intFooterNotSignOff = 0;
            int intFooterEmpty = 0;
            string strValue = string.Empty;
            DataTable dtBookSummary = null;
            StringBuilder strChapterId = new StringBuilder();
            DataRow drSummaryRow;
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            if (!string.IsNullOrEmpty(BookID))
            {
                strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + BookID + "</Value></Eq></Where>";
                strViewFields = @"<FieldRef Name='ID'/>";
                objCommonBLL = new CommonBLL();
                DataTable dtresult = objCommonBLL.ReadList(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery);
                if (dtresult != null && dtresult.Rows.Count > 0)
                {
                    intFooterEmpty = 0;
                    intFooterNotSignOff = 0;
                    intFooterSignOff = 0;
                    intFooterTotal = 0;

                    objWellBookBLL = new WellBookBLL();
                    dtresult = objWellBookBLL.GetPagesForBook(strParentSiteURL, BookID, "No");
                    if (dtresult != null && dtresult.Rows.Count > 0)
                    {
                        dvResultView = dtresult.DefaultView;
                        if (dvResultView != null && dvResultView.Count > 0)
                        {
                            dtPageOwner = dvResultView.ToTable(true, "Owner");
                        }
                    }
                    if (dtPageOwner != null && dtPageOwner.Rows.Count > 0)
                    {
                        dtBookSummary = GetSummaryTable();
                        for (int intRowIndex = 0; intRowIndex < dtPageOwner.Rows.Count; intRowIndex++)
                        {
                            intTotal = 0;
                            intSignOff = 0;
                            intNotSignOff = 0;
                            intEmpty = 0;
                            dvResultView.RowFilter = "Owner ='" + Convert.ToString(dtPageOwner.Rows[intRowIndex]["Owner"]) + "'";
                            for (int intViewIndex = 0; intViewIndex < dvResultView.Count; intViewIndex++)
                            {
                                intTotal = intTotal + 1;
                                strValue = Convert.ToString(dvResultView[intViewIndex][EMPTYCOLUMN]);
                                if (strValue.Equals("Yes"))
                                {
                                    intEmpty = intEmpty + 1;

                                }
                                strValue = Convert.ToString(dvResultView[intViewIndex]["Sign_Off_Status"]);
                                if (strValue.Equals("Yes"))
                                {
                                    intSignOff = intSignOff + 1;

                                }
                                else
                                {
                                    intNotSignOff = intNotSignOff + 1;
                                }

                            }
                            drSummaryRow = dtBookSummary.NewRow();
                            drSummaryRow["Page_Owner"] = Convert.ToString(dtPageOwner.Rows[intRowIndex]["Owner"]);
                            drSummaryRow[TOTALCOLUMN] = intTotal;
                            drSummaryRow["Signed_Off"] = intSignOff;
                            drSummaryRow["NotSigned_Off"] = intNotSignOff;
                            drSummaryRow[EMPTYCOLUMN] = intEmpty;
                            dtBookSummary.Rows.Add(drSummaryRow);
                            intFooterTotal = intFooterTotal + intTotal;
                            intFooterSignOff = intFooterSignOff + intSignOff;
                            intFooterNotSignOff = intFooterNotSignOff + intNotSignOff;
                            intFooterEmpty = intFooterEmpty + intEmpty;
                        }
                        drSummaryRow = dtBookSummary.NewRow();
                        drSummaryRow["Page_Owner"] = TOTALCOLUMN;
                        drSummaryRow[TOTALCOLUMN] = intFooterTotal;
                        drSummaryRow["Signed_Off"] = intFooterSignOff;
                        drSummaryRow["NotSigned_Off"] = intFooterNotSignOff;
                        drSummaryRow[EMPTYCOLUMN] = intFooterEmpty;
                        dtBookSummary.Rows.Add(drSummaryRow);

                    }
                }
                if (dtPageOwner != null)
                {
                    dtPageOwner.Dispose();
                }
                if (dtresult != null)
                {
                    dtresult.Dispose();
                }
            }
            return dtBookSummary;
        }
Exemple #19
0
 /// <summary>
 /// Callbacks the method.
 /// </summary>
 /// <param name="asyncResult">The async result.</param>
 private void CallbackMethod(IAsyncResult asyncResult)
 {
     WellBookBLL objBookBLL = null;
     try
     {
         string strResults = string.Empty;
         // Create an instance of the WebService
         objPDFService = (PDFServiceSPProxy)asyncResult.AsyncState;
         strResults = objPDFService.EndGeneratePDFDocument(asyncResult);
         objBookBLL = new WellBookBLL();
         //strDocumentURL = objBookBLL.GetPrintDocumentURL(strResults, strParentSiteURL, strAddress, contextForEmails, "DWB Chapter Print Details");
         objBookBLL.SendEmailToUserOnPrint(strResults, strParentSiteURL, strAddress, contextForEmails);
     }
     catch (SoapException)
     {
         throw;
     }
 }
Exemple #20
0
 /// <summary>
 /// Handles the Click event of the Add To Favorites 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>
 void BtnAddToFavorites_Click(object sender, EventArgs e)
 {
     string strFavroites = hdnSelectedAsFavorite.Value;
     strSiteURL = SPContext.Current.Site.Url.ToString();
     /// Update the DWB User list with the favorites selected.
     strUserName = GetUserName();
     objWellBook = new WellBookBLL();
     if (string.Compare(btnAddToFavorites.Text, ADDTOFAVORITES, true) == 0)
     {
         objWellBook.AddToFavorites(strSiteURL, strFavroites, USERLIST, strUserName, true);
     }
     else if (string.Compare(btnAddToFavorites.Text, REMOVEFROMFAVORITES, true) == 0)
     {
         objWellBook.AddToFavorites(strSiteURL, strFavroites, USERLIST, strUserName, false);
     }
 }
Exemple #21
0
        /// <summary>
        /// Creates the chapter info.
        /// </summary>
        /// <param name="chapterNode">The chapter node.</param>
        /// <returns></returns>
        private DWBDataObjects.ChapterInfo CreateChapterInfo(RadTreeNode chapterNode)
        {
            string strSplitter = ";";
            StringBuilder strPageIds = new StringBuilder();
            ArrayList arlPageDetails = new ArrayList();
            //bool blnAddChapter = false;
            DWBDataObjects.ChapterInfo objChapterInfo = null;
            WellBookBLL objWellBookBLL = new WellBookBLL();
            DataTable dtPageIds = null;

            /// Loop for Pages node and print only selected Pages.
            if (chapterNode != null)
            {
                if (chapterNode.Nodes != null && chapterNode.Nodes.Count > 0)
                {
                    foreach (RadTreeNode pageNode in chapterNode.Nodes)
                    {
                        if (pageNode.Checked)
                        {
                            strPageIds.Append(pageNode.Value);
                            strPageIds.Append(strSplitter);
                        }
                    }

                    //Get Pages in each Chapter
                    strPageIds = GetPagesInEachChapter(strPageIds.ToString());

                }
                else
                {
                    string strViewFields = "<FieldRef Name='ID' />";
                    #region Fix to avoid printing the terminated pages when chapter is not expanded
                    /// CAML Query is updated to add "<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq>" condition
                    string strCamlQuery = @"<Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Chapter_ID' /><Value Type='Counter'>" + chapterNode.Value + "</Value></Eq></And></Where>";
                    #endregion
                    dtPageIds = objCommonBLL.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery, strViewFields);
                    if (dtPageIds != null && dtPageIds.Rows.Count > 0)
                    {
                        foreach (DataRow row in dtPageIds.Rows)
                        {
                            strPageIds.Append(row[0].ToString() + strSplitter);
                        }
                    }
                    //Get Pages in each Chapter
                    strPageIds = GetPagesInEachChapter(strPageIds.ToString());

                    /// Get all the pages for the chapter and print
                    //objChapterInfo = objWellBookBLL.SetChapterDetails(strParentSiteURL, chapterNode.Value, true);
                }
                if (strPageIds != null && strPageIds.Length > 0)
                {
                    /// Create Chapter Object
                    objChapterInfo = objWellBookBLL.SetChapterDetails(strParentSiteURL, chapterNode.Value, false);
                    /// Create Pages Collection
                    if (objChapterInfo != null)
                    {
                        arlPageDetails = objWellBookBLL.SetSelectedPageInfo(strParentSiteURL, strPageIds.ToString(), objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName);

                        if (arlPageDetails.Count > 0)
                        {
                            objChapterInfo.PageInfo = arlPageDetails;
                        }
                        if (objChapterInfo.PageInfo == null)
                        {
                            objChapterInfo = null;
                        }
                    }
                }

            }

            //Added IF condition to check the object null or not.
            /// Indicate wheter Chapter Title is Printable or  not.
            /// Added for Print Options CR Implementation
            if (objChapterInfo != null)
                objChapterInfo.IsPrintable = true;

            return objChapterInfo;
        }
 /// <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);
     }
 }
Exemple #23
0
 private void UpdateDWBChapterPrintDetails(string currentUser, string requestID, string bookName)
 {
     strDocumentURL = String.Empty;
     strDocumentURL = PortalConfiguration.GetInstance().GetKey("DWBPrintNetworkPath") + string.Format("{0}_{1}", bookName, requestID) + ".pdf";
     //Call BLL method to update the list named "DWB Chapter Print Details" with the above details.
     WellBookBLL objBookBLL = new WellBookBLL();
     objBookBLL.UpdateChapterPrintDetails(requestID, strDocumentURL, strParentSiteURL, currentUser);
 }
Exemple #24
0
 /// <summary>
 /// Updates the master page details.
 /// </summary>
 private void UpdateMasterPageDetails()
 {
     string strActionPerformed = AUDITACTIONCREATION;
     if (string.Compare(strMode,EDIT) == 0)
     {
         strActionPerformed = AUDITACTIONUPDATION;
     }
     objUtility = new CommonUtility();
     string strUserName = objUtility.GetUserName();
     switch (strListType)
     {
         case BOOKPAGES:
             objWellBook = new WellBookBLL();
             objWellBook.UpdateBookPage(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, strUserName, strActionPerformed);
             break;
         case CHAPTERPAGES:
             objWellBook = new WellBookBLL();
             objWellBook.UpdateBookPage(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, strUserName, strActionPerformed);
             break;
         case TEMPLATEMASTERPAGES:
             objTemplateBLL = new TemplateDetailBLL();
             objTemplateBLL.UpdateMasterPageDetail(strParentSiteURL, TEMPLATEPAGESMAPPINGLIST, TEMPLATECONFIGURATIONAUDIT, objListEntry, strActionPerformed, strUserName);
             break;
         default:
             UpdateListEntry(objListEntry, MASTERPAGELIST, MASTERPAGEAUDITLIST, MASTERPAGE, strActionPerformed);
             break;
     }
 }
Exemple #25
0
 /// <summary>
 /// Binds the data to controls.
 /// </summary>
 /// <param name="cboList">The cbo list.</param>
 /// <param name="listname">The listname.</param>
 /// <param name="pageType">Type of the page.</param>
 /// <param name="strCAMLQuery">The STR CAML query.</param>
 protected void BindDataToControls(DropDownList cboList, string listname, string pageType, string strCAMLQuery)
 {
     switch (pageType)
     {
         case WELLBOOK:
             objWellBookBLL = new WellBookBLL();
             cboList.Items.Clear();
             cboList.DataSource = objWellBookBLL.GetListItems(strParentSiteURL, listname, strCAMLQuery);
             cboList.DataTextField = "value";
             cboList.DataValueField = "key";
             cboList.DataBind();
             break;
         case CHAPTER:
             objChapterBLL = new ChapterBLL();
             cboList.Items.Clear();
             cboList.DataSource = objChapterBLL.GetListItems(strParentSiteURL, listname, strCAMLQuery);
             cboList.DataTextField = "value";
             cboList.DataValueField = "key";
             cboList.DataBind();
             break;
         case CHANGEPAGEOWNER:
             objWellBookBLL = new WellBookBLL();
             cboList.Items.Clear();
             cboList.DataSource = objWellBookBLL.GetPageOwnerList(strParentSiteURL, listname, strCAMLQuery);
             cboList.DataTextField = "value";
             cboList.DataValueField = "key";
             cboList.DataBind();
             break;
         default:
             break;
     }
 }
 /// <summary>
 /// This method binds the values to grid on Page load
 /// </summary>
 private void PopulateGrid()
 {
     grdBatchImportConfiguration.CssClass = WELLBOOKSUMMARYCSS;
     grdBatchImportConfiguration.EnableViewState = true;
     grdBatchImportConfiguration.HeaderStyle.CssClass = FIXEDHEADERCSS;
     grdBatchImportConfiguration.HeaderStyle.Height = new Unit(20, UnitType.Pixel);
     grdBatchImportConfiguration.RowStyle.CssClass = EVENROWSTYLECSS;
     grdBatchImportConfiguration.AlternatingRowStyle.CssClass = ODDROWSTYLECSS;
     XmlDocument batchImportDoc = null;
     BatchImportBLL ObjBatchImportBLL = new BatchImportBLL();
     try
     {
         batchImportDoc = ObjBatchImportBLL.GetOnlyBatchImportXML(strBookID);
         //loading grid from values configured in XML
         if (batchImportDoc != null)
         {
             objWellBookBLL = new WellBookBLL();
             DataTable dtResult = objWellBookBLL.GetTypeIIIPagesForBook(strParentSiteURL, strBookID, "No");
             DataView dvResultTable;
             dvResultTable = dtResult.DefaultView;
             dtResult = dvResultTable.ToTable(true, "Page_Name");
             grdBatchImportConfiguration.DataSource = dtResult;
             grdBatchImportConfiguration.DataBind();
             foreach (GridViewRow gdvRow in grdBatchImportConfiguration.Rows)
             {
                 XmlNode node = batchImportDoc.SelectSingleNode("/batchImport[@BookID='" + strBookID + "']/pageName[@name='" + HttpUtility.HtmlDecode(gdvRow.Cells[0].Text) + "']");
                 if (node != null)
                 {
                     TextBox txtSharedAreaPath = (TextBox)gdvRow.FindControl("txtSharedAreaPath");
                     txtSharedAreaPath.Text = node.SelectSingleNode("sharedPath").Attributes["path"].Value;
                     DropDownList cboFileType = (DropDownList)gdvRow.FindControl("cboFileType");
                     foreach (ListItem eachItem in cboFileType.Items)
                     {
                         if (eachItem.Text == node.SelectSingleNode("fileType").Attributes["type"].Value)
                         {
                             eachItem.Selected = true;
                         }
                     }
                     DropDownList cboNamingConvention = (DropDownList)gdvRow.FindControl("cboNamingConvention");
                     foreach (ListItem eachItem in cboNamingConvention.Items)
                     {
                         if (eachItem.Text == node.SelectSingleNode("fileFormat").Attributes["format"].Value)
                         {
                             eachItem.Selected = true;
                         }
                     }
                 }
                 else
                 {
                     gdvRow.Cells[0].ForeColor = Color.Red;
                 }
             }
         }
         //loading grid with default values
         else
         {
             objWellBookBLL = new WellBookBLL();
             DataTable dtResult = objWellBookBLL.GetTypeIIIPagesForBook(strParentSiteURL, strBookID, "No");
             DataView dvResultTable;
             dvResultTable = dtResult.DefaultView;
             dtResult = dvResultTable.ToTable(true, "Page_Name");
             grdBatchImportConfiguration.DataSource = dtResult;
             grdBatchImportConfiguration.DataBind();
         }
     }
     catch (WebException webEx)
     {
         lblException.Text = webEx.Message;
         lblException.Visible = true;
         ExceptionBlock.Visible = true;
     }
     catch (Exception ex)
     {
         CommonUtility.HandleException(strParentSiteURL, ex);
     }
 }
Exemple #27
0
 /// <summary>
 /// Binds the Data to PageName Dropdown in Change Page Owner Page
 /// Added By: Praveena 
 /// Date:3/09/2010
 /// Reason: To Populate Values in PageName Dropdown for module Add addtional attribute to ChnagePageOwner
 /// </summary>
 /// <param name="cboList"></param>
 /// <param name="strListname"></param>
 /// <param name="strCAMLQuery"></param>
 protected void BindPageNames(DropDownList cboList, string listName, string CAMLQuery)
 {
     objWellBookBLL = new WellBookBLL();
     cboList.Items.Clear();
     cboList.DataSource = objWellBookBLL.GetPageNamesList(strParentSiteURL, listName, CAMLQuery);
     cboList.DataTextField = "key";
     cboList.DataBind();
 }
 /// <summary>
 /// Binds the Data to PageName Dropdown
 /// Added By: Praveena 
 /// Date:10/09/2010
 /// Reason: To Populate Values in PageName Dropdown
 /// </summary>
 /// <param name="cboList"></param>
 /// <param name="strListname"></param>
 /// <param name="strCAMLQuery"></param>
 protected void BindPageNameDropDown(DropDownList cboList, string listName)
 {
     string strBookId = HttpContext.Current.Request.QueryString["BookId"];
     string strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID' />
          <Value Type='Number'>" + strBookId + "</Value></Eq></Where>";
     objWellBook = new WellBookBLL();
     cboList.Items.Clear();
     cboList.DataSource = objWellBook.GetPageNamesList(strSiteURL, listName, strCamlQuery);
     cboList.DataTextField = "key";
     cboList.DataBind();
 }
        /// <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;
            }
        }