protected void Page_Load(object sender, EventArgs e) { string strRequestID = string.Empty; string filepath = string.Empty; string strCAMLQuery = string.Empty; string strLibraryName = string.Empty; CommonBLL objCommon = new CommonBLL(); WindowsImpersonationContext ctx = WindowsIdentity.Impersonate(IntPtr.Zero); try { if (!string.IsNullOrEmpty(Page.Request.QueryString["requestID"])) strRequestID = Page.Request.QueryString["requestID"].ToString(); if (!string.IsNullOrEmpty(Page.Request.QueryString["mode"])) { if (string.Equals(Page.Request.QueryString["mode"], "chapter")) strLibraryName = "DWB Chapter Print Details"; else if (string.Equals(Page.Request.QueryString["mode"], "book")) strLibraryName = "DWB Book Print details Library"; else strLibraryName = "DWB Page Print details"; } strCAMLQuery = @"<Where><Eq><FieldRef Name='RequestID' /><Value Type='Text'>" + strRequestID + "</Value></Eq></Where>"; filepath = @objCommon.GetRequestID(SPContext.Current.Site.Url, strLibraryName, strCAMLQuery); FileInfo fInfo = new FileInfo(filepath); if (fInfo.Exists) { HttpContext.Current.Response.ClearHeaders(); HttpContext.Current.Response.ClearContent(); HttpContext.Current.Response.ContentType = "application/pdf"; HttpContext.Current.Response.AppendHeader("Content-Disposition:", " attachment; filename=" + fInfo.Name); HttpContext.Current.Response.AppendHeader("Content-Length", Convert.ToString(fInfo.Length)); HttpContext.Current.Response.Charset = "UTF-8"; HttpContext.Current.Response.TransmitFile(fInfo.FullName); HttpContext.Current.Response.Flush(); HttpContext.Current.Response.Close(); } } finally { ctx.Undo(); } }
/// <summary> /// Changes the Sign of status and the Chapter Page mapping list. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="signOffStatus">The sign off status.</param> /// <param name="listName">Name of the list.</param> /// <param name="username">The username.</param> /// <param name="bookId">The book id.</param> /// <param name="actionPerformed">The action performed.</param> public void ChangeSignOffStatus(string siteURL, string signOffStatus, string listName, string username, string bookId, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objCommonDAL = new CommonDAL(); objCommonBLL = new CommonBLL(); StringBuilder strChapterPageId = new StringBuilder(); Dictionary<string, string> listItemCollection = new Dictionary<string, string>(); listItemCollection.Add("Sign_Off_Status", signOffStatus); string strCAMLQuery = "<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + bookId + "</Value></Eq></Where>"; WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection); int intBookId = 0; if (!string.IsNullOrEmpty(bookId)) { intBookId = int.Parse(bookId); } objCommonDAL.UpdateListAuditHistory(siteURL, DWBWELLBOOKAUDITLIST, intBookId, username, actionPerformed); #region Code Commented as per confirmation of UAT Feedback /// Update Signoff Status for all pages in Book //dtResult = GetPagesForBook(siteURL, bookId, "No"); //if (dtResult != null && dtResult.Rows.Count > 0) //{ // for (int intRowIndex = 0; intRowIndex < dtResult.Rows.Count; intRowIndex++) // { // strChapterPageId.Append(Convert.ToString(dtResult.Rows[intRowIndex][IDCOLUMN])); // strChapterPageId.Append(";"); // } // strCAMLQuery = objCommonBLL.CreateCamlQueryWithoutWhere(strChapterPageId.ToString(), IDCOLUMN, IDCOLUMNTYPE); // listItemCollection.Clear(); // listItemCollection.Add("Sign_Off_Status", signOffStatus); // WellBookDAL.UpdateListItemCollectionValues(siteURL, chapterpageList, strCAMLQuery, listItemCollection); //} //if (dtResult != null) //{ // dtResult.Dispose(); //} #endregion Code Commented as per UAT Feedback }
protected void TransformAuditListDetail() { XmlTextReader xmlTextReader = null; XslTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; string strSortBy = string.Empty; string strSortType = string.Empty; try { objCommonBLL = new CommonBLL(); xmlTextReader = objCommonBLL.GetXSLTemplate("List Viewer", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); /// Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); /// <!-- Set the number of records per page--> /// <xsl:param name="recordsPerPage" select="0" /> if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { objCommonUtility = new CommonUtility(); string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.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> /// 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> /// 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> /// 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> /// 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> /// 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> /// To Get TypeIII Pages for selected Book /// Added By: Praveena /// Date:16/09/2010 /// Reason: For module Add additional attributes to change page owner table /// </summary> /// <param name="siteURL"></param> /// <param name="bookId"></param> /// <param name="terminated"></param> /// <returns></returns> public DataTable GetTypeIIIPagesForBook(string siteURL, string bookId, string terminated) { DataTable dtResult = null; objCommonDAL = new CommonDAL(); objCommonBLL = new CommonBLL(); StringBuilder strChapterId = new StringBuilder(); string strCamlQuery = @"<Where><And><Eq><FieldRef Name='Book_ID' /> <Value Type='Number'> " + bookId + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + terminated + "</Value></Eq></And></Where>"; dtResult = objCommonDAL.ReadList(siteURL, DWBCHAPTERLIST, strCamlQuery); if (dtResult != null && dtResult.Rows.Count > 0) { for (int intRowIndex = 0; intRowIndex < dtResult.Rows.Count; intRowIndex++) { strChapterId.Append(Convert.ToString(dtResult.Rows[intRowIndex][IDCOLUMN])); strChapterId.Append(";"); } strCamlQuery = objCommonBLL.CreateCamlQueryWithoutWhere(strChapterId.ToString(), "Chapter_ID", "Number"); strChapterId.Remove(0, strChapterId.Length); strChapterId.Append(strCamlQuery); strChapterId.Append("<Eq><FieldRef Name='Connection_Type' /><Value Type='Text'>3 - User Defined Document</Value></Eq></And>"); strChapterId.Append("<Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + terminated + "</Value></Eq></And></Where>"); strChapterId.Insert(0, "<Where><And><And>"); dtResult = objCommonDAL.ReadList(siteURL, CHAPTERPAGESMAPPINGLIST, strChapterId.ToString()); } return dtResult; }
/// <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> /// 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> /// Generates the DWB book XML. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="rowId">The row id.</param> /// <param name="action">The action.</param> /// <param name="bookSelected">if set to <c>true</c> [book selected].</param> /// <param name="includeTOC">if set to <c>true</c> [include TOC].</param> /// <param name="includeStoryBoard">if set to <c>true</c> [include story board].</param> /// <returns></returns> public System.Xml.XmlDocument GenerateDWBBookXML(string siteURL, int rowId, string action, bool bookSelected, PrintOptions objPrintOptions) { BookInfo objBookInfo = null; System.Xml.XmlDocument xmlWellBookDetails = null; if (rowId > 0) { objBookInfo = SetBookDetailDataObject(siteURL, rowId.ToString(), action, bookSelected, objPrintOptions); objCommonBLL = new CommonBLL(); xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } return xmlWellBookDetails; }
/// <summary> /// Transforms the list detail DWB home. /// </summary> /// <param name="noOfRecords">The no of records.</param> protected void TransformListDetailDWBHome(int noOfRecords) { XmlTextReader xmlTextReader = null; XslCompiledTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; /// For Paging and Sorting int intrecordsPerPage = 0; int intPageNumber = 0; int intMaxPages = 5; int intCurrentPage = 1; string strSortBy = string.Empty; string strSortType = string.Empty; object objSessionUserPreference = null; Shell.SharePoint.DREAM.Business.Entities.UserPreferences objPreferences = null; try { objCommonBLL = new CommonBLL(); xmlTextReader = objCommonBLL.GetXSLTemplate("List Viewer DWBHome", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslCompiledTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); /// Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); xsltArgsList.AddParam("listType", string.Empty, ListReportName); /// Parameters for Paging/Sorting xsltArgsList.AddParam("activeStatus", string.Empty, ActiveStatus.ToString().ToLower()); /// <!-- Set the number of records per page--> /// <xsl:param name="recordsPerPage" select="0" /> objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString()); if (objSessionUserPreference != null) { objPreferences = (Shell.SharePoint.DREAM.Business.Entities.UserPreferences)objSessionUserPreference; intrecordsPerPage = Convert.ToInt32(objPreferences.RecordsPerPage); } xsltArgsList.AddParam("recordsPerPage", string.Empty, intrecordsPerPage); /// <!-- Page Number field --> /// <xsl:param name="pageNumber" select="1" /> if (HttpContext.Current.Request.QueryString["pageNumber"] != null) { intPageNumber = Int32.Parse(HttpContext.Current.Request.QueryString["pageNumber"]); if (blnInitializePageNumber) intPageNumber = 0; } if (HttpContext.Current.Request.QueryString["sortBy"] != null) { strSortBy = HttpContext.Current.Request.QueryString["sortBy"]; } if (HttpContext.Current.Request.QueryString["sortType"] != null) { strSortType = HttpContext.Current.Request.QueryString["sortType"]; } else { strSortType = "descending"; } if (intPageNumber > (noOfRecords / intrecordsPerPage)) { intPageNumber--; } xsltArgsList.AddParam("pageNumber", string.Empty, intPageNumber); xsltArgsList.AddParam("recordCount", string.Empty, noOfRecords); intMaxPages = 5; xsltArgsList.AddParam("MaxPages", string.Empty, intMaxPages); intCurrentPage = intPageNumber; xsltArgsList.AddParam("CurrentPage", string.Empty, intPageNumber); if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { objCommonUtility = new CommonUtility(); string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } xsltArgsList.AddParam("sortBy", string.Empty, strSortBy); xsltArgsList.AddParam("sortType", string.Empty, strSortType); XmlNode xmlNode = xmlListDocument.SelectSingleNode("records/record/recordInfo/attribute[@name='" + strSortBy + "']"); if (xmlNode != null) { xsltArgsList.AddParam("sortDataType", string.Empty, xmlNode.Attributes["datatype"].Value); } xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.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> /// 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> /// 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> /// 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> /// 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> /// Handles the Click event of the btnPrint control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void btnPrint_Click(object sender, EventArgs e) { string strAlertMessage = string.Empty; try { int intPrintedDocID = 0; string[] strPrintedDocURL = null; CommonBLL objCommonBLL = null; string strCamlQuery = string.Empty; PrintOptions objPrintOptions = new PrintOptions(); //Set PrintOptions object properties through hidden fields objPrintOptions = SetPrintOptionsProperties(objPrintOptions); intPrintedDocID = Print(objPrintOptions, WELLBOOKVIEWERCONTROLBOOK, HttpContext.Current.Request.QueryString[MODEQUERYSTRING]); /// Open the generated document to show in IE if (intPrintedDocID > 0) { objCommonBLL = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + intPrintedDocID.ToString() + "</Value></Eq></Where>"; strPrintedDocURL = objCommonBLL.GetPrintedDocumentUrl(strParentSiteURL, PRINTEDDOCUMNETLIBRARY, strCamlQuery); strAlertMessage = objCommonBLL.GetAlertMessage(strParentSiteURL, "Book"); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentprinted", "alert('" + strAlertMessage + "');", true); } else if (intPrintedDocID == -1) { this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "NoDocumentsFound", @"<Script language='javaScript'>alert('Please change the filter criteria');</Script>"); } else { this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE); this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "documentnotprinted", ALERTDOCUMENTNOTPRINTED, true); } } catch (System.Web.Services.Protocols.SoapException soapEx) { CommonUtility.HandleException(strParentSiteURL, soapEx, 1); lblException.Text = ALERTDOCUMENTNOTPRINTED; lblException.Visible = true; ExceptionBlock.Visible = true; PdfBLL objPdfBLL = new PdfBLL(); objPdfBLL.PrintLog(strParentSiteURL, soapEx.StackTrace, soapEx.Message, "WellBookSummary.btnPrint_Click"); } catch (WebException webEx) { CommonUtility.HandleException(strParentSiteURL, webEx, 1); lblException.Text = ALERTDOCUMENTNOTPRINTED; lblException.Visible = true; ExceptionBlock.Visible = true; PdfBLL objPdfBLL = new PdfBLL(); objPdfBLL.PrintLog(strParentSiteURL, webEx.StackTrace, webEx.Message, "WellBookSummary.btnPrint_Click"); } catch (Exception ex) { CommonUtility.HandleException(strParentSiteURL, ex, 1); lblException.Text = ALERTDOCUMENTNOTPRINTED; lblException.Visible = true; ExceptionBlock.Visible = true; PdfBLL objPdfBLL = new PdfBLL(); objPdfBLL.PrintLog(strParentSiteURL, ex.StackTrace, ex.Message, "WellBookSummary.btnPrint_Click"); } finally { this.Page.ClientScript.RegisterStartupScript(this.GetType(), HIDETABJSKEY, HIDETABJSPAGE); } }
protected void DeleteListItem(int itemID,string reportName, string listName, string auditListName) { objCommonBLL = new CommonBLL(); switch (reportName) { case WELLBOOKREPORT: case CHAPTERREPORT: { objCommonBLL.MarkItemToDelete(strSiteURL, listName, itemID); break; } case CHAPTERPAGEREPORT: { objCommonBLL.DeleteChapterPages(strSiteURL, itemID, string.Empty, listName, auditListName); break; } case TEMPLATEREPORT: { objCommonBLL.DeleteTemplate(strSiteURL, itemID, listName, auditListName); break; } case TEMPLATEPAGESREPORT: case MASTERPAGEREPORT: { objCommonBLL.DeleteListItemById(strSiteURL,itemID,listName,auditListName); break; } case USERREGISTRATION: { objCommonBLL.DeleteUser(strSiteURL,itemID,listName); break; } case TEAMREGISTRATION: { objCommonBLL.DeleteTeam(strSiteURL, itemID, listName, TEAMSTAFFLIST); break; } } }
/// <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> /// 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> /// Creates the chapter list XML incase of the preference xml /// for the logged in user and selected book is not available in Doc Lib. /// </summary> /// <param name="wellBookDetails">The well book details.</param> /// <returns></returns> private XmlDocument CreateChapterListXml(XmlDocument wellBookDetails) { XmlDocument chapterListXml = new XmlDocument(); CommonBLL objCommonBLL = new CommonBLL(); if (wellBookDetails != null) { XmlNodeList xmlChapterNodes = wellBookDetails.SelectNodes("/BookInfo/Chapter"); ChapterInfo objChapterInfo; BookInfo objBookInfo = new BookInfo(); objBookInfo.BookName = wellBookDetails.SelectSingleNode("/BookInfo").Attributes["BookName"].Value; objBookInfo.BookID = wellBookDetails.SelectSingleNode("/BookInfo").Attributes["BookID"].Value; System.Collections.ArrayList arlChapters = new System.Collections.ArrayList(); foreach (XmlNode xmlChapterNode in xmlChapterNodes) { objChapterInfo = new ChapterInfo(); objChapterInfo.ChapterTitle = xmlChapterNode.Attributes["ChapterTitle"].Value; objChapterInfo.ChapterID = xmlChapterNode.Attributes["ChapterID"].Value; objChapterInfo.Display = true; arlChapters.Add(objChapterInfo); } objBookInfo.Chapters = arlChapters; chapterListXml = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } return chapterListXml; }
/// <summary> /// Terminates the list element. /// </summary> /// <param name="strListName">Name of the STR list.</param> /// <param name="rowId">The row id.</param> /// <param name="strAuditListName">Name of the STR audit list.</param> protected void TerminateListElement(string listName, int rowId, string auditListName) { objCommonBLL = new CommonBLL(); string strSequenceField = string.Empty; if (string.Equals(ListName, CHAPTERLIST)) { strSequenceField = "Chapter_Sequence"; } else { strSequenceField = "Page_Sequence"; } if (string.Equals(ListName, CHAPTERLIST)) { objCommonBLL.UpdateListItemStatus(strSiteURL, ListName, rowId, AuditListName, AUDIT_ACTION_TERMINATE, STATUS_TERMINATED, strSequenceField); objCommonBLL.ListItemStatusUpdateForChapterPages(strSiteURL, CHAPTERPAGEMAPPINGLIST, rowId, STATUS_TERMINATED); } else if (string.Equals(ListName, MASTERPAGELIST) || string.Equals(ListName, CHAPTERPAGEMAPPINGLIST)) { objCommonBLL.UpdateListItemStatus(strSiteURL, ListName, rowId, AuditListName, AUDIT_ACTION_TERMINATE, STATUS_TERMINATED, strSequenceField); } else if (string.Equals(ListName, WELLBOOKLIST) || string.Equals(ListName, TEMPLATELIST)) { objCommonBLL.TerminateListValues(strSiteURL, listName, rowId, auditListName, false, true); } else if (string.Equals(ListName, USERLIST) || string.Equals(ListName, TEAMLIST) || string.Equals(ListName, TEAMSTAFFLIST)) { objCommonBLL.TerminateListValues(strSiteURL, listName, rowId, auditListName, false, false); } else { objCommonBLL.TerminateListValues(strSiteURL, listName, rowId, auditListName, true, true); } }
/// <summary> /// Gets the well book detail XML. /// </summary> /// <param name="action">The action.</param> /// <returns></returns> private XmlDocument GetWellBookDetailXML(string action) { XmlDocument xmlWellBookDetails = null; string strBookID = string.Empty; string strChapterID = string.Empty; if (HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID] != null) { strBookID = HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID]; } if (strBookID.Length > 0) { WellBookBLL objWellBookBLL = new WellBookBLL(); PrintOptions objPrintOptions = new PrintOptions(); objPrintOptions.IncludeBookTitle = false; objPrintOptions.IncludePageTitle = false; objPrintOptions.IncludeStoryBoard = false; BookInfo objBookInfo = objWellBookBLL.SetBookDetailDataObject(strParentSiteURL, strBookID, action, true, objPrintOptions); CommonBLL objCommonBLL = new CommonBLL(); HttpContext.Current.Session[SESSION_TREEVIEWDATAOBJECT] = objBookInfo; if (HttpContext.Current.Request.QueryString[QUERYSTRING_IDVALUE] != null) { strChapterID = HttpContext.Current.Request.QueryString[QUERYSTRING_IDVALUE]; } if (HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID] != null) { strChapterID = HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID]; } xmlWellBookDetails = objCommonBLL.CreateWellBookDetailXML(objBookInfo); } return xmlWellBookDetails; }
/// <summary> /// Transforms the list detail. /// </summary> /// <param name="listType">Type of the list.</param> /// <param name="noOfRecords">The no of records.</param> protected void TransformListDetail(int noOfRecords) { XmlTextReader xmlTextReader = null; XslTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; int intrecordsPerPage = 0; int intPageNumber = 0; int intMaxPages = 5; int intCurrentPage = 1; string strSortBy = string.Empty; string strSortType = string.Empty; object objSessionUserPreference = null; Shell.SharePoint.DREAM.Business.Entities.UserPreferences objPreferences = null; try { objCommonBLL = new CommonBLL(); xmlTextReader = objCommonBLL.GetXSLTemplate("List Viewer", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); /// Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); xsltArgsList.AddParam("historyColumn", string.Empty, IsExpandCollapseApplicable.ToString()); xsltArgsList.AddParam("editColumn", string.Empty, IsEditApplicable.ToString()); if (ActiveStatus) { xsltArgsList.AddParam("listItemAction", string.Empty, STATUSTERMINATE); } else { xsltArgsList.AddParam("listItemAction", string.Empty, STATUSACTIVATE); } xsltArgsList.AddParam("addMasterLinkColumn", string.Empty, IsAddMasterApplicable.ToString()); xsltArgsList.AddParam("viewMasterLinkColumn", string.Empty, IsViewMasterApplicable.ToString()); xsltArgsList.AddParam("listType", string.Empty, ListReportName); xsltArgsList.AddParam("activeStatus", string.Empty, ActiveStatus.ToString().ToLower()); /// <!-- Set the number of records per page--> /// <xsl:param name="recordsPerPage" select="0" /> objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString()); if (objSessionUserPreference != null) { objPreferences = (Shell.SharePoint.DREAM.Business.Entities.UserPreferences)objSessionUserPreference; intrecordsPerPage = Convert.ToInt32(objPreferences.RecordsPerPage); } xsltArgsList.AddParam("recordsPerPage", string.Empty, intrecordsPerPage); xsltArgsList.AddParam("AuditListName", string.Empty, AuditListName); if (!(string.Compare(ListReportName, WELLBOOKPAGEVIEW, true) == 0)) { /// <!-- Page Number field --> /// <xsl:param name="pageNumber" select="1" /> if (HttpContext.Current.Request.QueryString["pageNumber"] != null) { intPageNumber = Int32.Parse(HttpContext.Current.Request.QueryString["pageNumber"]); if (blnInitializePageNumber) intPageNumber = 0; } if (HttpContext.Current.Request.QueryString["sortBy"] != null) { strSortBy = HttpContext.Current.Request.QueryString["sortBy"]; } if (HttpContext.Current.Request.QueryString["sortType"] != null) { strSortType = HttpContext.Current.Request.QueryString["sortType"]; } else { strSortType = "descending"; } } else { intPageNumber = string.IsNullOrEmpty(pageNumber) ? 0 : Convert.ToInt32(pageNumber); sortType = string.Equals(sortType, "ASC") ? "ascending" : "descending"; xsltArgsList.AddParam("sortBy", string.Empty, sortBy); xsltArgsList.AddParam("sortType", string.Empty, sortType); if (!(string.IsNullOrEmpty(sortBy)) && !(string.IsNullOrEmpty(sortBy))) { strSortBy = sortBy; } } int intNoofPages = 0; if (intrecordsPerPage > 0) { intNoofPages = noOfRecords / intrecordsPerPage; } if (intPageNumber > intNoofPages) { intPageNumber--; } xsltArgsList.AddParam("pageNumber", string.Empty, intPageNumber); xsltArgsList.AddParam("recordCount", string.Empty, noOfRecords); intMaxPages = 5; xsltArgsList.AddParam("MaxPages", string.Empty, intMaxPages); intCurrentPage = intPageNumber; xsltArgsList.AddParam("CurrentPage", string.Empty, intPageNumber); if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { objCommonUtility = new CommonUtility(); string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } if (!(string.Compare(ListReportName, WELLBOOKPAGEVIEW, true) == 0)) { xsltArgsList.AddParam("sortBy", string.Empty, strSortBy); xsltArgsList.AddParam("sortType", string.Empty, strSortType); } XmlNode xmlNode = xmlListDocument.SelectSingleNode("records/record/recordInfo/attribute[@name='" + strSortBy + "']"); if (xmlNode != null) { xsltArgsList.AddParam("sortDataType", string.Empty, xmlNode.Attributes["datatype"].Value); } #region DREAM 4.0 - eWB 2.0 - AJAX Implemenation // xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); StringBuilder builder = new StringBuilder(); StringWriter stringWriter = new StringWriter(builder); xslTransform.Transform(objXPathDocument, xsltArgsList, stringWriter); strResultTable = stringWriter.GetStringBuilder(); #endregion } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.Dispose(); } } }
/// <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(); } }