/// <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; }
/// <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; } }
/// <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(); } }
/// <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; }
/// <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; }
/// <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; }
/// <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 }
/// <summary> /// Update Sign Off Status /// Added By: Praveena /// Date:11/09/2010 /// Reason: For module Simplify Sign Off /// </summary> /// <param name="siteURL"></param> /// <param name="listName"></param> /// <param name="signOffStatus"></param> /// <param name="pageIDs"></param> /// <param name="actionPerformed"></param> public void UpdateBulkSignOffStatus(string siteURL, string listName, string signOffStatus, string pageIDs, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objCommonBLL = new CommonBLL(); string strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIDs, "ID", "Number"); WellBookDAL.UpdateBulkSignOffSatus(siteURL, listName, strCAMLQuery, signOffStatus); objCommonDAL = new CommonDAL(); Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); objCommonDAL.UpdateBulkListAuditHistory(siteURL, CHAPTERPAGESMAPPINGAUDITLIST, pageIDs, strUserName, actionPerformed); }