예제 #1
0
        /// <summary>
        /// Update Audit History.
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="auditListName">Audit List Name.</param>
        /// <param name="rowId">ID of the item which audit needs to be updated.</param>
        /// <param name="pageTitle">Master Page Title</param>
        /// <param name="userName">Name of the user updating.</param>
        /// <param name="actionPerformed">Action Performed.</param>
        internal void UpdateListAuditHistory(string siteURL, string listName, string auditListName, int rowId, string pageTitle, string userName, string actionPerformed)
        {
            DataTable dtList = null;
            DataRow objDataRow;
            string strCamlQuery = string.Empty;
            string strSelectedID = string.Empty;
            SPList list;
            SPQuery query;
            SPListItem objListItem;
            SPFieldLookupValue lookupField;
            try
            {
                if (rowId != 0)
                {
                    strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + rowId + "</Value></Eq></Where>";
                }
                else
                {
                    strCamlQuery = @"<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>" + pageTitle + "</Value></Eq></Where>";
                }
                objCommonDAL = new CommonDAL();
                dtList = objCommonDAL.ReadList(siteURL, listName, strCamlQuery);
                for (int intIndex = 0; intIndex < dtList.Rows.Count; intIndex++)
                {
                    objDataRow = dtList.Rows[intIndex];
                    strSelectedID = objDataRow["ID"].ToString();
                }
                SPSecurity.RunWithElevatedPrivileges(delegate()
                {
                    using (SPSite site = new SPSite(siteURL))
                    {
                        using (SPWeb web = site.OpenWeb())
                        {
                            web.AllowUnsafeUpdates = true;
                            list = web.Lists[auditListName];
                            query = new SPQuery();

                            objListItem = list.Items.Add();
                            objListItem["User"] = userName;
                            if (!string.IsNullOrEmpty(actionPerformed))
                            {
                                lookupField = new SPFieldLookupValue(actionPerformed);
                                objListItem["Audit_Action"] = lookupField;
                            }
                            objListItem["Master_ID"] = strSelectedID;
                            objListItem["Date"] = DateTime.Now;
                            objListItem.Update();
                            web.AllowUnsafeUpdates = false;
                        }
                    }
                });
            }
            finally
            {
                if (dtList != null) dtList.Dispose();
            }
        }
예제 #2
0
 /// <summary>
 /// Gets the teams for the Users
 /// </summary>
 /// <param name="siteURL">The site URL.</param>
 /// <param name="username">The username.</param>
 /// <returns></returns>
 public DataTable GetAssetTeams(string siteURL, string username)
 {
     string strViewFields = "<FieldRef Name='Team' />";
     string strCamlQuery = @"<Where><Eq><FieldRef Name='Windows_User_ID' /> <Value Type='Text'>" + username + " </Value></Eq></Where>";
     objCommonDAL = new CommonDAL();
     return objCommonDAL.ReadList(siteURL, DWBUSER, strCamlQuery, strViewFields);
 }
예제 #3
0
        /// <summary>
        /// Gets the Master Page Information from ChapterPage mapping List based on the CAML Query.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>
        /// <returns>ListEntry object.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal ListEntry SetChapterPage(string siteURL, string listName, string queryString)
        {
            ListEntry objListEntry = null;
            DataTable objListItems = null;
            DataRow objListRow;
            int intRowId = 0;
            MasterPageDetails objMasterpage = null;
            ChapterDetails objChapterDetails = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objListItems = objCommonDAL.ReadList(siteURL, listName, queryString);

                if (objListItems != null)
                {
                    objListEntry = new ListEntry();
                    objMasterpage = new MasterPageDetails();
                    for (int index = 0; index < objListItems.Rows.Count; index++)
                    {
                        objListRow = objListItems.Rows[index];
                        objMasterpage.Name = Convert.ToString(objListRow["Page_Name"]);
                        objMasterpage.TemplateTitle = Convert.ToString(objListRow["Page_Actual_Name"]);
                        if (objListRow["Page_Sequence"] != DBNull.Value)
                        {
                            objMasterpage.PageSequence = Convert.ToInt32(objListRow["Page_Sequence"]);
                        }
                        objMasterpage.SOP = Convert.ToString(objListRow["Standard_Operating_Procedure"]);
                        objMasterpage.AssetType = Convert.ToString(objListRow["Asset_Type"]);
                        objMasterpage.ConnectionType = Convert.ToString(objListRow["Connection_Type"]);
                        objMasterpage.SignOffDiscipline = Convert.ToString(objListRow["Discipline"]);
                        objChapterDetails = new ChapterDetails();
                        int.TryParse(Convert.ToString(objListRow["Chapter_ID"]), out  intRowId);
                        objChapterDetails.RowID = intRowId;
                        int.TryParse(Convert.ToString(objListRow["ID"]), out  intRowId);
                        objMasterpage.RowId = intRowId;
                        objListEntry.ChapterDetails = objChapterDetails;
                        objListEntry.MasterPage = objMasterpage;
                    }
                }
                return objListEntry;
            }
            finally
            {
                if (objListItems != null)
                    objListItems.Dispose();
            }
        }
예제 #4
0
        /// <summary>
        /// Gets the active master pages for the chapters
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="chapterId">Chapter ID.</param>
        /// <param name="masterPageListName">Name of the master page list.</param>
        /// <param name="chapterpageListName">Name of the chapterpage list.</param>
        /// <param name="chapterListName">Name of the chapter list.</param>
        /// <returns>DataTable.</returns>
        public DataTable GetMasterPagesForChapter(string siteURL, string chapterId, string masterPageListName, string chapterpageListName, string chapterListName)
        {
            DataTable dtResultTable = null;
            StringBuilder strMasterPageId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            string strAssetType = string.Empty;
            string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + chapterId + "</Value></Eq></Where>";
            dtResultTable = objCommonDAL.ReadList(siteURL, chapterListName, strCamlQuery);
            if (dtResultTable == null && dtResultTable.Rows.Count < 1)
            {
                return dtResultTable;
            }
            else
            {
                strAssetType = Convert.ToString(dtResultTable.Rows[0]["Asset_Type"]);
                strCamlQuery = @"<Where><And><Eq><FieldRef Name='Chapter_ID' /><Value Type='Number'>" + chapterId + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>";
                dtResultTable = objCommonDAL.ReadList(siteURL, chapterpageListName, strCamlQuery);
                if (dtResultTable == null && dtResultTable.Rows.Count < 1)
                {
                    return dtResultTable;
                }
                else
                {
                    for (int i = 0; i < dtResultTable.Rows.Count; i++)
                    {
                        strMasterPageId.Append(Convert.ToString(dtResultTable.Rows[i]["Master_Page_ID"]));
                        strMasterPageId.Append(";");
                    }

                    strCamlQuery = this.CreateCAMLQueryForNot(strMasterPageId.ToString(), "ID", "Counter");
                    strMasterPageId.Remove(0, strMasterPageId.Length);
                    strMasterPageId.Append(strCamlQuery);
                    if (string.IsNullOrEmpty(strCamlQuery))
                    {
                        strMasterPageId.Append("<Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + strAssetType + "</Value></Eq>");
                        strMasterPageId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>");
                        strMasterPageId.Insert(0, "<OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy><Where><And>");
                    }
                    else
                    {
                        strMasterPageId.Append("<Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + strAssetType + "</Value></Eq></And>");
                        strMasterPageId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>");
                        strMasterPageId.Insert(0, "<OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy><Where><And><And>");
                    }
                    dtResultTable = objCommonDAL.ReadList(siteURL, masterPageListName, strMasterPageId.ToString());
                }
            }
            return dtResultTable;
        }
예제 #5
0
        /// <summary>
        /// Updates the list entry.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listEntry">The list entry.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="actionPerformed">The action performed.</param>
        public void UpdateListEntry(string siteURL, ListEntry listEntry, string auditListName, string listName, string userName, string actionPerformed)
        {
            objWellBookChapterDAL = new WellBookChapterDAL();
            objCommonDAL = new CommonDAL();

            string strChapterID = objWellBookChapterDAL.UpdateListEntry(siteURL, listEntry, listName, auditListName, userName, actionPerformed);
            if (listEntry != null && listEntry.ChapterPagesMapping != null)
            {
                if (listEntry.ChapterPagesMapping.Count > 0 && actionPerformed.Contains(AUDIT_ACTION_CREATION))
                {
                    objWellBookChapterDAL.AddChapterMasterPageMapping(siteURL, listEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, userName, actionPerformed);

                     string strCAMLQuery = string.Empty;
                     DataTable dtChapterPages = null;
                     DataTable dtMasterPage = null;
                     DataTable dtTemplate = null;
                     string strViewFields = string.Empty;
                     int intMasterPageID;
                     if (!string.IsNullOrEmpty(strChapterID))
                     {
                         strCAMLQuery = @"<Where><Eq><FieldRef Name='Chapter_ID'/><Value Type='Number'>" + strChapterID + "</Value></Eq></Where>";
                         dtChapterPages = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery);
                     }
                    if (dtChapterPages != null && dtChapterPages.Rows.Count > 0)
                     {
                         foreach (DataRow dtRow in dtChapterPages.Rows)
                         {
                             StoryBoard objStoryBoard = new StoryBoard();
                             objStoryBoard.PageId = Int32.Parse(dtRow["ID"].ToString());
                             objStoryBoard.PageOwner = dtRow["Owner"].ToString();
                             objStoryBoard.PageType = dtRow["Asset_Type"].ToString();
                             objStoryBoard.SOP = dtRow["Standard_Operating_Procedure"].ToString();
                             objStoryBoard.PageTitle = dtRow["Page_Actual_Name"].ToString();
                             objStoryBoard.Discipline = dtRow["Discipline"].ToString();
                             objStoryBoard.ConnectionType = dtRow["Connection_Type"].ToString();

                             intMasterPageID = Int32.Parse(dtRow["Master_Page_ID"].ToString());
                             strCAMLQuery = string.Empty;

                             strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intMasterPageID.ToString() + "</Value></Eq></Where>";
                             strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Master_Page_ID'/>";
                             dtTemplate = objCommonDAL.ReadList(siteURL, DWBTEMPLATEPAGESLIST, strCAMLQuery, strViewFields);
                             if (dtTemplate != null && dtTemplate.Rows.Count > 0)
                             {
                                 intMasterPageID = Int32.Parse(dtTemplate.Rows[0]["Master_Page_ID"].ToString());
                             }

                             strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intMasterPageID.ToString() + "</Value></Eq></Where>";
                             strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Page_Owner'/><FieldRef Name='Created'/><FieldRef Name='Title'/>";
                             dtMasterPage = objCommonDAL.ReadList(siteURL, DWBMASTERPAGESLIST, strCAMLQuery, strViewFields);

                             if (dtMasterPage != null && dtMasterPage.Rows.Count > 0)
                             {
                                 objStoryBoard.MasterPageName = dtMasterPage.Rows[0]["Title"].ToString();
                                 objStoryBoard.CreatedBy = dtMasterPage.Rows[0]["Page_Owner"].ToString();
                                 objStoryBoard.CreationDate = dtMasterPage.Rows[0]["Created"].ToString();
                             }
                             strCAMLQuery = string.Empty;
                             strCAMLQuery = @"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>" + objStoryBoard.PageId.ToString() + "</Value></Eq></Where>";
                             objWellBookChapterDAL.UpdateStoryBoard(siteURL, DWBSTORYBOARD, CHAPTERPAGESMAPPINGAUDITLIST, strCAMLQuery, objStoryBoard.PageId.ToString(), objStoryBoard, actionPerformed, userName);
                         }
                     }
                     if (dtChapterPages != null)
                     {
                         dtChapterPages.Dispose();
                     }
                     if (dtMasterPage != null)
                     {
                         dtMasterPage.Dispose();
                     }
                }
            }
        }
예제 #6
0
        /// <summary>
        /// Publishe the Well book and updates the list item.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="rowId">The row id.</param>
        public void PublishWellBook(string siteURL, string listName, int rowId)
        {
            objWellBookDAL = new WellBookDAL();
            objCommonDAL = new CommonDAL();
            objCommonBLL = new CommonBLL();
            DataTable dtResultTable = null;
            int intListItemRowId = 0;
            StringBuilder strID = new StringBuilder();
            string strCAMlQueryforPageId = string.Empty;
            Dictionary<string, string> listItemCollection = null;
            string strCamlQuery = string.Empty;

            listItemCollection = new Dictionary<string, string>();
            listItemCollection.Add("Sign_Off_Status", "No");
            /// Updating Sign_Off_Status column value to "No" in DWB Books list.
            objWellBookDAL.UpdateListItemValue(siteURL, listName, rowId, listItemCollection);

            strCamlQuery = "<Where><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" +
                  rowId.ToString() + "</Value></Eq></Where>";
            dtResultTable = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery);
            if (dtResultTable != null && dtResultTable.Rows.Count > 0)
            {
                for (int i = 0; i < dtResultTable.Rows.Count; i++)
                {
                    strID.Append(Convert.ToString(dtResultTable.Rows[i][IDCOLUMN]));
                    strID.Append(";");
                }
            }
            else
            {
                //the book does not have any chapters
                return;
            }

            /// Updating Sign_Off_Status column value to "No" in DWB Chapter Pages Mapping list.

            ///Build CAML Query to get all pages in the selected Book
            strCamlQuery = objCommonBLL.CreateCAMLQuery(strID.ToString(), "Chapter_ID", "Number");
            dtResultTable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery);
            strID.Remove(0, strID.Length);
            if (dtResultTable != null && dtResultTable.Rows.Count > 0)
            {
                listItemCollection.Clear();
                listItemCollection.Add("Sign_Off_Status", "No");
                for (int intRowIndex = 0; intRowIndex < dtResultTable.Rows.Count; intRowIndex++)
                {
                    int.TryParse(Convert.ToString(dtResultTable.Rows[intRowIndex][IDCOLUMN]), out intListItemRowId);
                    /// Updating Sign_Off_Status column value to "No" in DWB Chapter Pages Mapping list.
                    objWellBookDAL.UpdateListItemValue(siteURL, CHAPTERPAGESMAPPINGLIST, intListItemRowId, listItemCollection);
                    strID.Append(intListItemRowId.ToString());
                    strID.Append(";");

                }
            }

            /// Delete Comments for All Books Pages
            strCAMlQueryforPageId = objCommonBLL.CreateCAMLQuery(strID.ToString(), "Page_ID", "Number");
            objCommonDAL.DeleteAuditTrail(siteURL, DWBCOMMENT, strCAMlQueryforPageId);

            /// Delete audit trail of the Book.
            strCamlQuery = @"<Where><Eq><FieldRef Name='Master_ID' /><Value Type='Number'>" + rowId.ToString() + "</Value></Eq></Where>";
            objCommonDAL.DeleteAuditTrail(siteURL, DWBWELLBOOKAUDITLIST, strCamlQuery);

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

                    objBookInfo.IsStoryBoardApplicable = objPrintOptions.IncludeStoryBoard;
                    objBookInfo.IsPageTitleApplicable = objPrintOptions.IncludePageTitle;
                    objBookInfo.IsBookTitleApplicable = objPrintOptions.IncludeBookTitle;
                }
            }
            catch (Exception)
            {
                throw;
            }
            if (dtBooks != null)
            {
                dtBooks.Dispose();
            }
            return objBookInfo;
        }
예제 #8
0
        /// <summary>
        /// Updates the page owners
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listEntry">ListEntry object.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="userName">Name of the user.</param>
        /// <param name="actionPerformed">The action performed.</param>
        public void UpdatePageOwner(string siteURL, ListEntry listEntry, string auditListName, string listName,
            string userName, string actionPerformed)
        {
            StringBuilder strPageId = new StringBuilder();
            objWellBookDAL = new WellBookDAL();
            objCommonBLL = new CommonBLL();
            objCommonDAL = new CommonDAL();
            string strCAMLQuery = string.Empty;

            #region DREAM 4.0 - eWB2.0 - Change discipline when page owner is changed
            strCAMLQuery = string.Format(@"<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>{0}</Value></Eq></Where>", userName);
            string strViewFields = @"<FieldRef Name='Windows_User_ID' /><FieldRef Name='ID' /><FieldRef Name='Discipline' /><FieldRef Name='Privileges' /><FieldRef Name='DWBUserName' />";
            DataTable dtUserDetails = null;
            string strDiscipline = string.Empty;
            dtUserDetails = objCommonDAL.ReadList(siteURL, DWBUSER, strCAMLQuery, strViewFields);

            if (dtUserDetails != null && dtUserDetails.Rows.Count > 0)
            {
                strDiscipline = Convert.ToString(dtUserDetails.Rows[0][DISCIPLINECOLUMN]);
            }

            #endregion
            objWellBookDAL.UpdatePageOwner(siteURL, listEntry, listName, auditListName, userName, actionPerformed,strDiscipline);
            for (int intRowIndex = 0; intRowIndex < listEntry.ChapterPagesMapping.Count; intRowIndex++)
            {
                strPageId.Append(listEntry.ChapterPagesMapping[intRowIndex].RowId);
                strPageId.Append(";");

            }

            strCAMLQuery = objCommonBLL.CreateCAMLQuery(strPageId.ToString(), "Page_ID", "Number");
            objWellBookDAL.UpdatePageOwner(siteURL, strCAMLQuery, DWBSTORYBOARD, userName);

            #region DREAM 4.0 - eWB2.0 - Change discipline when page owner is changed
            /// Update the "Disciplie" column for selected Page_IDs in DWB Story Board list
            strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Discipline' /><FieldRef Name='Page_ID' />";
            objCommonDAL.UpdateListItem(siteURL, DWBSTORYBOARD,DISCIPLINECOLUMN, Microsoft.SharePoint.SPFieldType.Text, strDiscipline, strCAMLQuery, strViewFields);
            /// Update the "Disciplie" column for selected Page_IDs in DWB Comments list
            objCommonDAL.UpdateListItem(siteURL, DWBCOMMENT, DISCIPLINECOLUMN, Microsoft.SharePoint.SPFieldType.Text, strDiscipline, strCAMLQuery, strViewFields);
            #endregion
        }
예제 #9
0
        /// <summary>
        /// Gets the asset team mapping
        /// </summary>
        /// <param name="strSiteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="strCAMLQuery">CAML Query.</param>     
        /// <returns>Dictionary object.</returns>
        private Dictionary<string, string> GetAssetTeamMappping(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            objCommonDAL = new CommonDAL();
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
            if (dtResultDatatable != null && (dtResultDatatable.Rows.Count > 0))
            {
                listItemCollection = new Dictionary<string, string>();

                for (int intIndex = 0; intIndex < dtResultDatatable.Rows.Count; intIndex++)
                {
                    if (!listItemCollection.ContainsKey(dtResultDatatable.Rows[intIndex]["User_ID"].ToString()))
                    {
                        listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intIndex]["User_ID"]), Convert.ToString(dtResultDatatable.Rows[intIndex][TITLECOLUMN]));
                    }
                }
            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            return listItemCollection;
        }
예제 #10
0
        /// <summary>
        /// Gets the request ID.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="camlQuery">The caml query.</param>
        /// <returns></returns>
        public string GetRequestID(string siteURL, string listName, string camlQuery)
        {
            DataTable dtListValues = null;
            string strURL = string.Empty;
            try
            {
                objCommonDAL = new CommonDAL();
                dtListValues = objCommonDAL.ReadList(siteURL, listName, camlQuery);

                if (dtListValues != null && dtListValues.Rows.Count > 0)
                {
                    for (int intRowIndex = 0; intRowIndex < dtListValues.Rows.Count; intRowIndex++)
                    {
                        strURL = Convert.ToString(dtListValues.Rows[intRowIndex]["DocumentURL"]);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (dtListValues != null)
                    dtListValues.Dispose();
            }
            return strURL;
        }
예제 #11
0
 /// <summary>
 /// Reads the list and returns the requested Fields.
 /// </summary>
 /// <param name="siteURL">The site URL.</param>
 /// <param name="listName">Name of the list.</param>
 /// <param name="CAMLQuery">The CAML query.</param>
 /// <param name="viewFields">The view fields.</param>
 /// <returns>DataTable</returns>
 public DataTable ReadList(string siteURL, string listName, string CAMLQuery, string viewFields)
 {
     objCommonDAL = new CommonDAL();
     return objCommonDAL.ReadList(siteURL, listName, CAMLQuery, viewFields);
 }
예제 #12
0
        /// <summary>
        /// Gets the Array of Master Page Id
        /// </summary>
        /// <param name="strSiteUrl">Site URL.</param>
        /// <param name="strListName">List Name.</param>
        /// <param name="strCAMLquery">CAML Query.</param>
        /// <returns>int[]</returns>
        public int[] GetMasterPageID(string siteURL, string listName, string CAMLquery)
        {
            DataTable dtResultTable = null;
            int[] intMasterPageId = null;

            objCommonDAL = new CommonDAL();
            dtResultTable = objCommonDAL.ReadList(siteURL, listName, CAMLquery);
            if (dtResultTable != null && dtResultTable.Rows.Count > 0)
            {
                intMasterPageId = new int[dtResultTable.Rows.Count];

                for (int intRowIndex = 0; intRowIndex < dtResultTable.Rows.Count; intRowIndex++)
                {

                    int.TryParse(Convert.ToString(dtResultTable.Rows[intRowIndex]["Master_Page_ID"]), out intMasterPageId[intRowIndex]);
                }
            }

            if (dtResultTable != null)
                dtResultTable.Dispose();

            return intMasterPageId;
        }
예제 #13
0
        /// <summary>
        /// Deletes the template.
        /// Deletes the Pages added to the template and removes the entry 
        /// in Template_ID column of Master Pages list.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="templateID">The template ID.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        public void DeleteTemplate(string siteURL, int templateID, string listName, string auditListName)
        {
            DataTable dtResultsTable;
            StringBuilder strTemplateID = new StringBuilder(); ;
            objCommonDAL = new CommonDAL();
            string strCamlQuery = string.Empty;

            /// Retrieve ID values for of Template Pages Mapping list.
            dtResultsTable = objCommonDAL.ReadList(siteURL, DWBTEMPLATEPAGESLIST, string.Format(@"<Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>{0}</Value></Eq></Where>", templateID.ToString()), "<FieldRef Name='Template_ID' /><FieldRef Name='ID' />");

            if (dtResultsTable != null && dtResultsTable.Rows.Count > 0)
            {

                for (int intRowIndex = 0; intRowIndex < dtResultsTable.Rows.Count;intRowIndex++ )
                {
                    strTemplateID.Append(Convert.ToString(dtResultsTable.Rows[intRowIndex]["ID"]));
                    strTemplateID.Append(";");
                }
            }
            /// Delete the Template Pages
            objCommonDAL.DeleteListItem(siteURL, DWBTEMPLATEPAGESLIST, string.Format(@"<Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>{0}</Value></Eq></Where>", templateID.ToString()));

            if (strTemplateID.Length > 0)
            {
                strCamlQuery = CreateCAMLQuery(strTemplateID.ToString(), "Master_ID", "Number");
            }
            /// Delete the Template Pages Audit
            objCommonDAL.DeleteAuditTrail(siteURL, DWBTEMPLATECONFIGURATIONAUDIT, strCamlQuery);

            /// Delete Template
            objCommonDAL.DeleteListItemById(siteURL, listName, templateID);
            /// Delete Template Audit
            objCommonDAL.DeleteAuditTrail(siteURL, auditListName, string.Format(AUDITHISTORYCAMLQUERY, templateID.ToString()));
        }
예제 #14
0
        /// <summary>
        /// Deletes the chapter pages.
        /// Deletes Audit Trail, Story Board, Comments, Narrative and document
        /// for the selected page.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="chapterPageID">The chapter page ID.</param>
        /// <param name="connectionType">Type of the connection.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="auditListName">Name of the audit list.</param>
        public void DeleteChapterPages(string siteURL, int chapterPageID, string connectionType, string listName, string auditListName)
        {
            string strCamlQuery = string.Empty;
            string strPageType = string.Empty;
            DataTable dtResultTable;
            objCommonDAL = new CommonDAL();

            /// Get the Page type from "DWB Chapter Pages Mapping" list
            /// Based on the connection type delete the document.
            strCamlQuery = string.Format(@" <Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>{0}</Value></Eq></Where>", chapterPageID.ToString());
            dtResultTable = objCommonDAL.ReadList(siteURL, listName, strCamlQuery, "<FieldRef Name='ID' /><FieldRef Name='Connection_Type' />");
               if (dtResultTable != null && dtResultTable.Rows.Count > 0)
               {
               strPageType = Convert.ToString(dtResultTable.Rows[0]["Connection_Type"]);
               dtResultTable.Dispose();
               }
               /// Delete documents for the selected page
               if (!string.IsNullOrEmpty(strPageType))
               {
               switch (strPageType)
               {
                   case DWBTYPE2PAGE:
                       {
                           objCommonDAL.DeleteDocument(siteURL,PUBLISHEDDOCUMENTLIST,string.Format(CHAPTERPAGEDOCUMNETCAMEQUERY,chapterPageID.ToString()));
                           break;
                       }
                   case DWBTYPE3PAGE:
                       {
                           objCommonDAL.DeleteDocument(siteURL, USERDEFINEDDOCUMENTLIST, string.Format(CHAPTERPAGEDOCUMNETCAMEQUERY, chapterPageID.ToString()));
                           break;
                       }
                   default:
                       break;
               }
               }
               strCamlQuery = string.Empty;
            /// CAML query for DWB Comments.
               strCamlQuery = string.Format(@"<Where><Eq><FieldRef Name='Page_ID' /><Value Type='Number'>{0}</Value></Eq></Where> ", chapterPageID.ToString());
               /// Delete Comments
               objCommonDAL.DeleteListItem(siteURL, DWBCOMMENT, strCamlQuery);

               /// Delete Narrative
               objCommonDAL.DeleteListItem(siteURL, DWBNARRATIVES, strCamlQuery);
            /// Delete StoryBoard
            objCommonDAL.DeleteListItem(siteURL, DWBSTORYBOARD, strCamlQuery);
            /// Delete Audit Trail
            objCommonDAL.DeleteAuditTrail(siteURL, auditListName, string.Format(AUDITHISTORYCAMLQUERY, chapterPageID.ToString()));
            /// Delete Chapter Page
            objCommonDAL.DeleteListItemById(siteURL, listName, chapterPageID);
        }
예제 #15
0
        /// <summary>
        /// Get Pages for the selected Owner
        /// Modified By: Praveena  
        /// Date:03/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <param name="username">Windows User ID of the selected Owner</param>
        /// <returns>DataTable</returns>
        public DataTable GetPagesForOwner(string siteURL, string listName, string CAMLQuery, string username, string pageName, string terminatedStatus, System.Text.StringBuilder chapterNames)
        {
            string strViewFields = string.Empty;
            strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' />";
            DataTable dtResultDatatable = null;
            DataView dvresultdataview = null;
            string strCAMLQuery = string.Empty;
            StringBuilder strChapterId = new StringBuilder();
            Dictionary<string, string> listItemCollection = null;
            objCommonDAL = new CommonDAL();
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery, strViewFields);
            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                listItemCollection = new Dictionary<string, string>();
                for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                    if ((!listItemCollection.ContainsValue(Convert.ToString(dtResultDatatable.Rows[intRowIndex][TITLECOLUMN]))
                        && (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex][TITLECOLUMN])))))
                    {
                        listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]), Convert.ToString(dtResultDatatable.Rows[intRowIndex][TITLECOLUMN]));
                    }
                }
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(strChapterId.ToString(), CHAPTERIDCOLUMN, "Number");
                strViewFields = "<FieldRef Name='Connection_Type' /><FieldRef Name='Page_Name' /><FieldRef Name='Discipline' /><FieldRef Name='Owner' /><FieldRef Name='Empty' /><FieldRef Name='Sign_Off_Status' /><FieldRef Name='Chapter_ID' /><FieldRef Name='Terminate_Status' />";
                dtResultDatatable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST,
                   strCAMLQuery, strViewFields);

                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    Dictionary<string, string> ChapterDetails = listItemCollection;
                    DataColumn dcChapterName = dtResultDatatable.Columns.Add(CHAPTERNAMECOLUMN, typeof(string));
                    string str = string.Empty;
                    foreach (DataRow dtRow in dtResultDatatable.Rows)
                    {
                        if (ChapterDetails.ContainsKey(dtRow[CHAPTERIDCOLUMN].ToString()))
                        {
                            ChapterDetails.TryGetValue(dtRow[CHAPTERIDCOLUMN].ToString(), out str);
                            dtRow[CHAPTERNAMECOLUMN] = str;
                        }
                    }
                    dvresultdataview = dtResultDatatable.DefaultView;
                    //to apply filters to dataview
                    dvresultdataview = ApplyFilters(dvresultdataview, username, pageName, chapterNames, terminatedStatus);
                }
            }
            if (dvresultdataview != null)
            {
                return dvresultdataview.Table;
            }
            else
            {
                return dtResultDatatable;
            }
        }
예제 #16
0
        /// <summary>
        /// Sets the collection of chapter detail.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="bookID">The book ID.</param>
        /// <param name="action">The action.</param>
        /// <returns>ArrayList</returns>
        private ArrayList SetChapterDetail(string siteURL, string bookID, string action)
        {
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtChapters = null;
            DataRow objDataRow;
            ChapterInfo objChapterInfo = null;
            ArrayList arlChapterDetails = null;
            try
            {
                objCommonDAL = new CommonDAL();
                //strCamlQuery = @"<OrderBy><FieldRef Name='Chapter_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + bookID + "</Value>" + "</Eq></And></Where>";
                #region DREAM 4.0 - eWB2.0 - Deletion module
                /// Modify CAML query to exclude the chapters marked ad ToBeDeleted = Yes displaying from TreeView.
                strCamlQuery = @"<OrderBy><FieldRef Name='Chapter_Sequence' /></OrderBy><Where><And><And><Eq><FieldRef Name='Terminate_Status' /> <Value Type='Choice'>No</Value></Eq><Or><IsNull><FieldRef Name='ToBeDeleted' /></IsNull><Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></Or></And><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + bookID + "</Value>" + "</Eq></And></Where>";
                #endregion
                strViewFields = @"<FieldRef Name='Chapter_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' /><FieldRef Name='Book_ID' /><FieldRef Name='Actual_Asset_Value' /><FieldRef Name='Column_Name' /><FieldRef Name='Asset_Type' /><FieldRef Name='Asset_Value' />";
                dtChapters = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery, strViewFields);

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

                    objChapterInfo.PageInfo = SetChapterPageInfo(siteURL, objChapterInfo.ChapterID, objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName);
                    if (objChapterInfo.PageInfo.Count > 0)
                    {
                        /// Add chapter to collection only if the Chapter contains >=1 pages.
                        arlChapterDetails.Add(objChapterInfo);
                        if (string.Compare(action, "print", true) == 0 || string.Compare(action, "pdf", true) == 0)
                        {
                            /// Set IsPrintable to true
                            /// This method is called for Publish/Print complete book
                            objChapterInfo.IsPrintable = true;
                        }
                    }
                }
                if (dtChapters != null)
                {
                    dtChapters.Dispose();
                }
                return arlChapterDetails;
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #17
0
        /// <summary>
        /// To Get TypeIII Pages for selected Book
        /// Added By: Praveena  
        /// Date:16/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="siteURL"></param>
        /// <param name="bookId"></param>
        /// <param name="terminated"></param>
        /// <returns></returns>
        public DataTable GetTypeIIIPagesForBook(string siteURL, string bookId, string terminated)
        {
            DataTable dtResult = null;
            objCommonDAL = new CommonDAL();
            objCommonBLL = new CommonBLL();
            StringBuilder strChapterId = new StringBuilder();
            string strCamlQuery = @"<Where><And><Eq><FieldRef Name='Book_ID' />
            <Value Type='Number'> " + bookId + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + terminated + "</Value></Eq></And></Where>";
            dtResult = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery);
            if (dtResult != null && dtResult.Rows.Count > 0)
            {
                for (int intRowIndex = 0; intRowIndex < dtResult.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResult.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                }
                strCamlQuery = objCommonBLL.CreateCamlQueryWithoutWhere(strChapterId.ToString(), "Chapter_ID", "Number");
                strChapterId.Remove(0, strChapterId.Length);
                strChapterId.Append(strCamlQuery);
                strChapterId.Append("<Eq><FieldRef Name='Connection_Type' /><Value Type='Text'>3 - User Defined Document</Value></Eq></And>");
                strChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + terminated + "</Value></Eq></And></Where>");
                strChapterId.Insert(0, "<Where><And><And>");
                dtResult = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strChapterId.ToString());

            }

            return dtResult;
        }
예제 #18
0
        /// <summary>
        /// Sets the chapter page info.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="chapterID">The chapter ID.</param>
        /// <param name="chapterActualAssetValue">The chapter actual asset value.</param>
        /// <param name="columnName">Name of the column.</param>
        /// <returns>ArrayList of Chapter Pages.</returns>
        private ArrayList SetChapterPageInfo(string siteURL, string chapterID, string chapterActualAssetValue, string columnName)
        {
            string strCamlQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtSelectedPages = null;
            DataRow objDataRow;
            PageInfo objPageInfo = null;
            ArrayList arlPageDetails = null;
            string strConnectionType = string.Empty;
            string[] strConnectionTypeSplit = null;
            int intConnectionType = 0;
            string strPageURL = string.Empty;
            try
            {
                objCommonDAL = new CommonDAL();
                strCamlQuery = @" <OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy> <Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Eq><FieldRef Name='Chapter_ID' /><Value Type='Number'>" + chapterID + "</Value>" + "</Eq></And></Where>";
                strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' /><FieldRef Name='Chapter_ID' /><FieldRef Name='Page_Name' /><FieldRef Name='Page_Actual_Name' /><FieldRef Name='Page_URL' /><FieldRef Name='Owner' /><FieldRef Name='Connection_Type' /><FieldRef Name='Sign_Off_Status' /><FieldRef Name='Asset_Type' />";
                dtSelectedPages = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery);

                arlPageDetails = new ArrayList();
                for (int intIndex = 0; intIndex < dtSelectedPages.Rows.Count; intIndex++)
                {
                    objPageInfo = new PageInfo();
                    objDataRow = dtSelectedPages.Rows[intIndex];
                    objPageInfo.PageID = objDataRow[IDCOLUMN].ToString();
                    objPageInfo.PageTitle = objDataRow["Page_Name"].ToString();
                    objPageInfo.PageActualName = objDataRow["Page_Actual_Name"].ToString();
                    objPageInfo.PageURL = objDataRow["Page_URL"].ToString();
                    if (objDataRow["Owner"] != null || objDataRow["Owner"] != DBNull.Value)
                    {
                        objPageInfo.PageOwner = objDataRow["Owner"].ToString();
                    }
                    strConnectionType = string.Empty;
                    strConnectionType = objDataRow["Connection_Type"].ToString();
                    strConnectionTypeSplit = null;
                    strConnectionTypeSplit = strConnectionType.Split("-".ToCharArray());
                    intConnectionType = 0;
                    if (strConnectionTypeSplit != null && strConnectionTypeSplit.Length > 0)
                    {
                        int.TryParse(strConnectionTypeSplit[0], out intConnectionType);
                    }
                    objPageInfo.ConnectionType = intConnectionType;
                    objPageInfo.SignOffStatus = objDataRow["Sign_Off_Status"].ToString();
                    objPageInfo.AssetType = objDataRow["Asset_Type"].ToString();
                    /// If connection type == 1, assign below properties
                    if (intConnectionType == 1)
                    {
                        objPageInfo.ActualAssetValue = chapterActualAssetValue;
                        objPageInfo.ColumnName = columnName;
                        /// Based on page URL assign "WellHistory/WellBoreHeader/Pre-Prod RFT"
                        /// DWBWellHistoryReport.aspx
                        /// DWBPreProductionRFT.aspx
                        /// DWBWellboreHeader.aspx
                        strPageURL = string.Empty;
                        strPageURL = objDataRow["Page_URL"].ToString();
                        if (string.Compare(strPageURL, "DWBWellHistoryReport.aspx", true) == 0)
                        {
                            objPageInfo.ReportName = WELLHISTORYREPORTNAME;
                        }
                        else if (string.Compare(strPageURL, "DWBPreProductionRFT.aspx", true) == 0)
                        {
                            objPageInfo.ReportName = PREPRODRFTREPORTNAME;
                        }
                        else if (string.Compare(strPageURL, "DWBWellboreHeader.aspx", true) == 0)
                        {
                            objPageInfo.ReportName = WELLBOREHEADERREPORTNAME;
                        }
                        else if (string.Compare(strPageURL, "WellSummary.aspx", true) == 0)
                        {
                            objPageInfo.ReportName = WELLSUMMARYRREPORTNAME;
                        }
                    }
                    #region DREAM 4.0 - eWB 2.0
                    if (objDataRow["Empty"] != null)
                    {
                        if (objDataRow["Empty"].ToString().ToLowerInvariant().Equals("no"))
                        {
                            objPageInfo.IsEmpty = false;
                        }
                        else if (objDataRow["Empty"].ToString().ToLowerInvariant().Equals("yes"))
                        {
                            objPageInfo.IsEmpty = true;
                        }

                    }
                    #endregion
                    arlPageDetails.Add(objPageInfo);
                }

                if (dtSelectedPages != null)
                {
                    dtSelectedPages.Dispose();
                }
                return arlPageDetails;
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #19
0
        /// <summary>
        /// Add Books as favorites         
        /// </summary>
        /// <param name="siteUrl">Site URL.</param>                   
        /// <param name="favBookIds">Books IDs separated by ;</param>        
        /// <param name="listName">List Name.</param>  
        /// <param name="username">User ID</param>
        /// <param name="addToFavourite">True if Add to Favourites. False if Remove from Favorites.</param>
        public void AddToFavorites(string siteURL, string favBookIds, string listName, string username, bool addToFavourite)
        {
            objWellBookDAL = new WellBookDAL();

            Dictionary<string, string> listItemCollection = null;
            if (favBookIds.Length != 0)
            {

                listItemCollection = new Dictionary<string, string>();

                string strCAMLQuery = "<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>" + username + "</Value></Eq></Where>";
                if (addToFavourite)
                {
                    listItemCollection.Add("FavoriteBooks", favBookIds);

                    WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection);
                }
                else
                {
                    /// Read the FavoriteBooks value from DWB User list
                    /// Remove the Book Ids in favBookIds
                    /// Update the FavoriteBooks in DWB User list with the new value
                    objCommonDAL = new CommonDAL();
                    DataTable dtUser = objCommonDAL.ReadList(siteURL, listName, strCAMLQuery);
                    if (dtUser != null && dtUser.Rows.Count > 0)
                    {
                        string strExistingFavouriteBooks = Convert.ToString(dtUser.Rows[0]["FavoriteBooks"]);
                        if (!string.IsNullOrEmpty(strExistingFavouriteBooks))
                        {
                            string[] strBookIds = favBookIds.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                            for (int intIndex = 0; intIndex < strBookIds.Length; intIndex++)
                            {
                                if (strExistingFavouriteBooks.Contains(";" + strBookIds[intIndex] + ";"))
                                {
                                    strExistingFavouriteBooks = strExistingFavouriteBooks.Remove(strExistingFavouriteBooks.IndexOf(";" + strBookIds[intIndex] + ";"), strBookIds[intIndex].Length + 1);
                                    if (strExistingFavouriteBooks.Length == 1 && (string.Compare(strExistingFavouriteBooks, ";")) == 0)
                                    {
                                        strExistingFavouriteBooks = string.Empty;
                                    }
                                }
                            }

                            listItemCollection.Add("FavoriteBooks", strExistingFavouriteBooks);
                            WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection);
                        }
                    }
                }

            }
        }
예제 #20
0
 /// <summary>
 /// Get Pages for the Selected Book
 /// </summary>
 /// <param name="strParentSiteUrl">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="strCamlQuery">CAML Query.</param>     
 /// <returns>ListEntry object</returns>
 public ListEntry GetBookPages(string siteURL, string listName, string CAMLQuery)
 {
     ListEntry objListEntry = null;
     DataTable dtResultTable = null;
     objWellBookChapterDAL = new WellBookChapterDAL();
     objCommonDAL = new CommonDAL();
     string strcamlQuery = string.Empty;
     int intRowId = 0;
     objListEntry = objWellBookChapterDAL.SetChapterPage(siteURL, listName, CAMLQuery);
     strcamlQuery = @"<Where><Eq><FieldRef Name='ID' />
          <Value Type='Counter'>" + Convert.ToString(objListEntry.ChapterDetails.RowID) + "</Value></Eq></Where>";
     dtResultTable = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST,
        strcamlQuery);
     if (dtResultTable != null && dtResultTable.Rows.Count > 0)
     {
         int.TryParse(Convert.ToString(dtResultTable.Rows[0]["Book_ID"]), out intRowId);
         objListEntry.ChapterDetails.BookID = intRowId;
         objListEntry.ChapterDetails.ChapterTitle = Convert.ToString(dtResultTable.Rows[0][TITLECOLUMN]);
     }
     if (dtResultTable != null)
     {
         dtResultTable.Dispose();
     }
     return objListEntry;
 }
예제 #21
0
        /// <summary>
        /// Returns the array of selected Page Info objects.
        /// </summary>
        /// <param name="siteUrl">Site URL.</param>
        /// <param name="pageIds">PageIDs concatenated with "|".</param>
        /// <param name="chapterActualAssetValue">Actual Asset Value of Chapter.</param>
        /// <param name="columnName">Column Name of the Chapter.</param>
        /// <returns>ArrayList of PageInfo objects.</returns>
        public ArrayList SetSelectedPageInfo(string siteURL, string pageIds, string chapterActualAssetValue, string columnName)
        {
            /// Split the pageIds with "|" as splitter
            /// Format the CAML Query for the selected Pages
            /// Assign values to PageInfo object and add to Array list
            ArrayList arlPageInfo = null;
            PageInfo objPageInfo = null;
            string strCAMLQuery = string.Empty;
            string strViewFields = string.Empty;
            DataTable dtChapterPages = null;
            DataTable dtDocumentDetails = null;

            string strConnectionType = string.Empty;
            string strPageURL = string.Empty;
            string[] strConnectionTypeSplit = null;
            int intConnectionType = 0;
            if (!string.IsNullOrEmpty(pageIds) && pageIds.Length > 0)
            {
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIds, IDCOLUMN, IDCOLUMNTYPE);
                if (!string.IsNullOrEmpty(strCAMLQuery))
                {
                    strCAMLQuery = strCAMLQuery.Insert(0, "<OrderBy><FieldRef Name='Page_Sequence' Ascending='True'/></OrderBy>");
                }
                strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' /><FieldRef Name='Chapter_ID' /><FieldRef Name='Page_Name' /><FieldRef Name='Page_Actual_Name' /><FieldRef Name='Page_URL' /><FieldRef Name='Owner' /><FieldRef Name='Connection_Type' /><FieldRef Name='Sign_Off_Status' /><FieldRef Name='Asset_Type' />";
                objCommonDAL = new CommonDAL();
                dtChapterPages = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery, strViewFields);
                if (dtChapterPages != null && dtChapterPages.Rows.Count > 0)
                {
                    arlPageInfo = new ArrayList();
                    foreach (DataRow objDataRow in dtChapterPages.Rows)
                    {
                        objPageInfo = new PageInfo();
                        objPageInfo.PageID = objDataRow[IDCOLUMN].ToString();
                        objPageInfo.PageTitle = objDataRow["Page_Name"].ToString();
                        objPageInfo.PageActualName = objDataRow["Page_Actual_Name"].ToString();
                        objPageInfo.PageURL = objDataRow["Page_URL"].ToString();
                        if (objDataRow["Owner"] != null || objDataRow["Owner"] != DBNull.Value)
                        {
                            objPageInfo.PageOwner = objDataRow["Owner"].ToString();
                        }
                        strConnectionType = string.Empty;
                        strConnectionTypeSplit = null;
                        strConnectionType = objDataRow["Connection_Type"].ToString();
                        strConnectionTypeSplit = strConnectionType.Split("-".ToCharArray());
                        intConnectionType = 0;
                        if (strConnectionTypeSplit != null && strConnectionTypeSplit.Length > 0)
                        {
                            int.TryParse(strConnectionTypeSplit[0], out intConnectionType);
                        }
                        objPageInfo.ConnectionType = intConnectionType;
                        objPageInfo.SignOffStatus = objDataRow["Sign_Off_Status"].ToString();
                        objPageInfo.AssetType = objDataRow["Asset_Type"].ToString();
                        /// If connection type == 1, assign below properties
                        if (intConnectionType == 1)
                        {
                            objPageInfo.ActualAssetValue = chapterActualAssetValue;
                            objPageInfo.ColumnName = columnName;
                            /// Based on page URL assign "WellHistory/WellBoreHeader/Pre-Prod RFT"
                            /// DWBWellHistoryReport.aspx
                            /// DWBPreProductionRFT.aspx
                            /// DWBWellboreHeader.aspx
                            strPageURL = string.Empty;
                            strPageURL = objDataRow["Page_URL"].ToString();
                            if (string.Compare(strPageURL, "DWBWellHistoryReport.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = WELLHISTORYREPORTNAME;
                            }
                            else if (string.Compare(strPageURL, "DWBPreProductionRFT.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = PREPRODRFTREPORTNAME;
                            }
                            else if (string.Compare(strPageURL, "DWBWellboreHeader.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = WELLBOREHEADERREPORTNAME;
                            }
                            else if (string.Compare(strPageURL, "WellSummary.aspx", true) == 0)
                            {
                                objPageInfo.ReportName = WELLSUMMARYRREPORTNAME;
                            }
                        }

                        //Added by Praveena for module "Add Last Updated date"
                        strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIds, "PageID", "Number");
                        strViewFields = @"<FieldRef Name='PageID' /><FieldRef Name='Modified' />";
                        if (intConnectionType == 3)
                        {
                            dtDocumentDetails = objCommonBLL.ReadList(siteURL, USERDEFINEDDOCUMENTLIST, strCAMLQuery, strViewFields);
                        }
                        else if (intConnectionType == 2)
                        {
                            dtDocumentDetails = objCommonBLL.ReadList(siteURL, PUBLISHEDDOCUMENTLIST, strCAMLQuery, strViewFields);
                        }
                        if (dtDocumentDetails != null && dtDocumentDetails.Rows.Count > 0)
                        {
                            foreach (DataRow dtRow in dtDocumentDetails.Rows)
                            {
                                objPageInfo.LastUpdatedDate = GetDateTime(dtRow["Modified"].ToString());
                            }
                        }

                        arlPageInfo.Add(objPageInfo);
                    }
                }
            }
            if (dtChapterPages != null)
            {
                dtChapterPages.Dispose();
            }
            return arlPageInfo;
        }
예제 #22
0
 /// <summary>
 /// Get List Details
 /// </summary>
 /// <param name="siteURL">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="queryString">CAML Query.</param>
 /// <returns>DataTable</returns>
 public DataTable GetListDetails(string siteURL, string listName, string CAMLQuery)
 {
     objCommonDAL = new CommonDAL();
     return objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
 }
예제 #23
0
        /// <summary>
        /// Get the Owners for the chapter page
        /// for the team.
        /// Retrieves the users with Discipline form DWB Team Staff list.
        /// User belong to the team which owns the book are retrieved.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="chapterId">Chapter ID.</param>
        /// <param name="chapterListName">Name of the chapter list.</param>
        /// <param name="bookListName">Name of the book list.</param>
        /// <param name="teamStaffListName">Name of the team staff list.</param>
        /// <returns>Data Table.</returns>
        public DataTable GetOwnersForChapterPage(string siteURL, string chapterId, string chapterListName, string bookListName, string teamStaffListName)
        {
            /// This method retrives the list of users with Discipline from DWB Team Staff list using below logic.
            /// Get all users with Team ID = ID of the team which owns the Book to which the pages are getting added.
            DataTable dtResultTable = null;
            string strBookId = string.Empty;
            string strTeamId = string.Empty;

            string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + chapterId + "</Value></Eq></Where>";
            objCommonDAL = new CommonDAL();
            dtResultTable = objCommonDAL.ReadList(siteURL, chapterListName, strCamlQuery);
            if (dtResultTable == null && dtResultTable.Rows.Count < 1)
            {
                return dtResultTable;
            }
            else
            {
                strBookId = Convert.ToString(dtResultTable.Rows[0]["Book_ID"]);
                strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strBookId + "</Value></Eq></Where>";

                dtResultTable = objCommonDAL.ReadList(siteURL, bookListName, strCamlQuery);
                if (dtResultTable == null && dtResultTable.Rows.Count < 1)
                {
                    return dtResultTable;
                }
                else
                {
                    strTeamId = Convert.ToString(dtResultTable.Rows[0]["Team_ID"]);
                    strCamlQuery = @"<Where><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + strTeamId + "</Value></Eq></Where>";
                    dtResultTable = objCommonDAL.ReadList(siteURL, teamStaffListName, strCamlQuery);
                }
            }
            return dtResultTable;
        }
예제 #24
0
        /// <summary>
        /// Gets the onwers of the team.
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <returns>Dictionary object</returns>
        public Dictionary<string, string> GetOwnerForTeam(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            DataTable dtUserDetails = null;
            string strcamlQuery = string.Empty;
            StringBuilder strTeamId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                strcamlQuery = @"<Where><Eq><FieldRef Name='Team_ID' />
                 <Value Type='Number'>" + (Convert.ToString(dtResultDatatable.Rows[0]["Team_ID"])) + "</Value></Eq></Where>";
                dtResultDatatable = objCommonDAL.ReadList(siteURL, DWBTEAMSTAFF,
                   strcamlQuery);

                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                    {
                        strTeamId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["User_ID"]));
                        strTeamId.Append(";");
                    }
                    objCommonBLL = new CommonBLL();
                    strcamlQuery = objCommonBLL.CreateCAMLQuery(strTeamId.ToString(), IDCOLUMN, IDCOLUMNTYPE, "DWBUserName");
                    dtUserDetails = objCommonDAL.ReadList(siteURL, DWBUSER, strcamlQuery);
                    listItemCollection = new Dictionary<string, string>();
                    for (int intRowIndex = 0; intRowIndex < dtUserDetails.Rows.Count; intRowIndex++)
                    {
                        if (!listItemCollection.ContainsKey(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["ID"])))
                        {
                            listItemCollection.Add(Convert.ToString(dtUserDetails.Rows[intRowIndex][IDCOLUMN]), Convert.ToString(dtUserDetails.Rows[intRowIndex]["Windows_User_ID"]));
                        }
                    }
                }

            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            if (dtUserDetails != null)
            {
                dtUserDetails.Dispose();
            }
            return listItemCollection;
        }
예제 #25
0
 /// <summary>
 /// Gets the collection of the Templates based on the asset.
 /// </summary>
 /// <param name="strSiteURL">Site URL.</param>
 /// <param name="listName">List Name.</param>
 /// <param name="strCAMLQuery">CAML Query.</param>
 /// <returns>Dictionary object.</returns>
 private Dictionary<string, string> GetTemplatesForAsset(string siteURL, string listName, string CAMLQuery)
 {
     Dictionary<string, string> listItemCollection = null;
     DataTable dtResultDatatable = null;
     CommonDAL objCommonDAL = new CommonDAL();
     dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery);
     if (dtResultDatatable != null && (dtResultDatatable.Rows.Count > 0))
     {
         listItemCollection = new Dictionary<string, string>();
         for (int rowIndex = 0; rowIndex < dtResultDatatable.Rows.Count; rowIndex++)
         {
             if (!listItemCollection.ContainsKey(Convert.ToString(dtResultDatatable.Rows[rowIndex]["ID"])))
             {
                 listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[rowIndex]["ID"]), Convert.ToString(dtResultDatatable.Rows[rowIndex]["Title"]));
             }
         }
     }
     if (dtResultDatatable != null)
     {
         dtResultDatatable.Dispose();
     }
     return listItemCollection;
 }
예제 #26
0
        /// <summary>
        /// Gets the PageNames List
        /// Added By: Praveena  
        /// Date:03/09/2010
        /// Reason: For module Add additional attributes to change page owner table
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <returns>Dictionary Object.</returns>
        public Dictionary<string, string> GetPageNamesList(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            string strCAMLQuery = string.Empty;
            StringBuilder strChapterId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            string strViewFields = string.Empty;
            strViewFields = @"<FieldRef Name='ID' />";

            //Get the chapter details
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery, strViewFields);
            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                }
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(strChapterId.ToString(), "Chapter_ID", "Number");
                if (string.IsNullOrEmpty(CAMLQuery))
                    return listItemCollection;

                strViewFields = @"<FieldRef Name='Page_Name' /><FieldRef Name='Discipline' />";

                //Get the Page details by passing chapter Ids
                dtResultDatatable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery, strViewFields);
                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    listItemCollection = new Dictionary<string, string>();
                    DataView dvResult = dtResultDatatable.DefaultView;

                    //PageName and Discipline are store into the dictionary collection.
                    dtResultDatatable = dvResult.ToTable(true, "Page_Name", "Discipline");
                    for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                    {
                        if ((!listItemCollection.ContainsKey(Convert.ToString(dtResultDatatable.Rows[intRowIndex][PAGENAMECOLUMN]))) &&
                             (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex][PAGENAMECOLUMN]))) &&
                             (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex][DISCIPLINECOLUMN]))))
                        {
                            listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intRowIndex][PAGENAMECOLUMN]), Convert.ToString(dtResultDatatable.Rows[intRowIndex][DISCIPLINECOLUMN]));
                        }
                    }
                }
            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            return listItemCollection;
        }
예제 #27
0
        /// <summary>
        /// Gets the Chapter Details.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>
        /// <returns>ListEntry Object.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal ListEntry GetChapterDetails(string siteURL, string listName, string queryString)
        {
            ListEntry objListEntry = null;
            DataTable objListItems = null;
            DataRow objListRow;
            int intTemplateId = 0;
            int intBookId = 0;
            ChapterDetails objChapterDetails = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objListItems = objCommonDAL.ReadList(siteURL, listName, queryString);

                if (objListItems != null)
                {
                    objListEntry = new ListEntry();
                    objChapterDetails = new ChapterDetails();
                    for (int index = 0; index < objListItems.Rows.Count; index++)
                    {
                        objListRow = objListItems.Rows[index];
                        objChapterDetails.ChapterTitle = objListRow["Title"].ToString();
                        objChapterDetails.AssetValue = Convert.ToString(objListRow["Asset_Value"]);
                        objChapterDetails.Country = Convert.ToString(objListRow["Country"]);
                        objChapterDetails.Criteria = Convert.ToString(objListRow["Criteria"]);
                        objChapterDetails.ColumnName = Convert.ToString(objListRow["Column_Name"]);
                        if (objListRow["Chapter_Sequence"] != DBNull.Value)
                        {
                            objChapterDetails.ChapterSequence = Convert.ToInt32(objListRow["Chapter_Sequence"]);
                        }
                        int.TryParse(Convert.ToString(objListRow["Book_ID"]), out intBookId);
                        objChapterDetails.BookID = intBookId;
                        objChapterDetails.AssetType = Convert.ToString(objListRow["Asset_Type"]);
                        objChapterDetails.ChapterDescription = Convert.ToString(objListRow["Chapter_Description"]);
                        int.TryParse(Convert.ToString(objListRow["Template_ID"]), out intTemplateId);
                        objChapterDetails.TemplateID = intTemplateId;
                        objChapterDetails.Terminated = Convert.ToString(objListRow["Terminate_Status"]);

                        objListEntry.ChapterDetails = objChapterDetails;
                    }
                }
                return objListEntry;
            }
            finally
            {
                if (objListItems != null)
                    objListItems.Dispose();
            }
        }
예제 #28
0
        /// <summary>
        /// Gets the owners list
        /// </summary>
        /// <param name="siteURL">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>     
        /// <returns>Dictionary Object.</returns>
        public Dictionary<string, string> GetPageOwnerList(string siteURL, string listName, string CAMLQuery)
        {
            Dictionary<string, string> listItemCollection = null;
            DataTable dtResultDatatable = null;
            string strCAMLQuery = string.Empty;
            StringBuilder strChapterId = new StringBuilder();
            objCommonDAL = new CommonDAL();
            string strViewFields = string.Empty;
            strViewFields = @"<FieldRef Name='ID' />";
            dtResultDatatable = objCommonDAL.ReadList(siteURL, listName, CAMLQuery, strViewFields);

            if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
            {
                for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                {
                    strChapterId.Append(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]));
                    strChapterId.Append(";");
                }
                objCommonBLL = new CommonBLL();
                strCAMLQuery = objCommonBLL.CreateCAMLQuery(strChapterId.ToString(), "Chapter_ID", "Number", "Owner");
                if (string.IsNullOrEmpty(CAMLQuery))
                    return listItemCollection;
                dtResultDatatable = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strCAMLQuery);
                if (dtResultDatatable != null && dtResultDatatable.Rows.Count > 0)
                {
                    listItemCollection = new Dictionary<string, string>();

                    for (int intRowIndex = 0; intRowIndex < dtResultDatatable.Rows.Count; intRowIndex++)
                    {

                        if ((!listItemCollection.ContainsValue(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["Owner"]))
                            && (!string.IsNullOrEmpty(Convert.ToString(dtResultDatatable.Rows[intRowIndex]["Owner"])))))
                        {
                            listItemCollection.Add(Convert.ToString(dtResultDatatable.Rows[intRowIndex][IDCOLUMN]), Convert.ToString(dtResultDatatable.Rows[intRowIndex]["Owner"]));
                        }
                    }
                }

            }
            if (dtResultDatatable != null)
            {
                dtResultDatatable.Dispose();
            }
            return listItemCollection;
        }
예제 #29
0
        /// <summary>
        /// Updates the list entry.
        /// </summary>
        /// <param name="siteURL">The site URL.</param>
        /// <param name="listEntry">The list entry.</param>
        /// <param name="listName">Name of the list.</param>
        /// <param name="auditListName">Audit List Name.</param>
        /// <param name="userName">User Name.</param>
        /// <param name="actionPerformed">Audit Action.</param>
        /// <returns>ID of the Chapter Page Created.</returns>
        /// <exception cref="">Handled in calling method.</exception>
        internal string AddChapterMasterPageMapping(string siteURL, ListEntry listEntry, string listName, string auditListtname, string username, string actionPerformed)
        {
            SPList list;
            SPListItem objListItem;
            int intRowId = 0;
            StringBuilder strTemplatePageMappingRowId = new StringBuilder();
            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                using (SPSite site = new SPSite(siteURL))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        web.AllowUnsafeUpdates = true;
                        list = web.Lists[listName];
                        objCommonDAL = new CommonDAL();

                        string strCAMLQuery = string.Empty;
                        string strViewFields = string.Empty;
                        string strBookTeamID = string.Empty;
                        string strPageOwner = string.Empty;
                        string strUserID = string.Empty;
                        DataTable dtTeamStaff = null;
                        DataTable dtBook = null;
                        DataTable dtUser = null;
                        if (listEntry != null)
                        {
                            /// Get the Team of the book
                            if (listEntry.ChapterDetails != null)
                            {
                                strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + listEntry.ChapterDetails.BookID.ToString() + "</Value></Eq></Where>";
                                strViewFields =@"<FieldRef Name='ID' /><FieldRef Name='Team' /><FieldRef Name='Team_ID' />";
                                dtBook = objCommonDAL.ReadList(siteURL, DWBBOOKLIST, strCAMLQuery, strViewFields);
                                if (dtBook != null && dtBook.Rows.Count > 0)
                                {
                                    strBookTeamID = Convert.ToString(dtBook.Rows[0]["Team_ID"]);
                                }
                            }

                            for (int i = 0; i < listEntry.ChapterPagesMapping.Count; i++)
                            {
                                strPageOwner = string.Empty;
                                objListItem = list.Items.Add();
                                objListItem["Master_Page_ID"] = listEntry.ChapterPagesMapping[i].MasterPageID;
                                objListItem["Page_Actual_Name"] = listEntry.ChapterPagesMapping[i].PageActualName;
                                objListItem["Page_Name"] = listEntry.ChapterPagesMapping[i].PageName;

                                objListItem["Discipline"] = listEntry.ChapterPagesMapping[i].Discipline;
                                objListItem["Chapter_ID"] = listEntry.ChapterDetails.RowID;
                                objListItem["Asset_Type"] = listEntry.ChapterPagesMapping[i].AssetType;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Empty))
                                    objListItem["Empty"] = listEntry.ChapterPagesMapping[i].Empty;
                                objListItem["Page_Sequence"] = listEntry.ChapterPagesMapping[i].PageSequence;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].SignOffStatus))
                                {
                                    objListItem["Sign_Off_Status"] = listEntry.ChapterPagesMapping[i].SignOffStatus;
                                }
                                objListItem["Standard_Operating_Procedure"] = listEntry.ChapterPagesMapping[i].StandardOperatingProc;
                                objListItem["Connection_Type"] = listEntry.ChapterPagesMapping[i].ConnectionType;
                                if (!string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].PageURL))
                                {
                                    objListItem["Page_URL"] = listEntry.ChapterPagesMapping[i].PageURL;
                                }
                                strCAMLQuery = string.Empty;
                                strViewFields = string.Empty;
                                /// Retrieve the User with Rank =1 for the selected Team(Book) and Discipline(MasterPage) , "DWB Team Staff" and  assign to "Owner" column
                                if (!string.IsNullOrEmpty(strBookTeamID) && !string.IsNullOrEmpty(listEntry.ChapterPagesMapping[i].Discipline))
                                {
                                    strCAMLQuery = @"<OrderBy><FieldRef Name='User_Rank' Ascending='TRUE' /></OrderBy><Where><And><And><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + strBookTeamID + "</Value></Eq><Eq><FieldRef Name='Discipline' /><Value Type='Text'>" + listEntry.ChapterPagesMapping[i].Discipline + "</Value></Eq></And><Eq><FieldRef Name='User_Rank' /><Value Type='Number'>" + "1" + "</Value></Eq></And></Where>";
                                    strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Team_ID' /><FieldRef Name='Discipline' /><FieldRef Name='User_Rank' /><FieldRef Name='User_ID' /><FieldRef Name='Title' />";
                                    dtTeamStaff = objCommonDAL.ReadList(siteURL, DWBTEAMSTAFFLIST, strCAMLQuery, strViewFields);
                                }
                                if (dtTeamStaff != null && dtTeamStaff.Rows.Count > 0)
                                {
                                    strUserID = Convert.ToString(dtTeamStaff.Rows[0]["User_ID"]);
                                    strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strUserID + "</Value></Eq></Where>";
                                    strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Windows_User_ID' />";
                                    dtUser = objCommonDAL.ReadList(siteURL, DWBUSERLIST, strCAMLQuery, strViewFields);
                                    if (dtUser != null && dtUser.Rows.Count > 0)
                                    {
                                        strPageOwner = dtUser.Rows[0]["Windows_User_ID"].ToString();
                                    }
                                }
                                if (!string.IsNullOrEmpty(strPageOwner))
                                {
                                    objListItem["Owner"] = strPageOwner;
                                }
                                else /// If no user with Rank =1 or no user for the selected discipline available, assign the Master Page Owner to "Owner" column
                                {
                                    objListItem["Owner"] = listEntry.ChapterPagesMapping[i].PageOwner;
                                }
                                objListItem.Update();
                                int.TryParse(Convert.ToString(objListItem["ID"]), out intRowId);
                                listEntry.ChapterPagesMapping[i].RowId = intRowId;
                                objCommonDAL.UpdateListAuditHistory(siteURL, auditListtname, intRowId, username, actionPerformed);

                            }
                        }

                        web.AllowUnsafeUpdates = false;
                        if (dtBook != null)
                        {
                            dtBook.Dispose();
                        }
                        if (dtTeamStaff != null)
                        {
                            dtTeamStaff.Dispose();
                        }
                        if (dtUser != null)
                        {
                            dtUser.Dispose();
                        }
                    }
                }
            });

            return strTemplatePageMappingRowId.ToString();
        }
예제 #30
0
        /// <summary>
        /// Gets the Master Page Details.
        /// </summary>
        /// <param name="parentSiteUrl">Site URL.</param>
        /// <param name="listName">List Name.</param>
        /// <param name="queryString">CAML Query.</param>
        /// <returns>ListEntry object.</returns>
        internal ListEntry GetMasterPageDetail(string parentSiteUrl, string listName, string queryString)
        {
            ListEntry objListEntry = null;
            DataTable objListItems = null;
            DataRow objListRow;
            MasterPageDetails objMasterPage = null;
            try
            {
                objCommonDAL = new CommonDAL();
                objListItems = objCommonDAL.ReadList(parentSiteUrl, listName, queryString);

                if (objListItems != null)
                {
                    objListEntry = new ListEntry();
                    objMasterPage = new MasterPageDetails();
                    for (int index = 0; index < objListItems.Rows.Count; index++)
                    {
                        objListRow = objListItems.Rows[index];
                        objMasterPage.Name = objListRow["Title"].ToString();
                        objMasterPage.TemplateTitle = objListRow["Title_Template"].ToString();
                        if (objListRow["Page_Sequence"] != DBNull.Value)
                        {
                            objMasterPage.PageSequence = Convert.ToInt32(objListRow["Page_Sequence"]);
                        }
                        objMasterPage.AssetType = Convert.ToString(objListRow["Asset_Type"]);
                        objMasterPage.SignOffDiscipline = Convert.ToString(objListRow["Sign_Off_Discipline"]);
                        objMasterPage.SOP = Convert.ToString(objListRow["Standard_Operating_Procedure"]);
                        objMasterPage.ConnectionType = Convert.ToString(objListRow["Connection_Type"]);
                        objMasterPage.Terminated = Convert.ToString(objListRow["Terminate_Status"]);
                        objMasterPage.Templates = Convert.ToString(objListRow["Template_ID"]);
                        objListEntry.MasterPage = objMasterPage;
                    }
                }
                return objListEntry;
            }
            finally
            {
                if (objListItems != null)
                    objListItems.Dispose();
            }
        }