/// <summary> /// Sets the book title. /// </summary> private void SetBookTitle() { try { string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /> <Value Type='Counter'>" + strSelectedID + "</Value></Eq></Where>"; string strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' />"; CommonBLL objCommon = new CommonBLL(); DataTable dtBook = objCommon.ReadList(strParentSiteURL, DWBBOOKLIST, strCamlQuery, strViewFields); if (dtBook != null && dtBook.Rows.Count > 0) { lblBookTitle.Text = Convert.ToString(dtBook.Rows[0][DWBTITLECOLUMN]); dtBook.Dispose(); } } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Binds the Data to ChapterName Dropdown /// Added By: Praveena /// Date:3/09/2010 /// Reason: To Populate Values in ChapterName ListBox /// </summary> /// <param name="cboList"></param> /// <param name="strListname"></param> /// <param name="strCAMLQuery"></param> protected void BindChapterNameListBox(ListBox listBox, string strListname) { string strBookId = HttpContext.Current.Request.QueryString["BookId"]; string strCamlQuery = @"<Where><And><Eq><FieldRef Name='Book_ID' /> <Value Type='Number'>" + strBookId + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>"; DataTable dtListData = null; DataRow drListData; ListItem lstItem; string strViewFields = string.Empty; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' />"; objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strSiteURL, strListname, strCamlQuery, strViewFields); if (dtListData != null && dtListData.Rows.Count > 0) { /// Loop through the list and add items listBox.Items.Clear(); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = drListData[DWBTITLECOLUMN].ToString(); lstItem.Value = drListData[DWBIDCOLUMN].ToString(); listBox.Items.Add(lstItem); } } if (dtListData != null) dtListData.Dispose(); }
/// <summary> /// Gets the parent title for the selected item. /// </summary> /// <returns>Title of the selected item.</returns> protected string GetParentTitle() { string strTitle = string.Empty; string strCAMLQuery = string.Empty; string strFieldsToView = string.Empty; DataTable dtResultTable = null; switch (strReportName) { case TEMPLATEPAGESREPORT: { TemplateDetailBLL objTemplateDetail = new TemplateDetailBLL(); strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING] + "</Value></Eq></Where>"; ListEntry objTemplateListEntry = objTemplateDetail.GetTemplateDetail(strSiteURL, TEMPLATELIST, strCAMLQuery); if (objTemplateListEntry != null && objTemplateListEntry.TemplateDetails != null) { strTitle = objTemplateListEntry.TemplateDetails.Title; } break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); ListEntry objTeamListEntry = objTeamStaffRegistrationBLL.GetTeamDetails(strSiteURL, HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING], TEAMLIST); if (objTeamListEntry != null && objTeamListEntry.TeamDetails != null) { strTitle = objTeamListEntry.TeamDetails.TeamName; } break; } case "Audit Trail": { if (HttpContext.Current.Request.QueryString["auditFor"] != null) strTitle = HttpContext.Current.Request.QueryString["auditFor"]; else strTitle = string.Empty; break; } case CHAPTERREPORT: case WELLBOOKPAGEVIEW: case CHAPTERPAGEMAPPINGREPORT: { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString["BookId"] + "</Value></Eq></Where>"; objCommonBLL = new CommonBLL(); strFieldsToView = "<FieldRef Name='ID'/><FieldRef Name='Title'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, WELLBOOKLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = Convert.ToString(dtResultTable.Rows[0]["Title"]); } break; } case CHAPTERPAGEREPORT: { string strBookId = string.Empty; strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + HttpContext.Current.Request.QueryString["ChapterID"] + "</Value></Eq></Where>"; objCommonBLL = new CommonBLL(); strFieldsToView = "<FieldRef Name='Title'/><FieldRef Name='Book_ID'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, CHAPTERLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = Convert.ToString(dtResultTable.Rows[0]["Title"]); strBookId = Convert.ToString(dtResultTable.Rows[0]["Book_ID"]); } if (!string.IsNullOrEmpty(strBookId)) { strCAMLQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + strBookId + "</Value></Eq></Where>"; strFieldsToView = "<FieldRef Name='Title'/>"; dtResultTable = objCommonBLL.ReadList(strSiteURL, WELLBOOKLIST, strCAMLQuery, strFieldsToView); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { strTitle = strTitle + " ( " + Convert.ToString(dtResultTable.Rows[0]["Title"]) + " )"; } } break; } } if (dtResultTable != null) { dtResultTable.Dispose(); } return strTitle; }
/// <summary> /// Gets the CAML query for well book summary pages. /// </summary> /// <returns> CAML query for well book summary pages.</returns> private string GetCAMLQueryForWellBookSummaryPages() { string strCamlQuery = string.Empty; StringBuilder sbChapterId = new StringBuilder(); DataTable dtListDetails = null; string strTerminated = string.Empty; if (!ActiveStatus) strTerminated = STATUS_TERMINATED; else strTerminated = STATUS_ACTIVE; string strbookId = HttpContext.Current.Request.QueryString["BookId"]; string wellbookStatus = HttpContext.Current.Request.QueryString["pageStatus"]; string strPageOnwer = HttpContext.Current.Request.QueryString["pageOwner"]; if (string.IsNullOrEmpty(strbookId)) return string.Empty; objCommonBLL = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + strbookId + "</Value></Eq></Where>"; dtListDetails = objCommonBLL.ReadList(strSiteURL, CHAPTERLIST, strCamlQuery); if (dtListDetails != null && dtListDetails.Rows.Count > 0) { dicChatperDetail = new System.Collections.Generic.Dictionary<string, string>(); for (int intRowIndex = 0; intRowIndex < dtListDetails.Rows.Count; intRowIndex++) { if (!dicChatperDetail.ContainsKey(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"]))) { dicChatperDetail.Add(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"]), Convert.ToString(dtListDetails.Rows[intRowIndex]["Title"])); sbChapterId.Append(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"])); sbChapterId.Append(";"); } } strCamlQuery = CreateCAMLQueryForSetOfCondtion(sbChapterId.ToString(), "Chapter_ID", "Number"); sbChapterId.Remove(0, sbChapterId.Length); sbChapterId.Append(strCamlQuery); if (strPageOnwer.Equals("All") && wellbookStatus.Equals("Total")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>" + strSignedOffStatus + "</Value></Eq></And>"); sbChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></And></Where>"); sbChapterId.Insert(0, "<Where><And><And>"); } else if (!strPageOnwer.Equals("All") && wellbookStatus.Equals("Total")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>" + strSignedOffStatus + "</Value></Eq></And>"); sbChapterId.Append("<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strPageOnwer + "</Value></Eq></And>"); sbChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></And></Where>"); sbChapterId.Insert(0, "<Where><And><And><And>"); } else if (strPageOnwer.Equals("All") && !wellbookStatus.Equals("Total")) { if (wellbookStatus.Equals("SignedOff")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>Yes</Value></Eq></And>"); } else if (wellbookStatus.Equals("NotSignedOff")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>No</Value></Eq></And>"); } else if (wellbookStatus.Equals("Empty")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>" + strSignedOffStatus + "</Value></Eq></And>"); //need to add here also? sbChapterId.Append("<Eq><FieldRef Name='Empty' /><Value Type='Choice'>Yes</Value></Eq></And>"); } sbChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></And></Where>"); if (wellbookStatus.Equals("Empty")) sbChapterId.Insert(0, "<Where><And><And><And>"); else sbChapterId.Insert(0, "<Where><And><And>"); } else if (!strPageOnwer.Equals("All") && !wellbookStatus.Equals("Total")) { if (wellbookStatus.Equals("SignedOff")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>Yes</Value></Eq></And>"); } else if (wellbookStatus.Equals("NotSignedOff")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>No</Value></Eq></And>"); } else if (wellbookStatus.Equals("Empty")) { sbChapterId.Append("<Eq><FieldRef Name='Sign_Off_Status' /><Value Type='Choice'>" + strSignedOffStatus + "</Value></Eq></And>"); sbChapterId.Append("<Eq><FieldRef Name='Empty' /><Value Type='Choice'>Yes</Value></Eq></And>"); } sbChapterId.Append("<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strPageOnwer + "</Value></Eq></And>"); sbChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></And></Where>"); if (wellbookStatus.Equals("Empty")) sbChapterId.Insert(0, "<Where><And><And><And><And>"); else sbChapterId.Insert(0, "<Where><And><And><And>"); } sbChapterId.Insert(0, "<OrderBy><FieldRef Name='Connection_Type' /></OrderBy>"); } if (dtListDetails != null) { dtListDetails.Dispose(); } return sbChapterId.ToString(); }
/// <summary> /// Sets the book attributes. /// </summary> /// <param name="dataRow">The data row.</param> /// <returns>ArrayList.</returns> private ArrayList SetBookAttributes(DataRow dataRow) { ArrayList arlAttributes = null; string strCamlQuery = string.Empty; string strViewFields = string.Empty; string strPageOwner = string.Empty; DataTable dtUser = null; try { arlAttributes = new ArrayList(); arlAttributes.Add(CreateAttribute("Name", Convert.ToString(dataRow["Title"]), "true")); arlAttributes.Add(CreateAttribute("Team", dataRow["Team"].ToString(), "true")); strCamlQuery = @"<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>" + dataRow["Owner"].ToString() + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='DWBUserName' />"; objCommonBLL = new CommonBLL(); dtUser = objCommonBLL.ReadList(strSiteURL, USERLIST, strCamlQuery, strViewFields); if (dtUser != null && dtUser.Rows.Count > 0) { strPageOwner = dtUser.Rows[0]["DWBUserName"].ToString(); } arlAttributes.Add(CreateAttribute("Well Book Owner", strPageOwner, "true")); return arlAttributes; } catch { throw; } }
/// <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> /// This method binds the values to DropDownLists /// </summary> /// <param name="cboList">DropDownListID</param> private void BindDropDown(DropDownList cboList) { DataTable dtListData = null; try { if (cboList.ID == "cboFileType") { cboList.Items.Clear(); string strCamlQuery = @" <Where><IsNotNull><FieldRef Name='File_Type' /></IsNotNull></Where>"; string strViewFields = string.Empty; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='File_Type' />"; objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, DWBFILETYPE, strCamlQuery, strViewFields); if (dtListData != null && dtListData.Rows.Count > 0) { cboList.DataSource = dtListData; cboList.DataValueField = "ID"; cboList.DataTextField = "File_Type"; cboList.DataBind(); } } else { cboList.Items.Clear(); string strCamlQuery = @" <Where><IsNotNull><FieldRef Name='Title' /></IsNotNull></Where>"; string strViewFields = string.Empty; strViewFields = @"<FieldRef Name='Actual_Naming_Convention' /><FieldRef Name='Title' />"; objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, DWBDOCUMENTNAMINGCONVENTION, strCamlQuery, strViewFields); if (dtListData != null && dtListData.Rows.Count > 0) { cboList.DataSource = dtListData; cboList.DataValueField = "Actual_Naming_Convention"; cboList.DataTextField = "Title"; cboList.DataBind(); } } } catch (WebException webEx) { lblException.Text = webEx.Message; lblException.Visible = true; ExceptionBlock.Visible = true; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Sets the list values. /// </summary> /// <param name="dropDownList">The drop down list.</param> /// <param name="listName">Name of the list.</param> protected void SetListValues(DropDownList dropDownList, string listName, string textField, string valueField, string selectedValue) { DataTable dtListData = null; DataRow drListData; ListItem lstItem; try { objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, listName, string.Empty); if (dtListData != null && dtListData.Rows.Count > 0) { /// Loop through the values in Country List and finds the index of country user preference in List. dropDownList.Items.Clear(); dropDownList.Items.Add(DROPDOWNDEFAULTTEXT); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = drListData[textField].ToString(); lstItem.Value = drListData[valueField].ToString(); dropDownList.Items.Add(lstItem); } if (dropDownList.Items.FindByValue(selectedValue) != null) { dropDownList.Items.FindByValue(selectedValue).Selected = true; } } } catch { throw; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Sets the list box values based on the CAML query /// </summary> /// <param name="lstListBox"></param> /// <param name="listName"></param> /// <param name="strCAMLQuery"></param> protected void SetListValues(ListBox lstListBox, string listName, string strCAMLQuery, DWBDataObjects.ListEntry objListEntry) { DataTable dtListData = null; DataRow drListData; ListItem lstItem; try { objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, listName, strCAMLQuery); if (dtListData != null && dtListData.Rows.Count > 0) { lstListBox.Items.Clear(); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = Convert.ToString(drListData[DWBTITLECOLUMN]); lstItem.Value = Convert.ToString(drListData[DWBIDCOLUMN]); if (objListEntry != null) { if (objListEntry.MasterPage.Templates.Contains(lstItem.Value)) lstListBox.Items.Add(lstItem); } else { lstListBox.Items.Add(lstItem); } } } } catch { throw; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Gets the items already included /// </summary> /// <param name="lbxMasterPageList">DualList object</param> /// <param name="strListName">List name from where the Right box to populated</param> /// <param name="strPageType">Page where the Dual list control is used (Template/User Privileges/Staff Privileges)</param> protected void SetDualListRightBox(DualList dualLstMasterPages, string strListName, string strSelectedID, string strPageType) { DataTable objListData = null; DataRow objListRow; ListItem lstItem; DataView objlistSortedView; string strCAMLQuery = string.Empty; string strViewFields = string.Empty; try { switch (strPageType) { case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); strCAMLQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><Eq><FieldRef Name='Template_ID' /><Value Type='Number'>" + strSelectedID + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Master_Page_Name' /><FieldRef Name='Master_Page_ID' />"; objListData = objTemplateBLL.GetMasterPageList(strParentSiteURL, strListName, strCAMLQuery, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { objlistSortedView = objListData.DefaultView; dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = string.Format("{0:0000}", objListRow["Page_Sequence"]) + "-" + objListRow["Master_Page_Name"].ToString(); lstItem.Value = objListRow[DWBIDCOLUMN].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } break; } case USERPRIVILEGES: { /// Get the Privileges string from DWB User List - strSelectedID string contains the Privileges from User List / Team Staff List /// Split the String with splitter ";" /// For each Privilege in User Record get Privilege from DWB System Privileges list / DWB Team Privileges List string[] privileges = strSelectedID.Split(SPLITTER, StringSplitOptions.None); /// Privilege_Abbr - Title column is used strViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Privilege_Description'/><FieldRef Name='ID'/>"; if (privileges != null && privileges.Length > 0) { string strTempCAML = string.Empty; strCAMLQuery = string.Empty; if (privileges.Length == 1) { strCAMLQuery = @"<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[0] + "</Value></Eq>"; } else { for (int intIndex = privileges.Length; intIndex > 0; intIndex--) { if (intIndex == privileges.Length) { strTempCAML = string.Empty; strTempCAML = @"<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>"; strCAMLQuery = strTempCAML; } else if (intIndex == privileges.Length - 1) { strTempCAML = string.Empty; strTempCAML = @"<Or>" + strCAMLQuery + "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>" + "</Or>"; strCAMLQuery = strTempCAML; } else { strTempCAML = string.Empty; strTempCAML = @"<Or>" + strCAMLQuery + "<Eq><FieldRef Name='Title'/><Value Type='Text'>" + privileges[intIndex - 1] + "</Value></Eq>" + "</Or>"; strCAMLQuery = strTempCAML; } } } strCAMLQuery = @"<Where>" + strCAMLQuery + "</Where>"; objCommonBLL = new CommonBLL(); objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strCAMLQuery, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { /// Loop through the values in Country List and finds the index of country user preference in List. dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[PRIVILEGEDESCRIPTIONCOLUMN].ToString(); lstItem.Value = objListRow[DWBTITLECOLUMN].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } } break; } case STAFFREGISTRATION: { TeamStaffRegistrationBLL objTeamStaffRegistrationBLL = new TeamStaffRegistrationBLL(); objListData = objTeamStaffRegistrationBLL.GetStaffs(strParentSiteURL, strSelectedID, strListName); if (objListData != null && objListData.Rows.Count > 0) { /// Title column is renamed as User_Name dualLstMasterPages.RightItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[DWBTITLECOLUMN].ToString(); lstItem.Value = objListRow[DWBIDCOLUMN].ToString() + SPLITTER_STRING + objListRow["User_ID"].ToString(); dualLstMasterPages.RightItems.Add(lstItem); } } break; } } } catch { throw; } finally { if (objListData != null) objListData.Dispose(); } }
/// <summary> /// Sets the list box values. /// </summary> /// <param name="listBox">The list box.</param> /// <param name="listName">Name of the list.</param> /// <param name="CAMLQuery">The CAML query.</param> /// <param name="viewFields">The view fields.</param> protected void SetListBoxValues(ListBox listBox, string listName, string CAMLQuery, string viewFields) { DataTable dtListData = null; DataRow drListData; ListItem lstItem; try { objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, listName, CAMLQuery, viewFields); if (dtListData != null && dtListData.Rows.Count > 0) { /// Loop through the Team list and add items listBox.Items.Clear(); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = drListData[DWBTITLECOLUMN].ToString(); lstItem.Value = drListData[DWBIDCOLUMN].ToString(); listBox.Items.Add(lstItem); } } } catch { throw; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Gets the items which are not included /// </summary> /// <param name="dualLstMasterPages">DualList object</param> /// <param name="strListName">List name from where the Right box to populated</param> /// <param name="strPageType">Page where the Dual list control is used (Template/User Privileges/Staff Privileges)</param> /// <param name="assetType">Asset Type if the Dual list box is used in Templates pages else string.Empty</param> protected void SetDualListLeftBox(DualList dualListBox, string strListName, string strPageType, string assetType) { DataTable objListData = null; DataRow objListRow; string strQuerystring = string.Empty; string strViewFields = string.Empty; ListItem lstItem; try { switch (strPageType) { case TEMPLATEMASTERPAGES: { objTemplateBLL = new TemplateDetailBLL(); strQuerystring = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Asset_Type' /><Value Type='Lookup'>" + assetType + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>"; strViewFields = @"<FieldRef Name='Page_Sequence' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Terminate_Status' />"; objListData = objTemplateBLL.GetMasterPageList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { //Loop through the values in Country List and finds the index of country user preference in List. dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = string.Format("{0:0000}", objListRow["Page_Sequence"]) + "-" + objListRow[DWBTITLECOLUMN].ToString(); lstItem.Value = string.Format("New{0}", objListRow[DWBIDCOLUMN].ToString()); dualListBox.LeftItems.Add(lstItem); } } break; } case USERPRIVILEGES: { /// Call the Team Privileges / System Privileges List to get the details objCommonBLL = new CommonBLL(); strQuerystring = string.Empty; /// Privilege_Abbr - Title column is used strViewFields = @"<FieldRef Name='Title'/><FieldRef Name='Privilege_Description'/><FieldRef Name='ID'/>"; objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = objListRow[PRIVILEGEDESCRIPTIONCOLUMN].ToString(); lstItem.Value = objListRow[DWBTITLECOLUMN].ToString(); dualListBox.LeftItems.Add(lstItem); } } break; } case STAFFREGISTRATION: { /// Call the DWB User List and populate with Active Users objCommonBLL = new CommonBLL(); strQuerystring = string.Empty; strViewFields = string.Empty; //strQuerystring = @"<Where><Eq><FieldRef Name='Terminate_Status'/><Value Type='Choice'>" + STATUSACTIVE + "</Value></Eq></Where>"; strQuerystring = @"<Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + STATUSACTIVE + "</Value></Eq><Neq><FieldRef Name='Discipline' /><Value Type='Lookup'>Administrator</Value></Neq></And></Where><OrderBy><FieldRef Name='DWBUserName' Ascending='True'/></OrderBy>"; strViewFields = @"<FieldRef Name='Terminate_Status'/><FieldRef Name='ID'/><FieldRef Name='DWBUserName'/>"; objListData = objCommonBLL.ReadList(strParentSiteURL, strListName, strQuerystring, strViewFields); if (objListData != null && objListData.Rows.Count > 0) { dualListBox.LeftItems.Clear(); for (int intRowIndex = 0; intRowIndex < objListData.Rows.Count; intRowIndex++) { objListRow = objListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = Convert.ToString(objListRow["DWBUserName"]); lstItem.Value = Convert.ToString(objListRow[DWBIDCOLUMN]); dualListBox.LeftItems.Add(lstItem); } } break; } } } catch { throw; } finally { if (objListData != null) objListData.Dispose(); } }
/// <summary> /// Prints the Book/Chapter/Page. /// </summary> /// <param name="objPrintOptions">The PrintOptions object.</param> /// <param name="controlType">Type of the control.</param> /// <param name="mode">The mode.</param> /// <returns></returns> protected int Print(DWBDataObjects.PrintOptions objPrintOptions, string controlType, string mode) { bool blnUserControlFound = false; Telerik.Web.UI.RadTreeView trvWellBook = null; WellBookBLL objWellBookBLL; StringBuilder strPageIds; ArrayList arlPageDetails; ArrayList arlChapterCollection; string strSplitter = ";"; DWBDataObjects.BookInfo objBookInfo; DWBDataObjects.ChapterInfo objChapterInfo; XmlDocument xmlWellBookDetails = null; string intPrintedDocID = string.Empty; int intNoOfPrintedPages = 0; bool blnIsPagePrint = false; bool blnIsChapterPrint = false; bool blnIsBookPrint = false; SetUserNameDetailsforWebService(); if (string.Compare(mode, VIEW, true) != 0) { if (this.Parent.Parent.GetType().Equals(typeof(SPWebPartManager))) { foreach (Control ctrlWebPart in this.Parent.Parent.Controls) { if (ctrlWebPart.GetType().Equals(typeof(TreeViewControl))) { Control ctrlTreeView = ctrlWebPart.FindControl("RadTreeView1"); if (ctrlTreeView != null && ctrlTreeView.GetType().Equals(typeof(RadTreeView))) { trvWellBook = (RadTreeView)ctrlWebPart.FindControl("RadTreeView1"); blnUserControlFound = true; break; } if (blnUserControlFound) { break; } } } } } objWellBookBLL = new WellBookBLL(); objCommonBLL = new CommonBLL(); arlChapterCollection = new ArrayList(); /// If selected node is book node, loop into each chapter node /// If chapter node is checked, loop into each page node and create book info object /// Else if selected node is chapter node, loop into each page node /// Add only selected page details to chapter object. /// Else if selected node is page node, create bookinfo which includes only selected page. //Added By Gopinath //Date : 10/11/2010 //Description : Making Filter CAML query for Filter options which are loaded from PrintByPageType #region Building CAML Query using Print Options StringBuilder sbFilterCAMLQuery = new StringBuilder(); //Check for Current User as Page Owner string strCurrentUser = string.Empty; object ObjPrivileges = CommonUtility.GetSessionVariable(this.Page, enumSessionVariable.UserPrivileges.ToString()); DWBDataObjects.Privileges objStoredPriviledges = null; if (ObjPrivileges != null) { objStoredPriviledges = (DWBDataObjects.Privileges)ObjPrivileges; } strCurrentUser = GetUserName(); #region CAML Query if (objStoredPriviledges != null && objStoredPriviledges.SystemPrivileges != null) { if (!objStoredPriviledges.SystemPrivileges.PageOwner) { //Only for BO/AD if ((!objPrintOptions.PrintMyPages && objPrintOptions.IncludeFilter) || (objPrintOptions.PrintMyPages && objPrintOptions.IncludeFilter)) { //Page Name if ((!string.Equals(objPrintOptions.PageName, "all")) && (!string.IsNullOrEmpty(objPrintOptions.PageName))) sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Page_Name' /><Value Type='Text'>" + objPrintOptions.PageName + "</Value></Eq>"); else sbFilterCAMLQuery.Append(@"<IsNotNull><FieldRef Name='Page_Name' /></IsNotNull>"); if (string.Equals(objPrintOptions.PageName, "all")) //If page name selected then no need to consider discipline and page type. { //Discipline if ((!string.Equals(objPrintOptions.Discipline, "all")) && (!string.IsNullOrEmpty(objPrintOptions.Discipline))) sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Discipline' /><Value Type='Text'>" + objPrintOptions.Discipline + "</Value></Eq>"); else sbFilterCAMLQuery.Append(@"<IsNotNull><FieldRef Name='Discipline' /></IsNotNull>"); } else { sbFilterCAMLQuery.Append(@"<IsNotNull><FieldRef Name='Discipline' /></IsNotNull>"); } sbFilterCAMLQuery.Append("</And>"); sbFilterCAMLQuery.Insert(0, "<And>"); //Page Type if (string.Equals(objPrintOptions.PageName, "all")) //If page name selected then no need to consider discipline and page type. { #region Page Type //PageType contain values 0,1,2 if (!string.Equals(objPrintOptions.PageType, "none")) { char[] chSplitterComma = { ',' }; string[] strPageType = objPrintOptions.PageType.Split(chSplitterComma); if (strPageType != null && strPageType.Length > 0) { for (int index = 0; index < strPageType.Length; index++) { switch (strPageType[index]) { case "0": { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Connection_Type' /> <Value Type='Text'>1 - Automated</Value></Eq></And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } break; case "1": { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Connection_Type' /> <Value Type='Text'>2 - Published Document</Value></Eq></And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } break; case "2": { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Connection_Type' /> <Value Type='Text'>3 - User Defined Document</Value></Eq></And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } break; } } } } #endregion Page Type } //Signed Off if ((!string.Equals(objPrintOptions.SignedOff, "both")) && (!string.IsNullOrEmpty(objPrintOptions.SignedOff))) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Sign_Off_Status' /> <Value Type='Choice'>" + objPrintOptions.SignedOff + "</Value></Eq> </And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } //Empty Pages if ((!string.Equals(objPrintOptions.EmptyPages, "both")) && (!string.IsNullOrEmpty(objPrintOptions.EmptyPages))) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Empty' /> <Value Type='Choice'>" + objPrintOptions.EmptyPages + "</Value></Eq> </And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } if (objPrintOptions.PrintMyPages) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strCurrentUser + "</Value></Eq>"); sbFilterCAMLQuery.Append("</And>"); sbFilterCAMLQuery.Insert(0, "<And>"); } //Open & Close <Where></Where> sbFilterCAMLQuery.Append(@"</Where>"); sbFilterCAMLQuery.Insert(0, "<Where>"); } else if (objPrintOptions.PrintMyPages && !objPrintOptions.IncludeFilter) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strCurrentUser + "</Value></Eq>"); //Open & Close <Where></Where> sbFilterCAMLQuery.Append(@"</Where>"); sbFilterCAMLQuery.Insert(0, "<Where>"); } } // For PageOwner else if (objPrintOptions.PrintMyPages && objPrintOptions.IncludeFilter) { sbFilterCAMLQuery.Append(@"<Eq><FieldRef Name='Owner' /><Value Type='Text'>" + strCurrentUser + "</Value></Eq>"); //Open & Close <Where></Where> sbFilterCAMLQuery.Append(@"</Where>"); sbFilterCAMLQuery.Insert(0, "<Where>"); } } #endregion CAML Query //Retrive only Page Id string strViewFields = "<FieldRef Name='ID' />"; #endregion Building CAML Query using Print Options if (sbFilterCAMLQuery != null && sbFilterCAMLQuery.Length > 0) { strPageIdList = new List<string>(); //Declared Globally DataTable dtPageIds = objCommonBLL.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, sbFilterCAMLQuery.ToString(), strViewFields); if (dtPageIds != null && dtPageIds.Rows.Count > 0) { foreach (DataRow drPageId in dtPageIds.Rows) { strPageIdList.Add(drPageId[0].ToString()); } } } ///End Gopinath code. switch (controlType) { case WELLBOOKVIEWERCONTROLBOOK: { #region BOOK PRINT blnIsBookPrint = true; if (trvWellBook != null) { if (trvWellBook.SelectedNode == null) { trvWellBook.Nodes[0].Selected = true; } if (trvWellBook.SelectedNode.Level == 0) { objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, trvWellBook.SelectedNode.Value, BOOKACTIONPRINT, false, objPrintOptions); if (trvWellBook.CheckedNodes.Count > 0) { foreach (RadTreeNode chapterNode in trvWellBook.SelectedNode.Nodes) { if (chapterNode.Checked) { objChapterInfo = CreateChapterInfo(chapterNode); if (objChapterInfo != null) arlChapterCollection.Add(objChapterInfo); if (objChapterInfo != null && objChapterInfo.PageInfo != null) { intNoOfPrintedPages += objChapterInfo.PageInfo.Count; } } } objBookInfo.Chapters = arlChapterCollection; objBookInfo.PageCount = intNoOfPrintedPages; if (objBookInfo.Chapters.Count == 0) objBookInfo = null; xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } else { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", ALERTNOCHAPTERNODECHECKED, true); } } } #endregion BOOK PRINT break; } case WELLBOOKVIEWERCONTROLCHAPTER: { #region CHAPTER PRINT blnIsChapterPrint = true; if (trvWellBook != null) { objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, trvWellBook.SelectedNode.ParentNode.Value, BOOKACTIONPRINT, false, objPrintOptions); if (trvWellBook.SelectedNode.Level == 1) { if (trvWellBook.SelectedNode.Checked) { objChapterInfo = CreateChapterInfo(trvWellBook.SelectedNode); if (objChapterInfo != null) arlChapterCollection.Add(objChapterInfo); objBookInfo.Chapters = arlChapterCollection; if (objBookInfo.Chapters.Count == 0) objBookInfo = null; xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } else { this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", ALERTNOPAGENODECHECKED, true); } } } #endregion CHAPTER PRINT break; } case WELLBOOKVIEWERCONTROLPAGE: { #region PAGE PRINT blnIsPagePrint = true; string strPageID = string.Empty; string strChapterID = string.Empty; string strBookID = string.Empty; if (trvWellBook != null) { if (trvWellBook.SelectedNode.Level == 2) { strBookID = trvWellBook.SelectedNode.ParentNode.ParentNode.Value; strChapterID = trvWellBook.SelectedNode.ParentNode.Value; strPageID = trvWellBook.SelectedNode.Value; } } else if (string.Compare(mode, VIEW, true) == 0) { strPageID = HttpContext.Current.Request.QueryString[PAGEIDQUERYSTRING]; strChapterID = HttpContext.Current.Request.QueryString[CHAPTERIDQUERYSTRING]; DWBDataObjects.BookInfo objBookInfoSession = ((DWBDataObjects.BookInfo)HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT]); if (objBookInfoSession != null) { strBookID = objBookInfoSession.BookID; } } objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, strBookID, BOOKACTIONPRINT, false, objPrintOptions); objChapterInfo = objWellBookBLL.SetChapterDetails(strParentSiteURL, strChapterID, false); if (objChapterInfo != null) { strPageIds = new StringBuilder(); strPageIds.Append(strPageID); strPageIds.Append(strSplitter); arlPageDetails = objWellBookBLL.SetSelectedPageInfo(strParentSiteURL, strPageIds.ToString(), objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName); if (arlPageDetails != null && arlPageDetails.Count > 0) { objChapterInfo.PageInfo = arlPageDetails; } arlChapterCollection.Add(objChapterInfo); } if (arlChapterCollection != null && arlChapterCollection.Count > 0) { objBookInfo.Chapters = arlChapterCollection; } xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); #endregion PAGE PRINT break; } default: break; } if (xmlWellBookDetails == null) { return -1; } string strSiteURL = strParentSiteURL; SslRequiredWebPart objSslRequired = new SslRequiredWebPart(); strSiteURL = objSslRequired.GetSslURL(strSiteURL); PDFServiceSPProxy objPDFService; SPSecurity.RunWithElevatedPrivileges(delegate() { objPDFService = new PDFServiceSPProxy(); objPDFService.PreAuthenticate = true; objPDFService.Credentials = new NetworkCredential(strWebServiceUserName, strWebServicePassword, strWebServiceDomain); PdfBLL objPdfBLL = new PdfBLL(); if (xmlWellBookDetails != null) { try { string strBookName = xmlWellBookDetails.DocumentElement.Attributes["BookName"].Value.ToString(); string strRequestID = Guid.NewGuid().ToString(); if (blnIsPagePrint) { string strDocumentURLTemp = PortalConfiguration.GetInstance().GetKey("DWBPrintNetworkPath") + string.Format("{0}_{1}", strBookName, strRequestID) + ".pdf"; UpdatePagePrintDetails(strRequestID, strDocumentURLTemp, strSiteURL, "temp"); intPrintedDocID = objPDFService.GeneratePDFDocument(xmlWellBookDetails.DocumentElement, strParentSiteURL, strRequestID); strDocumentURL = strSiteURL + "/Pages/eWBPDFViewer.aspx?mode=page&requestID=" + strRequestID; } else if (blnIsChapterPrint) { UpdateDWBChapterPrintDetails(strCurrentUser, strRequestID, strBookName); //strCurrentUser, strRequestID, e-MailID, document URL //intPrintedDocID = objPDFService.GeneratePDFDocument(xmlWellBookDetails.DocumentElement, strParentSiteURL, strRequestID); AsyncCallback asyncCall = new AsyncCallback(CallbackMethod); objPDFService.Timeout = System.Threading.Timeout.Infinite; objPDFService.BeginGeneratePDFDocument(xmlWellBookDetails.DocumentElement, strParentSiteURL, strRequestID, asyncCall, objPDFService); } else if (blnIsBookPrint) { UpdateDWBBookPrintDetails(strCurrentUser, strRequestID, strBookName, xmlWellBookDetails); } } catch (SoapException) { throw; } } }); return 1; }
/// <summary> /// Sets the chapter details based on the selected master page. /// </summary> private void SetChapterPageDetails() { try { objChapterBLL = new ChapterBLL(); ChapterDetails objChapterdetails = null; int intChapterId = 0; string strConnectionType = string.Empty; ChapterPagesMapping objChapterPageMapping = null; List<ChapterPagesMapping> lstChapterPageMapping = new List<ChapterPagesMapping>(); string strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + cboMasterPages.SelectedValue + "</Value></Eq></Where>"; DataTable dtresultTable = GetListItems(MASTERPAGELIST, strCamlQuery, string.Empty); if (dtresultTable != null && dtresultTable.Rows.Count > 0) { objListEntry = new ListEntry(); objChapterdetails = new ChapterDetails(); int.TryParse(strChapterID, out intChapterId); objChapterdetails.RowID = intChapterId; for (int intRowIndex = 0; intRowIndex < dtresultTable.Rows.Count; intRowIndex++) { objChapterPageMapping = new ChapterPagesMapping(); objChapterPageMapping.Discipline = Convert.ToString(dtresultTable.Rows[intRowIndex]["Sign_Off_Discipline"]); objChapterPageMapping.PageName = Convert.ToString(dtresultTable.Rows[intRowIndex][DWBTITLECOLUMN]); objChapterPageMapping.PageActualName = Convert.ToString(dtresultTable.Rows[intRowIndex]["Title_Template"]); objChapterPageMapping.PageSequence = Convert.ToInt32(dtresultTable.Rows[intRowIndex]["Page_Sequence"]); objChapterPageMapping.AssetType = Convert.ToString(dtresultTable.Rows[intRowIndex]["Asset_Type"]); objChapterPageMapping.StandardOperatingProc = Convert.ToString(dtresultTable.Rows[intRowIndex]["Standard_Operating_Procedure"]); strConnectionType = Convert.ToString(dtresultTable.Rows[intRowIndex][CONNECTIONTYPECOLUMN]); objChapterPageMapping.ConnectionType = strConnectionType; objChapterPageMapping.PageURL = Convert.ToString(dtresultTable.Rows[intRowIndex]["Page_URL"]); if (!strConnectionType.Contains(CONNECTIONTYPEI)) { objChapterPageMapping.Empty = "Yes"; } if (cboPageOwner.SelectedIndex == 0) { objChapterPageMapping.PageOwner = Convert.ToString(dtresultTable.Rows[intRowIndex]["Page_Owner"]); } else { DataTable dtUser = new DataTable(); strCamlQuery = string.Empty; string strViewFields = string.Empty; strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + cboPageOwner.SelectedValue + "</Value></Eq></Where>"; ; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Windows_User_ID' /><FieldRef Name='DWBUserName' />"; CommonBLL objCommonBLL = new CommonBLL(); dtUser = objCommonBLL.ReadList(strParentSiteURL, USERLIST, strCamlQuery, strViewFields); if (dtUser != null && dtUser.Rows.Count > 0) { objChapterPageMapping.PageOwner = Convert.ToString(dtUser.Rows[0][DWBUSERIDCOLUMN]); dtUser.Dispose(); } } objChapterPageMapping.MasterPageID = Convert.ToInt32(dtresultTable.Rows[intRowIndex][DWBIDCOLUMN]); objChapterPageMapping.Created_Date = Convert.ToString(dtresultTable.Rows[intRowIndex]["Created"]); objChapterPageMapping.Created_By = Convert.ToString(dtresultTable.Rows[intRowIndex]["Page_Owner"]); lstChapterPageMapping.Add(objChapterPageMapping); } objListEntry.ChapterPagesMapping = lstChapterPageMapping; objListEntry.ChapterDetails = objChapterdetails; } if (dtresultTable != null) dtresultTable.Dispose(); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Sets the System and Staff level privileges based on the entries in the datatable. /// </summary> /// <param name="strSiteURL">The STR site URL.</param> /// <param name="systemPrivileges">The system privileges.</param> /// <returns>Privilege collection.</returns> public Privileges SetPrivilegesObjects(string strSiteURL, DataTable systemPrivileges) { Privileges objPrivileges = new Privileges(); string strPrivilege = string.Empty; SystemPrivileges objSystemPrivileges = null; if (systemPrivileges == null || systemPrivileges.Rows.Count == 0) { objPrivileges.IsNonDWBUser = true; return objPrivileges; } if (systemPrivileges != null && systemPrivileges.Rows.Count > 0) { if (systemPrivileges.Rows[0]["Privileges"] != DBNull.Value) strPrivilege = (string)systemPrivileges.Rows[0]["Privileges"]; if (!string.IsNullOrEmpty(strPrivilege)) { objSystemPrivileges = this.SetSytemPrivileges(strPrivilege); } if (objSystemPrivileges != null) { objSystemPrivileges.UserRecordID = Convert.ToInt32(systemPrivileges.Rows[0]["ID"].ToString()); objSystemPrivileges.Discipline = systemPrivileges.Rows[0]["Discipline"].ToString(); } /// Get the Teams the user is member of CommonBLL objCommonBLL = new CommonBLL(); string strCAMLQuery = string.Empty; string strViewFields = string.Empty; strCAMLQuery = @"<OrderBy><FieldRef Name='Team_ID' /></OrderBy> <Where> <Eq> <FieldRef Name='User_ID' /> <Value Type='Number'>" + systemPrivileges.Rows[0]["ID"].ToString() + "</Value>" + "</Eq>" + "</Where>"; strViewFields = @"<FieldRef Name='Team_ID' /><FieldRef Name='User_ID' /><FieldRef Name='ID' />"; DataTable dtResultTable = objCommonBLL.ReadList(strSiteURL, DWBTEAMSTAFFLIST, strCAMLQuery, strViewFields); StringBuilder sbTeamId = new StringBuilder(); FocalPoint objFocalPoint = new FocalPoint(); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { foreach (DataRow dtRow in dtResultTable.Rows) { sbTeamId.Append(Convert.ToString(dtRow["Team_ID"])); sbTeamId.Append("|"); } objFocalPoint.TeamIDs = sbTeamId.ToString(); dtResultTable.Dispose(); } /// Get the Books owned by user dtResultTable = null; strCAMLQuery = string.Empty; strViewFields = string.Empty; strCAMLQuery = @"<Where><Eq><FieldRef Name='Owner' /><Value Type='Lookup'>" + systemPrivileges.Rows[0]["Windows_User_ID"].ToString() + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='Owner' /><FieldRef Name='ID' /><FieldRef Name='Title' /><FieldRef Name='Team_ID' />"; dtResultTable = objCommonBLL.ReadList(strSiteURL, DWBBOOKLIST, strCAMLQuery, strViewFields); if (dtResultTable != null && dtResultTable.Rows.Count > 0) { sbTeamId = new StringBuilder(); foreach (DataRow dtRow in dtResultTable.Rows) { sbTeamId.Append(Convert.ToString(dtRow["Team_ID"])); sbTeamId.Append("|"); } objFocalPoint.BookIDs = sbTeamId.ToString(); dtResultTable.Dispose(); } objPrivileges.SystemPrivileges = objSystemPrivileges; objPrivileges.FocalPoint = objFocalPoint; } return objPrivileges; }
/// <summary> /// Sets the list values. /// </summary> /// <param name="dropDownList">The drop down list.</param> /// <param name="listName">Name of the list.</param> /// <param name="strCAMLQuery">The STR CAML query.</param> /// <param name="strViewFields">The STR view fields.</param> protected void SetListValues(DropDownList dropDownList, string listName, string strCAMLQuery, string strViewFields) { DataTable dtListData = null; DataRow drListData; ListItem lstItem = new ListItem(); try { objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, listName, strCAMLQuery, strViewFields); if (dtListData != null && dtListData.Rows.Count > 0) { /// Loop through the values in Country List and finds the index of country user preference in List. dropDownList.Items.Clear(); dropDownList.Items.Add(DROPDOWNDEFAULTTEXT); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = drListData[DWBTITLECOLUMN].ToString(); lstItem.Value = drListData[DWBIDCOLUMN].ToString(); dropDownList.Items.Add(lstItem); } } } catch { throw; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Sets the chapter details. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="ChapterID">The chapter ID.</param> /// <param name="chapterSelected">if set to <c>true</c> [chapter selected].</param> /// <returns></returns> public ChapterInfo SetChapterDetails(string siteURL, string ChapterID, bool chapterSelected) { ChapterInfo objChapterInfo = null; string strCamlQuery = string.Empty; DataTable dtChapters = null; DataRow objDataRow; try { objCommonBLL = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + ChapterID + "</Value></Eq></Where>"; dtChapters = objCommonBLL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery); for (int intIndex = 0; intIndex < dtChapters.Rows.Count; intIndex++) { objChapterInfo = new ChapterInfo(); objDataRow = dtChapters.Rows[intIndex]; objChapterInfo.AssetType = objDataRow["Asset_Type"].ToString(); objChapterInfo.AssetValue = objDataRow["Asset_Value"].ToString(); objChapterInfo.ChapterID = objDataRow[IDCOLUMN].ToString(); objChapterInfo.ChapterTitle = objDataRow[TITLECOLUMN].ToString(); objChapterInfo.ActualAssetValue = objDataRow["Actual_Asset_Value"].ToString(); objChapterInfo.ColumnName = objDataRow["Column_Name"].ToString(); if (chapterSelected) { /// Call SetPageInfo method and assign the Page Collection objChapterInfo.PageInfo = SetChapterPageInfo(siteURL, objChapterInfo.ChapterID, objChapterInfo.ActualAssetValue, objChapterInfo.ColumnName); } } } catch (Exception) { throw; } if (dtChapters != null) { dtChapters.Dispose(); } return objChapterInfo; }
/// <summary> /// Read active countries from 'Country' SPList and add to arraylist /// </summary> private ArrayList ReadActiveCountriesList() { ArrayList arlActiveCountries = new ArrayList(); DataTable objDtCountryList = new DataTable(); try { objCommonBLL = new CommonBLL(); string strCamlQuery = "<OrderBy><FieldRef Name=\"Title\"/></OrderBy><Where><Eq>" + "<FieldRef Name=\"Active\" /><Value Type=\"Choice\">Yes</Value></Eq></Where>"; /// this will read values from Country Sharepoint list. objDtCountryList = objCommonBLL.ReadList(strParentSiteURL, "Country", strCamlQuery); if (objDtCountryList != null && objDtCountryList.Rows.Count > 0) { /// Loop through the values in country list. foreach (DataRow dtRow in objDtCountryList.Rows) { arlActiveCountries.Add(SetValue(dtRow["Country_x0020_Code"].ToString())); } } } catch { throw; } finally { if (objDtCountryList != null) objDtCountryList.Dispose(); } return arlActiveCountries; }
/// <summary> /// Loads default values /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { if (!Page.IsPostBack) { if (HttpContext.Current.Request.QueryString["PageId"] != null) hidPageId.Value = HttpContext.Current.Request.QueryString["PageId"];//.ToString(); } //Added By Praveena //To get all File Types from List and passing to JavaScript DataTable dtListData = null; string strCamlQuery = @" <Where><IsNotNull><FieldRef Name='File_Type' /></IsNotNull></Where>"; string strViewFields = string.Empty; strViewFields = @"<FieldRef Name='File_Type' />"; objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, DWBFILETYPE, strCamlQuery, strViewFields); strFileTypes = new StringBuilder(); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { strFileTypes.Append(Convert.ToString(dtListData.Rows[intRowIndex]["File_Type"])); strFileTypes.Append("|"); } btnUpload.OnClientClick = "javascript:return eWBValidateUpload('" + strFileTypes.ToString() + "')"; } catch (WebException webEx) { RenderException(webEx.Message); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex); } }
/// <summary> /// Binds the Data to ChapterName Dropdown /// Added By: Praveena /// Date:3/09/2010 /// Reason: To Populate Values in ChapterName ListBox /// </summary> /// <param name="cboList"></param> /// <param name="strListname"></param> /// <param name="strCAMLQuery"></param> protected void BindChapterNameListBox(ListBox listBox, string listName, string CAMLQuery) { DataTable dtListData = null; DataRow drListData; ListItem lstItem; try { string strViewFields = string.Empty; strViewFields = @"<FieldRef Name='ID' /><FieldRef Name='Title' />"; objCommonBLL = new CommonBLL(); dtListData = objCommonBLL.ReadList(strParentSiteURL, listName, CAMLQuery, strViewFields); if (dtListData != null && dtListData.Rows.Count > 0) { /// Loop through the list and add items listBox.Items.Clear(); for (int intRowIndex = 0; intRowIndex < dtListData.Rows.Count; intRowIndex++) { drListData = dtListData.Rows[intRowIndex]; lstItem = new ListItem(); lstItem.Text = drListData[DWBTITLECOLUMN].ToString(); lstItem.Value = drListData[DWBIDCOLUMN].ToString(); listBox.Items.Add(lstItem); } } } catch { throw; } finally { if (dtListData != null) dtListData.Dispose(); } }
/// <summary> /// Gets the CAML query for well book pages. /// </summary> /// <returns>CAML query for well book pages.</returns> private string GetCAMLQueryForWellBookPages() { string strCamlQuery = string.Empty; StringBuilder sbChapterId = new StringBuilder(); DataTable dtListDetails = null; string strTerminated = string.Empty; if (!ActiveStatus) strTerminated = STATUS_TERMINATED; else strTerminated = STATUS_ACTIVE; string strBookId = HttpContext.Current.Request.QueryString["BookId"]; if (string.IsNullOrEmpty(strBookId)) return string.Empty; objCommonBLL = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID' /><Value Type='Number'>" + strBookId + "</Value></Eq></Where>"; dtListDetails = objCommonBLL.ReadList(strSiteURL, CHAPTERLIST, strCamlQuery); if (dtListDetails != null && dtListDetails.Rows.Count > 0) { dicChatperDetail = new System.Collections.Generic.Dictionary<string, string>(); for (int intRowIndex = 0; intRowIndex < dtListDetails.Rows.Count; intRowIndex++) { if (!dicChatperDetail.ContainsKey(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"]))) { dicChatperDetail.Add(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"]), Convert.ToString(dtListDetails.Rows[intRowIndex]["Title"])); sbChapterId.Append(Convert.ToString(dtListDetails.Rows[intRowIndex]["ID"])); sbChapterId.Append(";"); } } strCamlQuery = CreateCAMLQueryForSetOfCondtion(sbChapterId.ToString(), "Chapter_ID", "Number"); sbChapterId.Remove(0, sbChapterId.Length); sbChapterId.Append(strCamlQuery); sbChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></And></Where>"); sbChapterId.Insert(0, "<Where><And>"); sbChapterId.Insert(0, "<OrderBy><FieldRef Name='Page_Name' /></OrderBy>"); } if (dtListDetails != null) { dtListDetails.Dispose(); } return sbChapterId.ToString(); }
/// <summary> /// Added By Gopinath /// Date : 27/11/2010 /// Reason : PageOwner exists any of chapter list and pages print button should dispaly. /// </summary> /// <param name="BookID"></param> /// <returns></returns> protected bool CheckPageOwnerInBookList(string BookID) { DataView dvResultView = null; DataTable dtPageOwner = null; DataTable dtBookSummary = null; StringBuilder strChapterId = new StringBuilder(); DataRow drSummaryRow; string strCamlQuery = string.Empty; string strViewFields = string.Empty; string strCurrentUserName = string.Empty; bool blnCurrentPOExists = false; if (!string.IsNullOrEmpty(BookID)) { strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + BookID + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='ID'/>"; objCommonBLL = new CommonBLL(); DataTable dtresult = objCommonBLL.ReadList(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery); //Check for chapterIDs if (dtresult != null && dtresult.Rows.Count > 0) { objWellBookBLL = new WellBookBLL(); dtresult = objWellBookBLL.GetPagesForBook(strParentSiteURL, BookID, "No"); if (dtresult != null && dtresult.Rows.Count > 0) { dvResultView = dtresult.DefaultView; if (dvResultView != null && dvResultView.Count > 0) { dtPageOwner = dvResultView.ToTable(true, "Owner"); } } if (dtPageOwner != null && dtPageOwner.Rows.Count > 0) { strCurrentUserName = GetUserName(); foreach (DataRow drRow in dtPageOwner.Rows) { //if(drRow["Owner"].ToString() if (string.Compare(drRow["Owner"].ToString(), strCurrentUserName, true)==0) { blnCurrentPOExists = true; break; } } } } if (dtPageOwner != null) { dtPageOwner.Dispose(); } if (dtresult != null) { dtresult.Dispose(); } } return blnCurrentPOExists; }
/// <summary> /// Gets the camlQuery based on the report type /// </summary> /// <returns></returns> private string GetsCAMLQuery() { string strTerminated = string.Empty; string strCamlQuery = string.Empty; string strMasterID = string.Empty; if (!ActiveStatus) strTerminated = STATUS_TERMINATED; else strTerminated = STATUS_ACTIVE; switch (ListReportName) { case "Audit Trail": { strMasterID = HttpContext.Current.Request.QueryString["auditID"]; strCamlQuery = @"<OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy><Where><Eq><FieldRef Name='Master_ID' /><Value Type='Number'>" + strMasterID + "</Value></Eq></Where>"; break; } case MASTERPAGEREPORT: { strCamlQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } case CHAPTERPAGEMAPPINGREPORT: { strCamlQuery = GetCAMLQueryForWellBookPages(); if (strCamlQuery.Length == 0) { strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq></Where>"; } break; } case WELLBOOKPAGEVIEW: { strCamlQuery = GetCAMLQueryForWellBookSummaryPages(); if (strCamlQuery.Length == 0) { strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq></Where>"; } break; } case CHAPTERREPORT: { strCamlQuery = GetCAMLQueryForWellBookChapters(); if (strCamlQuery.Length == 0) { #region DREAM 4.0 - eWB2.0 - Deletion Module /// <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></And> is added. /// And condition added to the CAML query //strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq></Where>"; strCamlQuery = @"<Where><And><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq> <Or> <IsNull> <FieldRef Name='ToBeDeleted' /> </IsNull><Eq> <FieldRef Name='ToBeDeleted' /> <Value Type='Choice'>No</Value> </Eq> </Or> </And></Where>"; #endregion } break; } case CHAPTERPAGEREPORT: { strCamlQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq><Eq><FieldRef Name='Chapter_ID'/><Value Type='Number'>" + HttpContext.Current.Request.QueryString["ChapterID"] + "</Value></Eq></And></Where>"; break; } case TEMPLATEREPORT: { /// Title column in DWB Templates list is renamed to "Template_Name". the Internal name remains as "Title"; strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } case TEMPLATEPAGESREPORT: { strCamlQuery = GetCAMLQueryForTemplatePages(); break; } case USERREGISTRATION: { strCamlQuery = @"<OrderBy><FieldRef Name='DWBUserName' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } case TEAMREGISTRATION: { object objStoredPrivilege = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPrivileges.ToString()); if (objStoredPrivilege != null) { Privileges objPrivileges = (Privileges)objStoredPrivilege; if (objPrivileges != null) { if (objPrivileges.SystemPrivileges != null) { if (objPrivileges.SystemPrivileges.AdminPrivilege) { /// Get all the teams from "DWB Team" strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; } else if (objPrivileges.SystemPrivileges.BookOwner) { /// Get the teams where loggedin user is member objCommonBLL = new CommonBLL(); strCamlQuery = objCommonBLL.GetCAMLQueryForBOUsers(strSiteURL, "ID", "Counter", strTerminated,false); } } } } break; } case STAFFREGISTRATION: { strCamlQuery = @"<OrderBy><FieldRef Name='Discipline' /><FieldRef Name='User_Rank' /></OrderBy><Where><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING] + "</Value></Eq></Where>"; break; } case WELLBOOKREPORT: { strCamlQuery = string.Empty; object objStoredPrivilege = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPrivileges.ToString()); if (objStoredPrivilege != null) { Privileges objPrivileges = (Privileges)objStoredPrivilege; if (objPrivileges != null && objPrivileges.SystemPrivileges != null) { if (objPrivileges.SystemPrivileges.AdminPrivilege) { /// <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></And> is added. /// And condition added to the CAML query // strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + //strTerminated + "</Value></Eq></Where>"; #region DREAM 4.0 - eWB2.0 - Deletion Module strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq><Or><IsNull><FieldRef Name='ToBeDeleted' /></IsNull><Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></Or></And></Where>"; #endregion } else if (objPrivileges.SystemPrivileges.BookOwner) { /// Find the Team_IDs where user is member "DWB Team Staff" list /// and Get Only the Books where Team (DWB Books) == Team_Name(Title) in "DWB Team" list /// <TODO> /// Add the <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq> at proper location /// </TODO> objCommonBLL = new CommonBLL(); strCamlQuery = objCommonBLL.GetCAMLQueryForBOUsers(strSiteURL, "Team_ID", "Number", strTerminated,true); } else if (objPrivileges.SystemPrivileges.PageOwner || objPrivileges.SystemPrivileges.DWBUser) { if (objPrivileges.FocalPoint != null && !string.IsNullOrEmpty(objPrivileges.FocalPoint.BookIDs)) { objCommonUtility = new CommonUtility(); /// Get only the Books where "Owner" = logged in user //strCamlQuery = @" <Where> <And><Eq><FieldRef Name='Owner' /><Value Type='Lookup'>" + objCommonUtility.GetUserName() + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>"; #region DREAM 4.0 - eWB2.0 - Deletion Module /// <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></And> is added. /// Another And condition added to the CAML query strCamlQuery = @" <Where><And> <Eq><FieldRef Name='Owner' /><Value Type='Lookup'>" + objCommonUtility.GetUserName() + "</Value></Eq><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></And></Where>"; #endregion } } } } break; } case DWBHOME: { objCommonBLL = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>" + GetUserName() + "</Value></Eq></Where>"; DataTable dtListDetails = objCommonBLL.ReadList(strSiteURL, USERLIST, strCamlQuery); string strFavoriteBooksIds = string.Empty; if (dtListDetails.Rows.Count > 0) strFavoriteBooksIds = Convert.ToString(dtListDetails.Rows[0]["FavoriteBooks"]); ((HiddenField)FindControl("hdnUserFavorites")).Value = strFavoriteBooksIds; RadioButtonList rdblFavorites = (RadioButtonList)FindControl("rdoFavourites"); if (rdblFavorites != null) { if (rdblFavorites.SelectedIndex == 0) { /// Get all the Books /// strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Gt><FieldRef Name='NoOfActiveChapters' /><Value Type='Number'>0</Value></Gt></And></Where>"; #region DREAM 4.0 - eWB2.0 - Deletion Module strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></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><Gt><FieldRef Name='NoOfActiveChapters' /><Value Type='Number'>0</Value></Gt></And></Where>"; #endregion } else if (rdblFavorites.SelectedIndex == 1) { /// Get only Favourite Books string[] strBookIds = strFavoriteBooksIds.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); strCamlQuery = CreateCAMLQuery(strBookIds); } } if (dtListDetails != null) { dtListDetails.Dispose(); } break; } default: strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } return strCamlQuery; }
/// <summary> /// Gets the list of items based on the CAML query and the fields to view. /// </summary> /// <param name="strListName"></param> /// <param name="strCamlQuery"></param> /// <param name="strFieldsView"></param> /// <returns></returns> protected DataTable GetListItems(string listName, string camlQuery, string fieldsView) { DataTable dtListDetails; try { objCommonBLL = new CommonBLL(); dtListDetails = objCommonBLL.ReadList(strParentSiteURL, listName, camlQuery, fieldsView); } catch { throw; } return dtListDetails; }
/// <summary> /// Sets the book chapters attributes. /// </summary> /// <param name="dataRow">The data row.</param> /// <returns>ArrayList</returns> private ArrayList SetBookChaptersAttributes(DataRow dataRow) { ArrayList arlAttributes = null; try { arlAttributes = new ArrayList(); arlAttributes.Add(CreateAttribute("Seq", Convert.ToString(dataRow["Chapter_Sequence"]), "true")); arlAttributes.Add(CreateAttribute("Chapter Name", Convert.ToString(dataRow["Title"]), "true")); arlAttributes.Add(CreateAttribute("Asset Type", Convert.ToString(dataRow["Asset_Type"]), "true")); string strCAMLQuery = @"<Where><Eq><FieldRef Name='ID'/><Value Type='ID'>" + dataRow["Template_ID"].ToString() + "</Value></Eq></Where>"; string strViewFields = @"<FieldRef Name='ID'/><FieldRef Name='Title'/>"; objCommonBLL = new CommonBLL(); DataTable dtTemplate = objCommonBLL.ReadList(strSiteURL, TEMPLATELIST, strCAMLQuery, strViewFields); if (dtTemplate != null && dtTemplate.Rows.Count > 0) { arlAttributes.Add(CreateAttribute("Template", Convert.ToString(dtTemplate.Rows[0]["Title"]), "true")); } else { arlAttributes.Add(CreateAttribute("Template", string.Empty, "true")); } if (dtTemplate != null) { dtTemplate.Dispose(); } return arlAttributes; } catch { throw; } }
/// <summary> /// Gets the well book summary. /// </summary> /// <param name="BookID">The book ID.</param> /// <returns></returns> protected DataTable GetWellBookSummary(string BookID) { DataView dvResultView = null; DataTable dtPageOwner = null; int intTotal = 0; int intSignOff = 0; int intNotSignOff = 0; int intEmpty = 0; int intFooterTotal = 0; int intFooterSignOff = 0; int intFooterNotSignOff = 0; int intFooterEmpty = 0; string strValue = string.Empty; DataTable dtBookSummary = null; StringBuilder strChapterId = new StringBuilder(); DataRow drSummaryRow; string strCamlQuery = string.Empty; string strViewFields = string.Empty; if (!string.IsNullOrEmpty(BookID)) { strCamlQuery = @"<Where><Eq><FieldRef Name='Book_ID'/><Value Type='Counter'>" + BookID + "</Value></Eq></Where>"; strViewFields = @"<FieldRef Name='ID'/>"; objCommonBLL = new CommonBLL(); DataTable dtresult = objCommonBLL.ReadList(strParentSiteURL, DWBCHAPTERLIST, strCamlQuery); if (dtresult != null && dtresult.Rows.Count > 0) { intFooterEmpty = 0; intFooterNotSignOff = 0; intFooterSignOff = 0; intFooterTotal = 0; objWellBookBLL = new WellBookBLL(); dtresult = objWellBookBLL.GetPagesForBook(strParentSiteURL, BookID, "No"); if (dtresult != null && dtresult.Rows.Count > 0) { dvResultView = dtresult.DefaultView; if (dvResultView != null && dvResultView.Count > 0) { dtPageOwner = dvResultView.ToTable(true, "Owner"); } } if (dtPageOwner != null && dtPageOwner.Rows.Count > 0) { dtBookSummary = GetSummaryTable(); for (int intRowIndex = 0; intRowIndex < dtPageOwner.Rows.Count; intRowIndex++) { intTotal = 0; intSignOff = 0; intNotSignOff = 0; intEmpty = 0; dvResultView.RowFilter = "Owner ='" + Convert.ToString(dtPageOwner.Rows[intRowIndex]["Owner"]) + "'"; for (int intViewIndex = 0; intViewIndex < dvResultView.Count; intViewIndex++) { intTotal = intTotal + 1; strValue = Convert.ToString(dvResultView[intViewIndex][EMPTYCOLUMN]); if (strValue.Equals("Yes")) { intEmpty = intEmpty + 1; } strValue = Convert.ToString(dvResultView[intViewIndex]["Sign_Off_Status"]); if (strValue.Equals("Yes")) { intSignOff = intSignOff + 1; } else { intNotSignOff = intNotSignOff + 1; } } drSummaryRow = dtBookSummary.NewRow(); drSummaryRow["Page_Owner"] = Convert.ToString(dtPageOwner.Rows[intRowIndex]["Owner"]); drSummaryRow[TOTALCOLUMN] = intTotal; drSummaryRow["Signed_Off"] = intSignOff; drSummaryRow["NotSigned_Off"] = intNotSignOff; drSummaryRow[EMPTYCOLUMN] = intEmpty; dtBookSummary.Rows.Add(drSummaryRow); intFooterTotal = intFooterTotal + intTotal; intFooterSignOff = intFooterSignOff + intSignOff; intFooterNotSignOff = intFooterNotSignOff + intNotSignOff; intFooterEmpty = intFooterEmpty + intEmpty; } drSummaryRow = dtBookSummary.NewRow(); drSummaryRow["Page_Owner"] = TOTALCOLUMN; drSummaryRow[TOTALCOLUMN] = intFooterTotal; drSummaryRow["Signed_Off"] = intFooterSignOff; drSummaryRow["NotSigned_Off"] = intFooterNotSignOff; drSummaryRow[EMPTYCOLUMN] = intFooterEmpty; dtBookSummary.Rows.Add(drSummaryRow); } } if (dtPageOwner != null) { dtPageOwner.Dispose(); } if (dtresult != null) { dtresult.Dispose(); } } return dtBookSummary; }
/// <summary> /// Gets the list XML. /// </summary> /// <returns></returns> protected DataTable GetListXml() { string strCamlQuery = string.Empty; string strTerminated = string.Empty; DataTable dtListDetails = null; StringBuilder strRecordID = new StringBuilder(); try { if (!ActiveStatus) strTerminated = STATUS_TERMINATED; else strTerminated = STATUS_ACTIVE; strCamlQuery = @"<Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; strCamlQuery = GetsCAMLQuery(); objCommonBLL = new CommonBLL(); strSiteURL = SPContext.Current.Site.Url.ToString(); if (!string.IsNullOrEmpty(strCamlQuery)) { dtListDetails = objCommonBLL.ReadList(strSiteURL, ListName.ToString(), strCamlQuery); } if (dtListDetails != null && dtListDetails.Rows.Count > 0) { //dtHistoryDetails = objCommonBLL.ReadList(strSiteURL, AuditListName, // "<OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy>"); SetRecordsDataObject(dtListDetails); objListViewer = new ListViewerXMLGeneratorBLL(); xmlListDocument = objListViewer.CreateListViewerXML(objRecords); } } catch { throw; } finally { if (dtListDetails != null) { dtListDetails.Dispose(); } } return dtListDetails; }
/// <summary> /// Sets the book detail data object. /// </summary> private void LoadMetaData() { string strCamlQuery = string.Empty; string strPageOwner = string.Empty; string strPageDiscipline = string.Empty; string strBookOwner = string.Empty; string strBookTeamID = string.Empty; string strViewFields = string.Empty; DataTable dtBookPage = null; DataTable dtPublishedDocDetails = null; btnSignOff.Visible = false; btnUpdate.Visible = false; linkEPCatalogFilter.Visible = false; bool blnShowUpdate = false; lblModifiedDate.Visible = false; if (HttpContext.Current.Request.QueryString[MODEQUERYSTRING] != null) strMode = HttpContext.Current.Request.QueryString[MODEQUERYSTRING]; hidPageId.Value = PageID; try { objCommon = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + PageID + "</Value></Eq></Where>"; dtBookPage = objCommon.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery); if (dtBookPage.Rows.Count > 0) { lblOwner.Text = dtBookPage.Rows[0]["Owner"].ToString(); lblSignedOff.Text = dtBookPage.Rows[0]["Sign_Off_Status"].ToString(); lblTitleTemplate.Text = dtBookPage.Rows[0]["Page_Actual_Name"].ToString(); strPageDiscipline = dtBookPage.Rows[0]["Discipline"].ToString(); strPageOwner = dtBookPage.Rows[0]["Owner"].ToString(); string strAssetValue = objCommon.GetAssetValue(ChapterID); /// If $ is present in Page Title replace with Asset Value /// Else prefix with Asset Value. if (lblTitleTemplate.Text.IndexOf("$") == 0) { lblTitleTemplate.Text = lblTitleTemplate.Text.Replace("$", strAssetValue); } else { lblTitleTemplate.Text = string.Concat(strAssetValue, "-", lblTitleTemplate.Text); } } if (string.Compare(lblSignedOff.Text.ToLowerInvariant(), STATUSSIGNEDOFF) == 0) { blnShowUpdate = false; btnSignOff.Text = CANCELSIGNOFF; } else { blnShowUpdate = true; btnSignOff.Text = SIGNOFF; } strCamlQuery = @"<Where><Eq><FieldRef Name='PageID' /><Value Type='Number'>" + PageID + "</Value></Eq></Where>"; string strObjectInnerHtml = objCommon.GetUploadedDocumentUrl(strParentSiteURL, PUBLISHEDDOCUMENTLIST, strCamlQuery); ///loads the embedded image/document/application docviewerdiv.InnerHtml = strObjectInnerHtml; //Added by Praveena for module "Add Last Updated date" strViewFields = @"<FieldRef Name='PageID' /><FieldRef Name='Modified' />"; dtPublishedDocDetails = objCommon.ReadList(strParentSiteURL, PUBLISHEDDOCUMENTLIST, strCamlQuery, strViewFields); if (dtPublishedDocDetails != null && dtPublishedDocDetails.Rows.Count > 0) { string dtModifiedDate = GetDateTime(dtPublishedDocDetails.Rows[0]["Modified"].ToString()); lblModifiedDate.Visible = true; lblModifiedDate.Text = "Last Updated Date:" + dtModifiedDate; } /// EPCatalog Issue Fix BookInfo objBookInfo = null; if (HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT] != null) { string strAssetType = string.Empty; objBookInfo = ((BookInfo)HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT]); if (objBookInfo != null) { strBookOwner = objBookInfo.BookOwner; strBookTeamID = objBookInfo.BookTeamID; foreach (ChapterInfo objChapterInfo in objBookInfo.Chapters) { if (string.Equals(objChapterInfo.ChapterID, ChapterID)) { hidSelectedRows.Value = objChapterInfo.ActualAssetValue; /// To send as query string to EPCatalog screen hidAssetType.Value = objChapterInfo.AssetType; if (string.Equals(objChapterInfo.AssetType, ASSETTYPEWELL)) hidSelectedCriteriaName.Value =UWI; else if (string.Equals(objChapterInfo.AssetType, ASSETTYPEFIELD)) hidSelectedCriteriaName.Value = FIELDNAME; else hidSelectedCriteriaName.Value = UWBI; } } } } if (ShowButton(WELLBOOKVIEWERCONTROLPAGE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline)) { btnSignOff.Visible = true; } if (ShowButton(WELLBOOKVIEWERCONTROLPAGEUPDATE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline)) { if (blnShowUpdate) { btnUpdate.Visible = true; linkEPCatalogFilter.Visible = true; } } if (!string.IsNullOrEmpty(strMode) && strMode.Equals(VIEW)) { btnUpdate.Visible = false; btnSignOff.Visible = false; linkEPCatalogFilter.Visible = false; } } catch { throw; } finally { if (dtBookPage != null) dtBookPage.Dispose(); } }
/// <summary> /// This method retrieves the List Items to be rendered on the page /// The CAML is formed based on the CustomListType value /// </summary> /// <returns>DataTable</returns> protected DataTable GetRecords() { string strTerminated = string.Empty; DataTable dtListDetails = null; if (!ActiveStatus) strTerminated = STATUS_TERMINATED; else strTerminated = STATUS_ACTIVE; string strCamlQuery = @"<Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; strCamlQuery = GetsCAMLQuery(); objCommonBLL = new CommonBLL(); if (!string.IsNullOrEmpty(strCamlQuery)) { dtListDetails = objCommonBLL.ReadList(strSiteURL, ListName.ToString(), strCamlQuery); } if (string.Compare(ListReportName, CHAPTERPAGEMAPPINGREPORT, true) == 0 || string.Compare(ListReportName, WELLBOOKPAGEVIEW, true) == 0) { dtListDetails.Columns.Add(CHAPTERTITLE_COLUMNNAME); for (int rowIndex = 0; rowIndex < dtListDetails.Rows.Count; rowIndex++) { string strChapterTitle = string.Empty; if (dicChatperDetail != null) { dicChatperDetail.TryGetValue(Convert.ToString(dtListDetails.Rows[rowIndex]["Chapter_ID"]), out strChapterTitle); } dtListDetails.Rows[rowIndex][CHAPTERTITLE_COLUMNNAME] = strChapterTitle; } dtListDetails.DefaultView.Sort = string.Format(DATATABLE_SORTEXP, CHAPTERTITLE_COLUMNNAME, SORTDIR_ASC); dtListDetails = dtListDetails.DefaultView.ToTable(); } return dtListDetails; }
/// <summary> /// Sets the book detail data object. /// </summary> private void LoadMetaData() { string strCamlQuery = string.Empty; string strViewFields = string.Empty; string strBookOwner = string.Empty; string strBookTeamID = string.Empty; string strPageOwner = string.Empty; string strPageDiscipline = string.Empty; DataTable dtBookPage = null; DataTable dtUserDefinedDocDetails=null; btnSignOff.Visible = false; btnUpdate.Visible = false; bool blnShowUpdate = false; lblModifiedDate.Visible = false; if (HttpContext.Current.Request.QueryString[MODEQUERYSTRING] != null) strMode = HttpContext.Current.Request.QueryString[MODEQUERYSTRING]; hidPageId.Value = PageID; if (HttpContext.Current.Session[SESSIONTYPE3UPLOADED] != null) hidtype3uploaded.Value = HttpContext.Current.Session[SESSIONTYPE3UPLOADED].ToString().ToLowerInvariant(); objCommon = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Number'>" + PageID + "</Value></Eq></Where>"; dtBookPage = objCommon.ReadList(strParentSiteURL, CHAPTERPAGESMAPPINGLIST, strCamlQuery); if (dtBookPage.Rows.Count > 0) { lblOwner.Text = dtBookPage.Rows[0]["Owner"].ToString(); lblSignedOff.Text = dtBookPage.Rows[0]["Sign_Off_Status"].ToString(); lblTitleTemplate.Text = dtBookPage.Rows[0]["Page_Actual_Name"].ToString(); /// CHAPTERIDQUERYSTRING is not applicable. Get ChapterID from session object. string strAssetValue = objCommon.GetAssetValue(ChapterID); /// If $ is present in Page Title replace with Asset Value /// Else prefix with Asset Value. if (lblTitleTemplate.Text.IndexOf("$") == 0) { lblTitleTemplate.Text = lblTitleTemplate.Text.Replace("$", strAssetValue); } else { lblTitleTemplate.Text = string.Concat(strAssetValue, "-", lblTitleTemplate.Text); } strPageDiscipline = dtBookPage.Rows[0]["Discipline"].ToString(); strPageOwner = dtBookPage.Rows[0]["Owner"].ToString(); } if (string.Compare(lblSignedOff.Text.ToLowerInvariant(),STATUSSIGNEDOFF) == 0) { blnShowUpdate = false; btnSignOff.Value = CANCELSIGNOFF; } else { blnShowUpdate = true; btnSignOff.Value = SIGNOFF; } strCamlQuery = @"<Where><Eq><FieldRef Name='PageID' /><Value Type='Number'>" + PageID + "</Value></Eq></Where>"; string strObjectInnerHtml = objCommon.GetUploadedDocumentUrl(strParentSiteURL, USERDEFINEDDOCUMENTLIST, strCamlQuery); /// Loads the embedded image/document/application docviewerdiv.InnerHtml = strObjectInnerHtml; //Added by Praveena for module "Add Last Updated date" strViewFields = @"<FieldRef Name='PageID' /><FieldRef Name='Modified' />"; dtUserDefinedDocDetails = objCommon.ReadList(strParentSiteURL, USERDEFINEDDOCUMENTLIST, strCamlQuery,strViewFields); if (dtUserDefinedDocDetails != null && dtUserDefinedDocDetails.Rows.Count > 0) { string dtModifiedDate = GetDateTime(dtUserDefinedDocDetails.Rows[0]["Modified"].ToString()); lblModifiedDate.Visible = true; lblModifiedDate.Text = "Last Updated Date:" + dtModifiedDate; } if (HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT] != null) { BookInfo objBookInfo = ((BookInfo)HttpContext.Current.Session[SESSIONTREEVIEWDATAOBJECT]); if (objBookInfo != null) { strBookOwner = objBookInfo.BookOwner; strBookTeamID = objBookInfo.BookTeamID; } } if (ShowButton(WELLBOOKVIEWERCONTROLPAGE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline)) { btnSignOff.Visible = true; } if (ShowButton(WELLBOOKVIEWERCONTROLPAGEUPDATE, strBookOwner, strBookTeamID, strPageOwner, strPageDiscipline)) { if (blnShowUpdate) { btnUpdate.Visible = true; } } if (!string.IsNullOrEmpty(strMode) && strMode.Equals(VIEW)) { btnUpdate.Visible = false; btnSignOff.Visible = false; } if (dtBookPage != null) { dtBookPage.Dispose(); } }