コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
        /// <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();
                }
            }
        }
コード例 #3
0
        /// <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();
                }
            }
        }