コード例 #1
0
 /// <summary>
 /// Method to get the Asset Owners from DREAM webservice
 /// </summary>
 /// <returns></returns>
 public XmlDocument GetAssetOwnersFromService()
 {
     ServiceProvider objFactory = new ServiceProvider();
     XmlDocument responseXmlDoc;
     AbstractController objAbstractController;
     RequestInfo objRequestInfo = this.SetRequestInfoToAssetOwner();
     objAbstractController = objFactory.GetServiceManager(REPORTSERVICE);
     responseXmlDoc = objAbstractController.GetSearchResults(objRequestInfo, -1, SEARCHNAMEASSETOWNER, string.Empty, 0);
     return responseXmlDoc;
 }
コード例 #2
0
ファイル: ExportToExcelAll.cs プロジェクト: vijaymca/Dotnet
 ///// <summary>
 ///// Create required controls for webpart
 ///// </summary>
 protected override void CreateChildControls()
 {
     strCurrSiteUrl = HttpContext.Current.Request.Url.ToString();
     objFactory = new ServiceProvider();
     objReportController = objFactory.GetServiceManager(REPORTSERVICE);
     base.CreateChildControls();
     lblMessage = new Label();
     lblMessage.Text = string.Empty;
     lblMessage.Visible = false;
     this.Controls.Add(lblMessage);
 }
コード例 #3
0
ファイル: UserValidation.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Determines whether [is site under maintenance].
        /// </summary>
        /// <returns>
        /// 	<c>true</c> if [is site under maintenance]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsSiteUnderMaintenance()
        {
            bool blnIsSiteUnderMaintenance = true;
            string strParentSiteURL = string.Empty;
            string strUserID = string.Empty;
            AbstractController objController = null;
            ServiceProvider objFactory = null;
            string strIsSiteUnderMaintenace = string.Empty;

            try
            {

                objFactory = new ServiceProvider();
                objController = objFactory.GetServiceManager("MOSSService");
                strUserID = HttpContext.Current.User.Identity.Name.ToString();
                strParentSiteURL = SPContext.Current.Site.Url.ToString();
                //if the logged in user is a local system Admin, then no need to check in AD.
                if (!((MOSSServiceManager)objController).IsAdmin(strParentSiteURL, strUserID))
                {
                    strIsSiteUnderMaintenace = PortalConfiguration.GetInstance().GetKey("SiteMaintenance");//.ToString().ToLowerInvariant();

                    if (!string.IsNullOrEmpty(strIsSiteUnderMaintenace))
                    {
                        if (strIsSiteUnderMaintenace.ToLowerInvariant().Equals("no"))
                        {
                            blnIsSiteUnderMaintenance = false;
                        }
                        else if (strIsSiteUnderMaintenace.ToLowerInvariant().Equals("yes"))
                        {
                            blnIsSiteUnderMaintenance = true;
                        }
                    }
                }
                else
                {
                    blnIsSiteUnderMaintenance = false;
                }

            }
            catch (Exception)
            {
                throw;
            }
            return blnIsSiteUnderMaintenance;
        }
コード例 #4
0
ファイル: TopNavigation.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Initializes the user preference.
 /// </summary>
 protected void InitializeUserPreference()
 {
     CommonUtility objCommonUtility = new CommonUtility();
     AbstractController objMossController = null;
     ServiceProvider objFactory = new ServiceProvider();
     string strCurrSiteUrl = SPContext.Current.Site.Url.ToString();
     try
     {
         objUserPreferences = new UserPreferences();
         string strUserId = objCommonUtility.GetUserName();
         objMossController = objFactory.GetServiceManager("MossService");
         //get the user prefrences.
         objUserPreferences = ((MOSSServiceManager)objMossController).GetUserPreferencesValue(strUserId, strCurrSiteUrl);
         CommonUtility.SetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString(), objUserPreferences);
     }
     catch (Exception ex)
     {
         CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
     }
 }
コード例 #5
0
ファイル: SyncList.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Handles the Click event of the btnContinue 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 btnContinue_Click(object sender, EventArgs e)
 {
     try
     {
         ServiceProvider objFactory = new ServiceProvider();
         AbstractController objReportController = objFactory.GetServiceManager(REPORTSERVICE);
         XmlDocument xmlDocResponse = null;
         //loads the basin list from powerhub database.
         foreach(ListItem item in chkblAssetType.Items)
         {
             if(item.Selected)
             {
                 xmlDocResponse = objReportController.GetSearchResults(GetRequestInfo(), intListValMaxRecord, item.Value, null, 0);
                 SynchronizeSPList(xmlDocResponse, item.Value);
             }
         }
         RenderException(STATUSMESSAGE);
     }
     catch(SoapException soapEx)
     {
         if(!string.Equals(soapEx.Message, NORECORDSFOUND))
         {
             CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
         }
         RenderException(soapEx.Message);
     }
     catch(WebException webEx)
     {
         CommonUtility.HandleException(strCurrSiteUrl, webEx, 1);
         RenderException(webEx.Message);
     }
     catch(Exception ex)
     {
         CommonUtility.HandleException(strCurrSiteUrl, ex);
     }
 }
コード例 #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AssetTreeHelper"/> class.
 /// </summary>
 /// <param name="assetTree">The roles profiles.</param>
 public RolesProfilesHelper()
 {
     objFactory = new ServiceProvider();
     objMossController = objFactory.GetServiceManager(MOSSSERVICE);
     objReportController = objFactory.GetServiceManager(REPORTSERVICE);
 }
コード例 #7
0
ファイル: TooltipManager.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Populates the tooltipconfig items from sharepoint list to data
        /// static data table
        /// </summary>
        /// <param name="listems">The listems.</param>
        private DataTable PopulateTooltipConfigItems()
        {
            AbstractController objMossController = null;
            TooltipConfigItems = new DataTable();
            try
            {
                ServiceProvider objFactory = new ServiceProvider();
                objMossController = objFactory.GetServiceManager("MossService");

                //check wheather cache is null, if null populate the cache
                if (TooltipConfigItems.Rows.Count == 0)
                {
                    TooltipConfigItems = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, CONFIGLISTNAME, string.Empty);
                }
            }
            catch (Exception)
            {
                throw;
            }
            return TooltipConfigItems;
        }
コード例 #8
0
ファイル: TreeViewControl.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Loads the chapter preference.
        /// If the preference Xml for the logged in user and selected book is available in document library it loads from Doc List.
        /// Else create the fresh xml for the selected book and stores in Session.
        /// </summary>
        /// <param name="wellBookDetails">The well book details.</param>
        /// <param name="bookID">The book ID.</param>
        /// <returns>XmlDocument</returns>
        private XmlDocument LoadChapterPreference(XmlDocument wellBookDetails, string bookID)
        {
            XmlDocument chapterPreferenceXml=null;
            CommonUtility objCommonUtility = new CommonUtility();
            AbstractController objMOSSController;
            ServiceProvider objFactory;

            objFactory = new ServiceProvider();
            objMOSSController = objFactory.GetServiceManager(MOSSSERVICE);
            /// If any postback happens, the preference will be loaded from Session
            if (Page.IsPostBack && HttpContext.Current.Session[CHAPTERPREFERENCEXML] != null)
            {
                 string strChapterXml = (string)HttpContext.Current.Session[CHAPTERPREFERENCEXML];
                 if (!string.IsNullOrEmpty(strChapterXml))
                 {
                     chapterPreferenceXml = new XmlDocument();
                     chapterPreferenceXml.LoadXml(strChapterXml);
                 }
            }
            else
            { /// Otherwise preferences will be loaded from Doc Lib or created newly
                if (((MOSSServiceManager)objMOSSController).IsDocLibFileExist(CHAPTERPREFERENCEDOCLIB, objCommonUtility.GetUserName()))
                {
                   XmlDocument  savedChapterPreferenceXml = ((MOSSServiceManager)objMOSSController).GetDocLibXMLFile(CHAPTERPREFERENCEDOCLIB, objCommonUtility.GetUserName());
                    string strXPath = "/Books/BookInfo[@BookID='" + HttpContext.Current.Request.QueryString[QUERYSTRING_BOOKID] +"']";

                    XmlNode bookInfoXml = savedChapterPreferenceXml.SelectSingleNode(strXPath);

                    if (bookInfoXml != null && bookInfoXml.ChildNodes.Count > 0)
                    {
                        chapterPreferenceXml = new XmlDocument();
                        chapterPreferenceXml.LoadXml(bookInfoXml.OuterXml);

                        /// Compare the User Preference with wellbookXML and add/remove the chapter nodes to the xml based on
                        /// If a chapter node available in preference xml but not in wellbookxml means either the chapter is deleted/terminated/contains no page so, not visible in treeview, remove such chapters from preference xml and save it back to Doc Lib.
                        /// If a chapter node not available in preference xml but available in wellbookxml means either the chapter is activated/added pages/newly added. Add such chapters with display=true to preference xml and the begining and save to Doc Lib.
                        AddRemoveChapterNodes(wellBookDetails, chapterPreferenceXml);
                    }
                    else
                    {
                        chapterPreferenceXml = CreateChapterListXml(wellBookDetails);
                    }
                }
                else
                {
                    chapterPreferenceXml = CreateChapterListXml(wellBookDetails);
                }
                if (chapterPreferenceXml != null)
                {
                    HttpContext.Current.Session.Remove(CHAPTERPREFERENCEXML);
                    HttpContext.Current.Session[CHAPTERPREFERENCEXML] = chapterPreferenceXml.OuterXml;
                }
            }

            return chapterPreferenceXml;
        }
コード例 #9
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Gets the asset value for the asset type
        /// </summary>
        /// <param name="requestInfo">The request info.</param>
        /// <param name="assetType">Type of the asset.</param>
        /// <returns></returns>
        public XmlDocument GetAssetValueForAssetType(RequestInfo requestInfo, string assetType)
        {
            ServiceProvider objFactory = new ServiceProvider();
            XmlDocument responseXmlDoc = null;
            AbstractController objAbstractController = null;

            objAbstractController = objFactory.GetServiceManager("ReportService");
            responseXmlDoc = objAbstractController.GetSearchResults(requestInfo, -1, assetType, null, 0);

            return responseXmlDoc;
        }
コード例 #10
0
ファイル: Reorder.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Initializes a new instance of the <see cref="Reorder"/> class.
 /// </summary>
 public Reorder()
 {
     objFactory = new ServiceProvider();
     objCommonUtility = new CommonUtility();
     objMOSSController = objFactory.GetServiceManager(MOSSSERVICE);
 }
コード例 #11
0
ファイル: UserValidation.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// This function is used to alidates the user.
 /// </summary>
 /// <returns>
 /// true  : if the logged in user is a valid user;
 /// false : if the logged in user is not a valid user;
 /// </returns>
 public static bool ValidateUser()
 {
     bool blnIsValidUser = true;
     string strUserID = string.Empty;
     string strParentSiteURL = string.Empty;
     AbstractController objController = null;
     ServiceProvider objFactory = null;
     try
     {
         if (HttpContext.Current.Session[VALIDUSERSESSION] != null)
         {
             if (HttpContext.Current.Session[VALIDUSERSESSION].ToString() == YES)
             {
                 blnIsValidUser = true;
             }
             else if (HttpContext.Current.Session[VALIDUSERSESSION].ToString() == NO)
             {
                 blnIsValidUser = false;
             }
         }
         else
         {
             objFactory = new ServiceProvider();
             objController = objFactory.GetServiceManager("MOSSService");
             strUserID = HttpContext.Current.User.Identity.Name.ToString();
             strParentSiteURL = SPContext.Current.Site.Url.ToString();
             //if the logged in user is a local system Admin, then no need to check in AD.
             if (!((MOSSServiceManager)objController).IsAdmin(strParentSiteURL, strUserID))
             {
                 if (!((MOSSServiceManager)objController).IsValidUser(strParentSiteURL, strUserID))
                 {
                     HttpContext.Current.Session[VALIDUSERSESSION] = NO;
                     blnIsValidUser = false;
                 }
                 else
                 {
                     HttpContext.Current.Session[VALIDUSERSESSION] = YES;
                     blnIsValidUser = true;
                 }
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
     return blnIsValidUser;
 }
コード例 #12
0
ファイル: DWBTypeIReports.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Renders the control to the specified HTML writer.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"></see> object that receives the control content.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            ServiceProvider objFactory = null;
            try
            {
                btnPrintPage.OnClientClick = this.RegisterJavaScript();
                if (HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES] != null &&
                    ((TreeNodeSelection)HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES]).IsTypeISelected)
                {
                    TreeNodeSelection objTreeNodeSelection = null;
                    objTreeNodeSelection = (TreeNodeSelection)HttpContext.Current.Session[SESSION_WEBPARTPROPERTIES];

                    if (string.Equals(objTreeNodeSelection.ReportName, TYPE1_REPORT_NAME_WELLHISTORY))
                    {
                        ServiceName = ServiceNameEnum.EventService;
                        SearchName = SearchNameEnum.WellHistory;
                        XSLFileName = XSLFileEnum.WellHistory;
                        ViewMode = ViewModeEnum.DataSheet;
                    }
                    else if (string.Equals(objTreeNodeSelection.ReportName, TYPE1_REPORT_NAME_WELLBOREHEADER))
                    {
                        ServiceName = ServiceNameEnum.ReportService;
                        SearchName = SearchNameEnum.WellboreHeader;
                        XSLFileName = XSLFileEnum.WellboreHeader_Datasheet;
                        ViewMode = ViewModeEnum.DataSheet;
                    }
                    else if (string.Equals(objTreeNodeSelection.ReportName, TYPE1_REPORT_NAME_PREPROD_RFT))
                    {
                        ServiceName = ServiceNameEnum.ReportService;
                        SearchName = SearchNameEnum.PreProdRFT;
                        XSLFileName = XSLFileEnum.TabularResults;
                        ViewMode = ViewModeEnum.Tabular;
                        ExportPage = true;
                    }
                    else if (string.Equals(objTreeNodeSelection.ReportName, TYPE1_REPORT_NAME_WELLSUMMARY))
                    {
                        ServiceName = ServiceNameEnum.ReportService;
                        SearchName = SearchNameEnum.WellSummary;
                        XSLFileName = XSLFileEnum.WellSummary;
                        ViewMode = ViewModeEnum.DataSheet;
                    }

                    PageID = objTreeNodeSelection.PageID;
                    ChapterID = objTreeNodeSelection.ChapterID;

                    LoadMetaDataControls();

                    objFactory = new ServiceProvider();
                    objReportController = objFactory.GetServiceManager(ServiceName.ToString());
                    objMossController = objFactory.GetServiceManager(MOSSSERVICE);

                    RenderPage(writer);
                    InitializeUserPreference();
                }
                else if (!string.IsNullOrEmpty(HttpContext.Current.Request.QueryString[QUERYSTRING_MODE]))
                {
                    PageID = HttpContext.Current.Request.QueryString[QUERYSTRING_PAGEID];
                    ChapterID = HttpContext.Current.Request.QueryString[QUERYSTRING_CHAPTERID];

                    LoadMetaDataControls();

                    objFactory = new ServiceProvider();
                    objReportController = objFactory.GetServiceManager(ServiceName.ToString());
                    objMossController = objFactory.GetServiceManager(MOSSSERVICE);

                    RenderPage(writer);
                    InitializeUserPreference();
                }
            }
            catch (SoapException soapEx)
            {
                if (!string.Equals(soapEx.Message.ToString(), NORECORDSFOUND))
                {
                    CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
                }
                RenderExceptionMessage(writer, soapEx.Message.ToString());
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), webEx, 1);
                RenderExceptionMessage(writer, webEx.Message.ToString());
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                writer.Write("<Script language=\"javascript\">setWindowTitle('Well Book Viewer');</Script>");
            }
        }
コード例 #13
0
ファイル: PDFHelper.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Adds the type1 to PDF doc.
        /// </summary>
        /// <param name="docPDF">The doc PDF.</param>
        /// <param name="xpatpageNode">The xpatpage node.</param>
        internal string AddType1toPDFDoc(string[] strarrPageDetails, string context)
        {
            strWr = new StringWriter();
            objFactory = new ServiceProvider();
            objreqinf = new RequestInfo();
            xmlDocSearchResult = new XmlDocument();
            pdfBLL = new PdfBLL();
            XmlTextReader xmlTextReader = null;
            AbstractController objMossController = null;
            objMossController = objFactory.GetServiceManager(MOSSSERVICE);
            objreqinf.Entity = SetEntity(strarrPageDetails);
            if (!strarrPageDetails[3].ToUpper().Equals("WELLHISTORY"))
            {
                objQueryServiceController = objFactory.GetServiceManager(Constant.REPORTSERVICE, context);
                xmlDocSearchResult = objQueryServiceController.GetSearchResults(objreqinf, -1, strarrPageDetails[3], null, 0);
            }
            else
            {
                objQueryServiceController = objFactory.GetServiceManager(Constant.EVENTSERVICE, context);
                xmlDocSearchResult = objQueryServiceController.GetSearchResults(objreqinf, -1, strarrPageDetails[3], null, 0);
            }
            switch (strarrPageDetails[3].ToUpper())
            {
                case "PREPRODRFT":
                    xmlTextReader = ((MOSSServiceManager)objMossController).GetXSLTemplate("PDFTabular Results", context);
                    break;
                case "WELLBOREHEADER":
                    xmlTextReader = ((MOSSServiceManager)objMossController).GetXSLTemplate("WellboreHeader Datasheet", context);
                    break;
                case "WELLHISTORY":
                    xmlTextReader = ((MOSSServiceManager)objMossController).GetXSLTemplate("WellHistory DataSheet", context);
                    break;
                case "WELLSUMMARY":
                    xmlTextReader = ((MOSSServiceManager)objMossController).GetXSLTemplate("WellSummary", context);
                    break;
            }
            strWr = pdfBLL.TransformSearchResultsToXSL(xmlDocSearchResult, xmlTextReader, string.Empty, string.Empty,
              string.Empty, strarrPageDetails[3], 100, "Report", 100, context);

            return Convert.ToString(strWr.GetStringBuilder());
        }
コード例 #14
0
ファイル: DREAMCharts.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Binds the chart data.
        /// </summary>
        private void BindChartData()
        {
            DataSet dsChart = null;
            XmlTextReader objXmlTextReader = null;

            try
            {

                /// Get response XML from webservice
                objRespXmlDocument = GetResponseXML(hdnSelectedCriteriaName.Value, hdnSelectedUWI.Value);

                objFactory = new ServiceProvider();
                objMOSSController = objFactory.GetServiceManager(MOSSSERVICE);
                /// Get the XSL template to transform webservice response to RAdChart format.
                objXmlTextReader = ((MOSSServiceManager)objMOSSController).GetXSLTemplate(GetEnumDescription(XSLFileName), strCurrSiteUrl);
                if (objRespXmlDocument != null)
                {
                    dsChart = GetRadDataSource(objXmlTextReader);
                    dsChart = ConvertUnitValue(hdnSelectedDepthUnit.Value, dsChart, strDepthColumn);
                    /// Set Chart Title.
                    objRadChart.ChartTitle.TextBlock.Text = string.Format("UWBI : {0}", HttpContext.Current.Request.QueryString["hidReportSelectRow"]);
                    if (dsChart != null)
                    {
                        if (dsChart.Tables["attribute"] != null && dsChart.Tables["attribute"].Rows.Count > 0)
                        {

                            /// Bind chart to DataTable "attribute"
                            objRadChart.DataSource = dsChart;
                            objRadChart.DataMember = "attribute";
                            objRadChart.DataBind();
                            if (dsChart.Tables["attribute"].Rows.Count == 1)
                            {
                                objRadChart.Series[0].Appearance.PointMark.Visible = true;
                                objRadChart.Series[0].Appearance.PointMark.Figure = "Star5";
                                objRadChart.Series[0].Appearance.PointMark.Dimensions.Height = Telerik.Charting.Styles.Unit.Pixel(25);
                                objRadChart.Series[0].Appearance.PointMark.Dimensions.Width = Telerik.Charting.Styles.Unit.Pixel(25);
                                objRadChart.Series[0].Appearance.PointMark.FillStyle.FillType = Telerik.Charting.Styles.FillType.Solid;
                                objRadChart.Series[0].Appearance.PointMark.FillStyle.MainColor = System.Drawing.Color.Blue;
                                objRadChart.Series[0].Appearance.PointMark.Shadow.Blur = 1;
                                objRadChart.Series[0].Appearance.PointMark.Shadow.Color = System.Drawing.Color.DimGray;
                                objRadChart.Series[0].Appearance.PointMark.Shadow.Distance = 2;

                                //Border.Color = 50, 0, 245, 100
                                //Border.Width = 1
                                //Figure = Star5
                                //Visible = True
                                //Dimensions.Height = 25px
                                //Dimensions.Width = 25px
                                //FillStyle.FillType = Solid
                                //FillStyle.MainColor = 90, 100, 254, 100
                                //Shadow.Blur = 1
                                //Shadow.Color = DimGray
                                //Shadow.Distance = 2

                            }
                        }
                    }
                    /// Store the request ID
                    if (objRespXmlDocument.SelectSingleNode("response/@requestid") != null)
                    {
                        hdnRequestID.Value = hdnRequestID.Value = objRespXmlDocument.SelectSingleNode("response/@requestid").Value;
                        this.RequestID = hdnRequestID.Value = objRespXmlDocument.SelectSingleNode("response/@requestid").Value;
                    }
                }
            }
            finally
            {
                if (dsChart != null)
                    dsChart.Dispose();
                if (objXmlTextReader != null)
                    objXmlTextReader.Close();
            }
        }
コード例 #15
0
ファイル: PdfBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Transforms the form search results to XSL.
        /// </summary>
        /// <param name="document">The XML document.</param>
        /// <param name="textReader">The XML text reader.</param>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="sortByColumn">The sortby column.</param>
        /// <param name="sortOrder">The sortorder.</param>
        /// <param name="searchType">Type of the search.</param>
        public StringWriter TransformSearchResultsToXSL(XmlDocument document, XmlTextReader textReader,
                                                string pageNumber, string sortByColumn, string sortOrder,
                                                string searchType, int maxRecords, string windowTitle, int recordCount, string context)
        {
            //XslCompiledTransform xslTransform = null;
            XslTransform xslTransform = null;
            XmlDocument objXmlDocForXSL = null;
            XsltArgumentList xsltArgsList = null;
            XmlNodeList objXmlNodeList = null;
            XPathDocument objXPathDocument = null;
            MemoryStream objMemoryStream = null;
            DateTimeConvertor objDateTimeConvertor = null;

            ServiceProvider objFactory = new ServiceProvider();
            objMOSSController = objFactory.GetServiceManager(MOSSSERVICE);
            strwr = new StringWriter();
            int intPageNumber = 0;

            int intRecordCount = 0;
            double dblCurrentPage = 0D;
            string strSortOrder = SORTDEFAULTORDER;
            //string strDepthUnit = string.Empty;
            string strDepthUnit = "metres";
            string strRequestID = string.Empty;

            try
            {
                if (document != null && textReader != null)
                {
                    //Inititlize the system and custom objects
                    objCommonUtility = new CommonUtility();
                    xslTransform = new XslTransform();
                    objXmlDocForXSL = new XmlDocument();
                    xsltArgsList = new XsltArgumentList();

                    objMemoryStream = new MemoryStream();
                    document.Save(objMemoryStream);
                    objMemoryStream.Position = 0;
                    objXPathDocument = new XPathDocument(objMemoryStream);

                    //Inititlize the XSL
                    objXmlDocForXSL.Load(textReader);
                    xslTransform.Load(objXmlDocForXSL);
                    //the below condition validates the pageNumber parameter value.
                    if (pageNumber.Length > 0)
                    {
                        intPageNumber = Convert.ToInt32(pageNumber);
                    }
                    //the below condition validates the sortOrder parameter value.
                    if (sortOrder.Length > 0)
                    {
                        strSortOrder = sortOrder;
                    }

                    //Get the Total Record Count
                    objXmlNodeList = document.SelectNodes(XPATH);
                    if (objXmlNodeList != null)
                    {
                        foreach (XmlNode xmlNode in objXmlNodeList)
                        {
                            intRecordCount = Convert.ToInt32(xmlNode.SelectSingleNode("recordcount").InnerXml.ToString());
                        }
                    }
                    //the below condition validates the pageNumber parameter value.
                    if (pageNumber.Length > 0)
                    {
                        dblCurrentPage = Double.Parse(pageNumber);
                        intRecordCount = recordCount; //Added for cashing
                    }
                    //Added for cashing
                    //Get the Response ID
                    objXmlNodeList = document.SelectNodes("response");
                    if (objXmlNodeList != null)
                    {
                        foreach (XmlNode xmlNode in objXmlNodeList)
                        {
                            strRequestID = xmlNode.Attributes["requestid"].Value.ToString();
                        }
                    }
                    if (sortByColumn == null)
                        sortByColumn = string.Empty;
                    int intColumnsToLock = GetNumberofRecordsToLock(document, RESULTRECORDLOCKXPATH);
                    //Add the required parameters to the XsltArgumentList object
                    GetDataQualityRange(ref xsltArgsList, context);

                    objDateTimeConvertor = new DateTimeConvertor();
                    //xsltArgsList.AddExtensionObject(EXTENSIONOBJECT, objDateTimeConvertor);
                    //xsltArgsList.AddParam(RECORDSPERPAGE, string.Empty, intRecordsPerPage);
                    //xsltArgsList.AddParam(PAGENUMBER, string.Empty, intPageNumber);
                    //xsltArgsList.AddParam(RECORDCOUNT, string.Empty, intRecordCount);
                    //xsltArgsList.AddParam(CURRENTPAGENAME, string.Empty, objCommonUtility.GetCurrentPageName(true));
                    //xsltArgsList.AddParam(CURRENTPAGE, string.Empty, dblCurrentPage + 1);
                    //xsltArgsList.AddParam(MAXPAGES, string.Empty, MAXPAGEVALUE);
                    //xsltArgsList.AddParam(SORTCOLUMN, string.Empty, sortByColumn);
                    //xsltArgsList.AddParam(SORTORDER, string.Empty, strSortOrder);
                    //xsltArgsList.AddParam(COLUMNSTOLOCK, string.Empty, intColumnsToLock);
                    //xsltArgsList.AddParam(SEARCHTYPEPARAMETER, string.Empty, searchType);
                    //xsltArgsList.AddParam(USERPREFERENCELABEL, string.Empty, strDepthUnit.ToLower());
                    //xsltArgsList.AddParam(FORMULAVALUETITLE, string.Empty, PIVALUE);
                    //xsltArgsList.AddParam(MAXRECORDS, string.Empty, maxRecords);
                    //xsltArgsList.AddParam(WINDOWTITLE, string.Empty, windowTitle);
                    //xsltArgsList.AddParam(REQUESTID, string.Empty, strRequestID);
                    //xsltArgsList.AddParam(ISSORTAPPLICABLE, string.Empty, FALSE);

                    xsltArgsList.AddExtensionObject("urn:DATE", objDateTimeConvertor);
                    xsltArgsList.AddParam(RECORDSPERPAGE, string.Empty, intRecordsPerPage);
                    xsltArgsList.AddParam(PAGENUMBER, string.Empty, intPageNumber);
                    xsltArgsList.AddParam(RECORDCOUNT, string.Empty, intRecordCount);
                    xsltArgsList.AddParam(CURRENTPAGENAME, string.Empty, objCommonUtility.GetCurrentPageName(true));
                    xsltArgsList.AddParam(CURRENTPAGE, string.Empty, dblCurrentPage + 1);
                    xsltArgsList.AddParam(MAXPAGES, string.Empty, MAXPAGEVALUE);
                    xsltArgsList.AddParam(SORTCOLUMN, string.Empty, sortByColumn);
                    xsltArgsList.AddParam(SORTORDER, string.Empty, strSortOrder);
                    xsltArgsList.AddParam(COLUMNSTOLOCK, string.Empty, intColumnsToLock);
                    xsltArgsList.AddParam(SEARCHTYPEPARAMETER, string.Empty, searchType);
                    xsltArgsList.AddParam(USERPREFERENCELABEL, string.Empty, strDepthUnit.ToLower());
                    xsltArgsList.AddParam(FORMULAVALUETITLE, string.Empty, PIVALUE);
                    xsltArgsList.AddParam(MAXRECORDS, string.Empty, maxRecords);
                    xsltArgsList.AddParam(WINDOWTITLE, string.Empty, windowTitle);
                    xsltArgsList.AddParam(REQUESTID, string.Empty, strRequestID);

                    xslTransform.Transform(objXPathDocument, xsltArgsList, strwr);
                }
                else
                {
                    throw new Exception("Invalid Arguments");
                }
                return strwr;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (objMemoryStream != null)
                {
                    objMemoryStream.Close();
                    objMemoryStream.Dispose();
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Page_s the init.
        /// </summary>
        protected void Page_Init()
        {
            #region  Page_init
            try
            {
                pnlSoapError.Visible = false;
                lblErrorMessage.Visible = false;
                pnlConverterContent.Visible = true;
                btn_goBack.Visible = false;
                pnlTable.Visible = true;
                pnlTableErrorMessage.Visible = false;
                lblTableErrorMessage.Visible = false;
                objUtility = new CommonUtility();

                objUtility.RenderBusyBox(this.Page);

                if (HttpContext.Current.Request.Form["hidSelectedRows"] != null)
                {
                    //This session values is assigned into AHDTVDPopup.ascx / TVDepthPopup.ascx
                    Session.Remove("DepthValues");
                    Session.Remove("tblConvertsRowsCount");
                    Session.Remove("xmlDocSearchResultWellBore");
                    Session.Remove("TopDepth");
                    Session.Remove("BottomDepth");
                    Session.Remove("xmlDocSearchResultAHTVD");
                    Session.Remove("xmlDocSearchResultDepthRef");
                    Session.Remove("hidDrpDepthRefValue");
                }

                tblConvertRows.EnableViewState = true;
                //**added of dev
                CommonUtility objCommonUtility = new CommonUtility();
                ServiceProvider objFactory = new ServiceProvider();
                objReportController = objFactory.GetServiceManager(ServiceName.ToString());
                objMossController = objFactory.GetServiceManager(MOSSSERVICE);

                string strUserId = objCommonUtility.GetUserName();
                //reads the user preferences.
                objUserPreferences = ((MOSSServiceManager)objMossController).GetUserPreferencesValue(strUserId, strCurrSiteUrl);
                CommonUtility.SetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString(), objUserPreferences);
                object objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString());
                if (objSessionUserPreference != null)
                    objUserPreferences = (UserPreferences)objSessionUserPreference;
                strDepthUnit = objUserPreferences.DepthUnits;

                if (rdoDepthUnitsFeet.Checked != true && rdoDepthUnitsMetres.Checked != true)
                {
                    if (string.Equals(strDepthUnit, METRES))
                    {
                        rdoDepthUnitsMetres.Checked = true;
                    }
                    else if (string.Equals(strDepthUnit, FEET))
                    {
                        rdoDepthUnitsFeet.Checked = true;
                    }
                }
                //**end

                //Used to set the tab index for AH and TV textbox only.
                if (hdnTabIndex != null)
                {
                    if (string.IsNullOrEmpty(hdnTabIndex.Value.ToString()))
                    {
                        hdnTabIndex.Value = "1";
                    }
                }

                if (Session["tblConvertsRowsCount"] == null)
                {
                    GenerateRows(intMinRowLength, intMaxRowlength, strtblWithHeaderRow);
                }
                else
                {
                    GenerateRows(intMinRowLength, intMaxRowlength, strtblWithHeaderRow);
                    GenerateRows(intMaxRowlength, Convert.ToInt32(Session["tblConvertsRowsCount"].ToString()), strtblWithOutHeaderRow);
                }

                objReportController = objFactory.GetServiceManager(ServiceName.ToString());

                //Fill Wellbore name into Wellbore Dropdown

                #region populate wellbore name
                if (Session["xmlDocSearchResultWellBore"] == null)
                {
                    objRequestInfo = SetDataObject(strUWBI);
                    xmlDocSearchResultWellBore = objReportController.GetSearchResults(objRequestInfo, intMaxRecord, strWELLBORE, SORTCOLUMN, intSortOrder);
                    FilldrpWellboreName(xmlDocSearchResultWellBore);
                    Session["xmlDocSearchResultWellBore"] = xmlDocSearchResultWellBore.OuterXml;
                    objRequestInfo = null;
                }
                else
                {
                    XmlDocument xmlResponse = new XmlDocument();
                    xmlResponse.LoadXml((string)Session["xmlDocSearchResultWellBore"]);
                    FilldrpWellboreName(xmlResponse);
                    objRequestInfo = null;
                }
                #endregion

                //Fill Wellbore depth reference when Wellbore name is selected.

                #region Populate Wellbore Depth Reference.

                if (Session["xmlDocSearchResultDepthRef"] == null)
                {
                    objRequestInfo = SetDataObject(Default);
                    xmlDocSearchResultDepthRef = objReportController.GetSearchResults(objRequestInfo, intMaxRecord, strMECHANICALDATADEPTHREF, null, intSortOrder);
                    hidDepthRefDefaultUnit.Value = GetMeasurementUnit(xmlDocSearchResultDepthRef.SelectNodes("response/report/record[1]/attribute[@name='depth_reference_elevation']")[0]);
                    FilldrpDepthReference(xmlDocSearchResultDepthRef);
                    Session["xmlDocSearchResultDepthRef"] = xmlDocSearchResultDepthRef.OuterXml;
                    objRequestInfo = null;
                }
                else
                {
                    XmlDocument xmlResponse = new XmlDocument();
                    xmlResponse.LoadXml((string)Session["xmlDocSearchResultDepthRef"]);
                    hidDepthRefDefaultUnit.Value = GetMeasurementUnit(xmlResponse.SelectNodes("response/report/record[1]/attribute[@name='depth_reference_elevation']")[0]);
                    FilldrpDepthReference(xmlResponse);
                }
                #endregion

                #region Display Country Details.
                if (Session["xmlDocSearchResultAHTVD"] == null)
                {
                    objRequestInfo = SetDataObject(Default);
                    xmlDocSearchResultAHTVD = objReportController.GetSearchResults(objRequestInfo, intMaxRecord, strAHTVCALCULATOR, null, intSortOrder);
                    FillCountryDetails(xmlDocSearchResultAHTVD);
                    Session["xmlDocSearchResultAHTVD"] = xmlDocSearchResultAHTVD.OuterXml;
                    objRequestInfo = null;
                }
                else
                {
                    XmlDocument xmlResponse = new XmlDocument();
                    xmlResponse.LoadXml((string)Session["xmlDocSearchResultAHTVD"]);
                    FillCountryDetails(xmlResponse);
                }
                #endregion

                inttblCount = tblConvertRows.Rows.Count;

                //Populate Top & Bottom Depths value from Popup Window

                # region Top & Bottom Depths values to Table
                if (Session["DepthValues"] != null)
                {
                    strDepthValues = Session["DepthValues"].ToString();
                    arrDepthval = strDepthValues.Split('|');
                    dblTopDepth = Convert.ToDouble(arrDepthval[0].ToString());
                    dblBottomDepth = Convert.ToDouble(arrDepthval[1].ToString());
                    intDepthInterval = Convert.ToInt32(arrDepthval[2].ToString());
                    strDepthname = arrDepthval[3].ToString();
                    //used to find the no of rows to be create in the HTML table.
                    int index = Convert.ToInt32(Math.Ceiling(Math.Round(((dblBottomDepth - dblTopDepth) / intDepthInterval), 2)));

                    index = index + 3;
                    if (index < inttblCount)
                    {
                        //if index count is <=10, then no need to create extra rows, by default 10 rows will be there.
                        FillDepthValues(dblTopDepth, dblBottomDepth, intDepthInterval, index, strDepthname, drpDepthReference.SelectedItem.Value);
                    }
                    else
                    {
                        // if index count is >=10, then need to add new rows into HTML table.
                        GenerateRows(intMaxRowlength, index, strtblWithOutHeaderRow);
                        FillDepthValues(dblTopDepth, dblBottomDepth, intDepthInterval, index, strDepthname, drpDepthReference.SelectedItem.Value);

                    }
                }
                #endregion

                SetCSSforEditableAHTVdepth();

            }
            catch (SoapException soapEx)
            {
                if (!string.Equals(soapEx.Message, SOAPEXCEPTIONMESSAGE))
                {
                    CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
                }
                RenderExceptionMessage(soapEx.Message);
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), webEx, 1);
                RenderExceptionMessage(webEx.Message);
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);

            }
            #endregion
        }
コード例 #17
0
        /// <summary>
        /// Handles the Load event of the Page 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 Page_Load(object sender, EventArgs e)
        {
            try
            {
                AbstractController objMossController = null;
                UserPreferences objUserPreferences = new UserPreferences();
                ////Some time user enter the values in between the textbox like row1 textbox and row 5 textbox, before populate the value to table, clean up the textbox value.
                drpWellbore.Attributes.Add("onChange", "javascript:ClearAllRows(this)");

                #region if Wellbore dropdown value changed, need to populate Depthrefece value country value to Dropdown and Label control

                CommonUtility objCommonUtility = new CommonUtility();
                ServiceProvider objFactory = new ServiceProvider();
                objReportController = objFactory.GetServiceManager(ServiceName.ToString());
                objMossController = objFactory.GetServiceManager(MOSSSERVICE);

                string strUserId = objCommonUtility.GetUserName();
                //reads the user preferences.
                objUserPreferences = ((MOSSServiceManager)objMossController).GetUserPreferencesValue(strUserId, strCurrSiteUrl);
                CommonUtility.SetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString(), objUserPreferences);

                object objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString());
                if (objSessionUserPreference != null)
                    objUserPreferences = (UserPreferences)objSessionUserPreference;
                strDepthUnit = objUserPreferences.DepthUnits;

                if (rdoDepthUnitsFeet.Checked != true && rdoDepthUnitsMetres.Checked != true)
                {
                    if (string.Equals(strDepthUnit, METRES))
                    {
                        rdoDepthUnitsMetres.Checked = true;
                    }
                    else if (string.Equals(strDepthUnit, FEET))
                    {
                        rdoDepthUnitsFeet.Checked = true;
                    }
                }

                if (rdoDepthUnitsFeet.Checked)
                {
                    strFeetMetre = "(ft)";
                }
                if (rdoDepthUnitsMetres.Checked)
                {
                    strFeetMetre = "(m)";
                }

                //Used to display the selected value to drpdepthReference Dropdown.
                FillDepthrefSelectedValue();

                if((objUtility.GetPostBackControl(this.Page) != null) && (string.Equals(objUtility.GetPostBackControl(this.Page).ID, "drpWellbore")))
                {
                    try
                    {
                        rdoDepthUnitsFeet.Checked = true;
                        objRequestInfo = SetDataObject(Default);
                        xmlDocSearchResultAHTVD = objReportController.GetSearchResults(objRequestInfo, intMaxRecord, strAHTVCALCULATOR, null, intSortOrder);
                        FillCountryDetails(xmlDocSearchResultAHTVD);
                        Session["xmlDocSearchResultAHTVD"] = null;
                        Session["xmlDocSearchResultAHTVD"] = xmlDocSearchResultAHTVD.OuterXml;
                        objRequestInfo = null;

                        objRequestInfo = SetDataObject(Default);
                        xmlDocSearchResultDepthRef = objReportController.GetSearchResults(objRequestInfo, intMaxRecord, strMECHANICALDATADEPTHREF, null, intSortOrder);
                        Session["xmlDocSearchResultDepthRef"] = null;
                        Session["xmlDocSearchResultDepthRef"] = xmlDocSearchResultDepthRef.OuterXml;
                        FilldrpDepthReference(xmlDocSearchResultDepthRef);
                        FillDepthrefSelectedValue();
                    }
                    catch
                    {
                        pnlTable.Visible = false;
                        pnlTableErrorMessage.Visible = true;
                        lblTableErrorMessage.Visible = true;
                    }
                }

                #endregion

                int intCount = tblConvertRows.Rows.Count - 2;
                // Thease session variables are used to display the values into First row first col, last row first column of the HTML tables in non-editable mode.
                if (Session["TopDepth"] != null && Session["BottomDepth"] != null)
                {
                    //Assign always Topdepth values into First textbox, and Bottom values into last text box, thease values are coming webservice.
                    TextBox txtAHDepth0 = (TextBox)tblConvertRows.Rows[0].Cells[0].FindControl("txtAHDepth0");
                    txtAHDepth0.Text = Convert.ToDouble(Session["TopDepth"].ToString()).ToString(("#0.00"));

                    TextBox txtAHDepthMax = (TextBox)tblConvertRows.Rows[intCount].Cells[0].FindControl("txtAHDepth" + intCount);
                    txtAHDepthMax.Text = Convert.ToDouble(Session["BottomDepth"].ToString()).ToString(("#0.00"));

                    TextBox lblAHDepth0 = (TextBox)tblConvertRows.Rows[0].Cells[1].FindControl("lblAHDepth0");

                    Decimal decTxtAHDepth0 = Convert.ToDecimal(txtAHDepth0.Text.ToString());
                    Decimal decTxtAHDepthMax = Convert.ToDecimal(txtAHDepthMax.Text.ToString());
                    Decimal decHndDrpValue = Convert.ToDecimal(Session["hidDrpDepthRefValue"].ToString());
                    //*added by Dev
                    decHndDrpValue = ConvertFeetMetre(decHndDrpValue, hidDepthRefDefaultUnit.Value);

                    // used to display with 2 digit, eg : 52.00
                    //Bydefault need to display calculated values to 1 rows 2 columns and last row 2 columns.
                    // (0.00 - Depth Reference (DF,BF,etc...)
                    lblAHDepth0.Text = Convert.ToString(Math.Round(Convert.ToDecimal(Convert.ToDouble(decTxtAHDepth0) - Convert.ToDouble(decHndDrpValue)), 2).ToString("#0.00")).ToString();
                    TextBox lblAHDepthMax = (TextBox)tblConvertRows.Rows[intCount].Cells[1].FindControl("lblAHDepth" + intCount);
                    lblAHDepthMax.Text = Convert.ToString(Math.Round(Convert.ToDecimal(Convert.ToDouble(decTxtAHDepthMax) - Convert.ToDouble(decHndDrpValue)), 2).ToString("#0.00")).ToString();

                }
            }
            catch (SoapException soapEx)
            {
                if (!string.Equals(soapEx.Message, SOAPEXCEPTIONMESSAGE))
                {
                    CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
                }
                RenderExceptionMessage(soapEx.Message);
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), webEx, 1);
                RenderExceptionMessage(webEx.Message);
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                objUtility.CloseBusyBox(this.Page);
            }
        }
コード例 #18
0
        /// <summary>
        /// Gets the listof books for the search criteria.
        /// </summary>
        /// <returns>DataTable</returns>
        private DataTable GetListofBooks()
        {
            ServiceProvider objFactory = new ServiceProvider();
            /// Column name to apply row filtering
            string[] strColumns = { BOOKID };
            StringBuilder strBookIds = new StringBuilder();
            string strCamlQuery = string.Empty;
            objMossController = objFactory.GetServiceManager(MOSSSERVICE);

            DataTable dtBooks = null;
            DataTable dtChapter = new DataTable();

            try
            {
                if (!string.IsNullOrEmpty(hidAssetValue.Value))
                {
                    dtChapter = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, DWBCHAPTERLIST, string.Format(CHAPTERCAMLQUERY, Page.Request.QueryString["assettype"], hidAssetValue.Value), CHAPTERVIEWFIELDS);
                }
                if (dtChapter != null && dtChapter.Rows.Count > 0)
                    /// Filter the Chapters table based on Unique Book_ID value
                    dtChapter = dtChapter.DefaultView.ToTable("Books", true, strColumns);
                if (dtChapter != null && dtChapter.Rows.Count > 0)
                {
                    foreach (DataRow drBookID in dtChapter.Rows)
                    {
                        strBookIds.Append(Convert.ToString(drBookID[BOOKID]));
                        strBookIds.Append(";");
                    }

                    strCamlQuery = CreateCAMLQuery(strBookIds.ToString(), "ID", "Counter");
                    string strOrderBy = @"<OrderBy><FieldRef Name='Title' Ascending='True' /></OrderBy>";
                    /// Insert OrderBy to CAML Query
                    strCamlQuery = strCamlQuery.Insert(0, strOrderBy);
                    dtBooks = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, DWBBOOKSLIST, strCamlQuery);
                }
            }
            finally
            {
                if (dtChapter != null)
                    dtChapter.Dispose();
            }

            return dtBooks;
        }
コード例 #19
0
ファイル: SearchHelper.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Transforms the search results to XSL.
        /// </summary>
        /// <param name="document">The document.</param>
        /// <param name="textReader">The text reader.</param>
        /// <param name="pageNumber">The page number.</param>
        /// <param name="sortByColumn">The sort by column.</param>
        /// <param name="sortOrder">The sort order.</param>
        /// <param name="searchType">Type of the search.</param>
        /// <param name="maxRecords">The max records.</param>
        /// <param name="windowTitle">The window title.</param>
        /// <param name="recordCount">The record count.</param>
        /// <param name="activeDiv">The active div.</param>
        protected void TransformSearchResultsToXSL(XmlDocument document, XmlTextReader textReader,
                                                string pageNumber, string sortByColumn, string sortOrder,
                                                string searchType, int maxRecords, string windowTitle, int recordCount, string activeDiv)
        {
            XslTransform xslTransform = null;
            XmlDocument objXmlDocForXSL = null;
            XsltArgumentList xsltArgsList = null;
            XmlNodeList objXmlNodeList = null;
            XPathDocument objXPathDocument = null;
            MemoryStream objMemoryStream = null;
            DateTimeConvertor objDateTimeConvertor = null;

            ServiceProvider objFactory = new ServiceProvider();
            //calls the appropriate factory class from the controller layer.
            objMossController = objFactory.GetServiceManager(MOSSSERVICE);

            int intPageNumber = 0;

            int intRecordCount = 0;
            double dblCurrentPage = 0D;
            string strSortOrder = SORTDEFAULTORDER;
            string strRequestID = string.Empty;
            object objSessionUserPreference = null;

            try
            {
                if(document != null && textReader != null)
                {
                    /// Inititlize the system and custom objects
                    objCommonUtility = new CommonUtility();
                    xslTransform = new XslTransform();
                    objXmlDocForXSL = new XmlDocument();
                    xsltArgsList = new XsltArgumentList();
                    objPreferences = new UserPreferences();
                    objMemoryStream = new MemoryStream();
                    document.Save(objMemoryStream);
                    objMemoryStream.Position = 0;
                    objXPathDocument = new XPathDocument(objMemoryStream);

                    /// Inititlize the XSL
                    objXmlDocForXSL.Load(textReader);
                    xslTransform.Load(objXmlDocForXSL);
                    /// the below condition validates the pageNumber parameter value.
                    if(pageNumber.Length > 0)
                    {
                        intPageNumber = Convert.ToInt32(pageNumber);
                    }
                    /// the below condition validates the sortOrder parameter value.
                    if(sortOrder.Length > 0)
                    {
                        strSortOrder = sortOrder;
                    }
                    objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString());
                    /// get count of records per page from User's Preference if set
                    if(objSessionUserPreference != null)
                    {
                        /// read the User Preferences from the session.
                        objPreferences = (UserPreferences)objSessionUserPreference;
                        if(string.IsNullOrEmpty(strDepthUnit))
                        {
                            strDepthUnit = objPreferences.DepthUnits;
                        }
                        intRecordsPerPage = Convert.ToInt16(objPreferences.RecordsPerPage);
                    }
                    /// Get the Total Record Count
                    objXmlNodeList = document.SelectNodes(XPATH);
                    if(objXmlNodeList != null)
                    {
                        foreach(XmlNode xmlNode in objXmlNodeList)
                        {
                            intRecordCount = Convert.ToInt32(xmlNode.SelectSingleNode("recordcount").InnerXml.ToString());
                            intDetailRecordCount = intRecordCount;
                        }
                    }
                    /// the below condition validates the pageNumber parameter value.
                    if(pageNumber.Length > 0)
                    {
                        dblCurrentPage = Double.Parse(pageNumber);
                        intRecordCount = recordCount; //Added for cashing
                    }
                    /// Added for cashing
                    /// Get the Response ID
                    objXmlNodeList = document.SelectNodes("response");
                    if(objXmlNodeList != null)
                    {
                        foreach(XmlNode xmlNode in objXmlNodeList)
                        {
                            if(xmlNode.Attributes["requestid"] != null)
                            {
                                strRequestID = xmlNode.Attributes["requestid"].Value.ToString();
                            }
                        }
                    }
                    if(sortByColumn == null)
                        sortByColumn = string.Empty;
                    int intColumnsToLock = GetNumberofRecordsToLock(document, RESULTRECORDLOCKXPATH);
                    /// Add the required parameters to the XsltArgumentList object
                    GetDataQualityRange(ref xsltArgsList);

                    objDateTimeConvertor = new DateTimeConvertor();
                    #region DREAM 4.0 - Paging functionality in My Team, My Team Assets and Team Management
                    /// Multi Team Owner Implementation
                    /// Changed By: Yasotha
                    /// Date : 24-Jan-2010
                    /// Modified Lines: 435-438
                    #endregion
                    /// passing parameters to XSL
                    xsltArgsList.AddExtensionObject("urn:DATE", objDateTimeConvertor);
                    xsltArgsList.AddParam(RECORDSPERPAGE, string.Empty, intRecordsPerPage);
                    xsltArgsList.AddParam(PAGENUMBER, string.Empty, intPageNumber);
                    xsltArgsList.AddParam(ACTIVEDIV, string.Empty, activeDiv);
                    xsltArgsList.AddParam(RECORDCOUNT, string.Empty, intRecordCount);
                    xsltArgsList.AddParam(CURRENTPAGENAME, string.Empty, objCommonUtility.GetCurrentPageName(true));
                    xsltArgsList.AddParam(CURRENTPAGE, string.Empty, dblCurrentPage + 1);
                    xsltArgsList.AddParam(MAXPAGES, string.Empty, MAXPAGEVALUE);
                    xsltArgsList.AddParam(SORTCOLUMN, string.Empty, sortByColumn);
                    xsltArgsList.AddParam(SORTORDER, string.Empty, strSortOrder);
                    xsltArgsList.AddParam(COLUMNSTOLOCK, string.Empty, intColumnsToLock);
                    xsltArgsList.AddParam(SEARCHTYPEPARAMETER, string.Empty, searchType);
                    xsltArgsList.AddParam(USERPREFERENCELABEL, string.Empty, strDepthUnit.ToLower());
                    xsltArgsList.AddParam(FORMULAVALUETITLE, string.Empty, PIVALUE);
                    xsltArgsList.AddParam(MAXRECORDS, string.Empty, maxRecords);
                    /// DREAM 3.0 code
                    /// start
                    xsltArgsList.AddParam(COLUMNNAMES, string.Empty, strColNames);
                    xsltArgsList.AddParam(COLUMNDISPLAYSTATUS, string.Empty, strColDisplayStatus);
                    xsltArgsList.AddParam(PRESSUREUNIT, string.Empty, strPressureUnit.ToLowerInvariant());
                    xsltArgsList.AddParam(TEMPERATUREUNIT, string.Empty, strTemperatureUnit);//.ToLowerInvariant());
                    xsltArgsList.AddParam(REORDERDIVHTML, string.Empty, strReorderDivHTML);
                    /// end
                    if(!windowTitle.Equals("My Team Assets"))
                    {
                        xsltArgsList.AddParam(WINDOWTITLE, string.Empty, windowTitle);
                    }
                    else
                    {
                        xsltArgsList.AddParam(WINDOWTITLE, string.Empty, string.Empty);
                    }
                    xsltArgsList.AddParam(REQUESTID, string.Empty, strRequestID);
                    StringBuilder builder = new StringBuilder();
                    StringWriter stringWriter = new StringWriter(builder);
                    xslTransform.Transform(objXPathDocument, xsltArgsList, stringWriter);
                    strResultTable = stringWriter.GetStringBuilder();
                }
                else
                {
                    throw new Exception("Invalid Arguments");
                }
            }
            finally
            {
                if(objMemoryStream != null)
                {
                    objMemoryStream.Close();
                    objMemoryStream.Dispose();
                }
            }
        }
コード例 #20
0
ファイル: LeftNavigation.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            //Dream 4.0 Ajax change starts
            //Fix for the UpdatePanel postback behaviour.
            EnsurePanelFix();
            RenderBusyBox();
            //Dream 4.0 Ajax change ends
            ServiceProvider objFactory = new ServiceProvider();
            objController = objFactory.GetServiceManager("MossService");
            strParentSiteURL = SPContext.Current.Site.Url.ToString();
            //Initializing Variables
            DataTable objListData = null;
            String strCAMLQuery = string.Empty;
            try
            {
                CreateUpdatePanel();
                CommonUtility.SetSessionVariable(Page, enumSessionVariable.IsDisplayContextSearch.ToString(), false);
                if(!UserValidation.ValidateUser())
                {
                    this.Context.Response.Redirect(ACCESSDENIEDPAGE, false);
                }

                if(UserValidation.IsSiteUnderMaintenance())
                {
                    /// Redirect to static page which should display the maintenance message
                    this.Context.Response.Redirect(SUSPENDACCESSPAGE, false);
                }
                //Initialize or get user preference values
                InitializeUserPreference();
                object objUserSessionPreferences = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString());
                if(objUserSessionPreferences != null)
                {
                    objUserPreferences = (UserPreferences)objUserSessionPreferences;
                }
                //Populating Country Drop Down
                strCAMLQuery = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><Eq><FieldRef Name=\"Active\" /><Value Type=\"Choice\">Yes</Value></Eq></Where>";
                RenderQuickSearchCountry(objUserPreferences, strParentSiteURL, COUNTRYLIST, strCAMLQuery);
                //Populating Asset Drop Down
                strCAMLQuery = "<Where><Eq><FieldRef Name=\"IsActiveReportService\" /><Value Type=\"Boolean\">1</Value></Eq></Where>";
                RenderQuickSearchAsset(objUserPreferences, strParentSiteURL, ASSETTYPELIST, strCAMLQuery);
                //Creating Column Drop Down
                CreateQuickSearchColumnDDL();
                //Populating Column Drop Down
                PopulateQuickSearchColumnDDL();
                //Render Text Criteria Text Box
                RenderQuickSearchCriteriaField();
                RenderQuickSearchGoButton();
                this.Controls.Add(updtPanelLeftNaV);
                RenderLeftNav();
            }
            catch(Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                if(objListData != null)
                    objListData.Dispose();
            }
        }
コード例 #21
0
ファイル: ChapterBLL.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Saves the reorder XML to document library.
        /// </summary>
        /// <param name="chapterPreference">The chapter preference.</param>
        /// <param name="bookId">The book id.</param>
        /// <returns>XmlDocument</returns>
        public XmlDocument SaveReorderXml(string chapterPreference, string bookId)
        {
            XmlDocument userReorderXml = null;

            CommonUtility objCommonUtility = new CommonUtility();
            AbstractController objMOSSController;
            ServiceProvider objFactory;

            objFactory = new ServiceProvider();
            objMOSSController = objFactory.GetServiceManager(MOSSSERVICE);

            XmlDocument chapterPreferenceXml = new XmlDocument();
            chapterPreferenceXml.LoadXml(chapterPreference);

            string strUserId = objCommonUtility.GetUserName();
            /// If the file for the logged in user is available in doc lib, load to XmlDocument
            if (((MOSSServiceManager)objMOSSController).IsDocLibFileExist(CHAPTERPREFERENCEDOCLIB, strUserId))
            {
                userReorderXml = ((MOSSServiceManager)objMOSSController).GetDocLibXMLFile(CHAPTERPREFERENCEDOCLIB, strUserId);
            }
            else
            { /// Else create new XmlDocument
                userReorderXml = new XmlDocument();
                XmlElement rootElement = userReorderXml.CreateElement("Books");
                userReorderXml.AppendChild(rootElement);
            }

            /// If the preference Xml is available in document read into XmlNode
            /// Else create a new node, add all details and add the node to XmlDocument.
            XmlNode bookNode = userReorderXml.SelectSingleNode("Books/BookInfo[@BookID='" + bookId + "']");
            if (bookNode == null)
            {
                XmlNode ndSearchType = userReorderXml.CreateElement("BookInfo");
                XmlAttribute atBookId = userReorderXml.CreateAttribute("BookID");
                atBookId.Value = bookId;
                ndSearchType.Attributes.Append(atBookId);
                XmlAttribute atBookName = userReorderXml.CreateAttribute("BookName");
                atBookName.Value = chapterPreferenceXml.SelectSingleNode("BookInfo").Attributes["BookName"].Value;
                ndSearchType.Attributes.Append(atBookName);
                userReorderXml.SelectSingleNode("Books").AppendChild(ndSearchType);
                ndSearchType.InnerXml = chapterPreferenceXml.SelectSingleNode("BookInfo").InnerXml;

            }
            else
            {/// If the preference Xml is available in document modify only the inner xml of the BookInfo node.
                bookNode.InnerXml = chapterPreferenceXml.SelectSingleNode("BookInfo").InnerXml;
            }
            ((MOSSServiceManager)objMOSSController).UploadToDocumentLib(CHAPTERPREFERENCEDOCLIB, strUserId, userReorderXml);
            return userReorderXml;
        }
コード例 #22
0
ファイル: QueryBuilder.ascx.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Loads the Tree View with Data Source and Data Provider Information. Also Loads the search details when redirected from 
        /// Standard/Manage Search Links
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            DataTable dtListData = null;
            ServiceProvider objFactory = new ServiceProvider();
            try
            {
                btnSearch.Attributes.Add(REDIRECTATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                RunButton.Attributes.Add(REDIRECTATTRIBUTE, REDIRECTATTRIBUTEVALUE);

                //attributes is added to resize window on load
                querySearchTree.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                cboSavedSearch.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                ClearButton.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                btnReset.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                btnSaveSearch.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                saveButton.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                viewButton.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                editButton.Attributes.Add(RESIZEWINDOWATTRIBUTE, REDIRECTATTRIBUTEVALUE);
                //**
                objMossController = objFactory.GetServiceManager(MOSSSERVICE);
                objReportController = objFactory.GetServiceManager(REPORTSERVICE);
                objQueryServiceController = objFactory.GetServiceManager(QUERYSERVICE);

                ExceptionPanel.Visible = false;
                lblException.Text = string.Empty;

                strUserID = HttpContext.Current.User.Identity.Name.ToString();
                blnIsAdmin = ((MOSSServiceManager)objMossController).IsAdmin(strCurrSiteUrl, strUserID);
                if(!txtSQLQuery.ReadOnly)
                {
                    type = SQL;
                }
                else
                {
                    type = GEN;
                }

                if(!IsPostBack)
                {
                    LoadTreeViewFromDataSet();
                    cboSavedSearch.Items.Clear();

                    cboSavedSearch.Items.Add(DEFAULTDROPDOWNTEXT);
                    ((MOSSServiceManager)objMossController).LoadSaveSearch(QUERYSEARCH, cboSavedSearch);

                    if(Page.Request.QueryString["savesearchname"] != null)
                    {
                        BindUIControls(Page.Request.QueryString["savesearchname"].ToString());
                        lblException.Visible = false;
                    }
                }

            }
            catch(WebException webEx)
            {
                CommonUtility.HandleException(strCurrSiteUrl, webEx, 1);
                ShowLableMessage(webEx.Message);
            }
            catch(Exception ex)
            {
                CommonUtility.HandleException(strCurrSiteUrl, ex);
            }
            finally
            {
                if(dtListData != null)
                    dtListData.Dispose();
            }
        }
コード例 #23
0
ファイル: TopNavigation.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Renders the control to the specified HTML writer.
        /// </summary>
        /// <param name="writer">The object that receives the control content.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            #region Method Variables
            AbstractController objMossController = null;
            String strUserID = string.Empty;
            String strParentSiteURL = string.Empty;
            #endregion
            try
            {
                SetUserPreference();
                ServiceProvider objFactory = new ServiceProvider();
                objMossController = objFactory.GetServiceManager("MossService");

                strUserID = HttpContext.Current.User.Identity.Name.ToString();
                strParentSiteURL = SPContext.Current.Site.Url.ToString();
                writer.Write("<table cellspacing=\"0\" cellpadding=\"0\">");
                writer.Write("<tr><td class=\"ms-globallinks\">");
                writer.Write("<span style='padding-left:3px'></span>");

                //display Welcome Note
                writer.Write("Welcome " + strUserID);
                writer.Write(GetTopNavtext());

                //display Admin link to Administrator alone..
                if (((MOSSServiceManager)objMossController).IsAdmin(strParentSiteURL,strUserID))
                {
                    writer.Write("<a href=\"#\" id=\"adminLink\" onmouseover=\"showAllDREAMMenu('divAdminMenu','visible','block','adminLink');\"  onmouseout=\"showAllDREAMMenu('divAdminMenu','hidden','none','adminLink');\" title=\"Admin\">Admin</a>");
                    writer.Write("<span style='padding-left:4px;padding-right:3px'>|</span>");
                }
                //Displaying the Admin Menu.
                DisplayAdminMenu(writer);
                writer.Write("</td><td class=\"ms-globallinks\"><span style='padding-left:3px'></span>");

                /*Displaying utility link*/
                writer.Write("<a href=\"#\" id=\"utilityLink\" onmouseover=\"showAllDREAMMenu('divUtilityLinksMenu','visible','block','utilityLink');\"  onmouseout=\"showAllDREAMMenu('divUtilityLinksMenu','hidden','none','utilityLink');\" title=\"Utilities\">Utilities</a>");
                writer.Write("<span style='padding-left:4px;padding-right:3px'>|</span>");
                DisplayUtilityLinksMenu(writer);
                writer.Write("</td><td class=\"ms-globallinks\"><span style='padding-left:3px'></span>");
                writer.Write("<a href=\"#\" id=\"userLink\" onmouseover=\"showAllDREAMMenu('divUserLinksMenu','visible','block','userLink');\"  onmouseout=\"showAllDREAMMenu('divUserLinksMenu','hidden','none','userLink');\" title=\"My Links\">My Links</a>");
                writer.Write("<span style='padding-left:4px;padding-right:3px'>|</span>");
                DisplayUserLinksMenu(writer, strParentSiteURL);
                writer.Write("</td><td class=\"ms-globallinks\"><span style='padding-left:3px'></span>");
                //** Commented in DREAM 3.1 as per requirement
                //writer.Write("<a href=\"#\" id=\"SystemLink\" onmouseover=\"showAllDREAMMenu('divSystemLinksMenu','visible','block','SystemLink');\"  onmouseout=\"showAllDREAMMenu('divSystemLinksMenu','hidden','none','SystemLink');\" title=\"Shared Links\">Shared Links</a>");
              //  writer.Write("<span style='padding-left:4px;padding-right:3px'>|</span>");
               // DisplaySystemLinksMenu(writer, strParentSiteURL);
               // writer.Write("</td><td class=\"ms-globallinks\"><span style='padding-left:3px'></span>");
                writer.Write("<a href=\"#\" id=\"allDreamsLink\" onmouseover=\"showAllDREAMMenu('divAllDreamMenu','visible','block','allDreamsLink');\"  onmouseout=\"showAllDREAMMenu('divAllDreamMenu','hidden','none','allDreamsLink');\">All DREAMs</a>");
                writer.Write("<span style='padding-left:4px;padding-right:3px'>|</span>");
                //Displays All DREAMs menu.
                DisplayAllDreamsMenu(writer, strParentSiteURL);
                writer.Write("</td><td class=\"ms-globallinks\"><span style='padding-left:3px'></span>");
                writer.Write("<a title='" + HELPTOOLTIP + "' href=\"javascript:OpenPopup('" + HELPLINK + "','Help','width=1024, height=650,scrollbars=yes,resizable');\"><img src=\"/_layouts/DREAM/images/help.gif\" align=\"absmiddle\" border=\"0\"/></a>");
                writer.Write("</td></tr></table>");
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
        }
コード例 #24
0
ファイル: ResourceStatus.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Method is use to get the staus XML and render as in HTML tables.
 /// </summary>
 /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"></see> object that receives the control content.</param>
 private void RenderResourceStatus(HtmlTextWriter writer)
 {
     ServiceProvider objFactory = new ServiceProvider();
     objResourceController = objFactory.GetServiceManager("ResourceManager");
     XmlNodeList objXMLnodeList = null;
     Boolean blnCheckValue = false;
     xmlResourceStatus = new XmlDocument();
     try
     {
         //Gets the resource status result from the report service.
         xmlResourceStatus = objResourceController.GetSearchResults();
         if (xmlResourceStatus != null)
         {
             writer.Write("<div id=\"tableContainer\" class=\"tableContainer\">");
             writer.Write("<table style=\"border-right:1px solid #bdbdbd;\"  cellpadding=\"0\" cellspacing=\"0\" class=\"scrollTable\" id=\"tblSearchResults\"><thead class=\"fixedHeader\" id=\"fixedHeader\"><tr style=\"height: 20px;\" align=\"center\"><th valign=\"center\" align=\"center\" text-align=\"center\">");
             //Checks whether any service is not working and need to show the Description column.
             objXMLnodeList = xmlResourceStatus.SelectNodes("response/resources/resource");
             foreach (XmlNode xmlNodeResource in objXMLnodeList)
             {
                 if (xmlNodeResource.Attributes["value"].Value.ToString() == "false")
                 {
                     blnCheckValue = true;
                     break;
                 }
             }
             if (blnCheckValue)
             {
                 writer.Write("Resource Name</th>");
                 writer.Write("<th>Status</th>");
                 writer.Write("<th>Description</th>");
             }
             else
             {
                 writer.Write("Resource Name</th>");
                 writer.Write("<th>Status</th>");
             }
             writer.Write("</tr></thead><tbody boder =\"1\" class=\"scrollContent\">");
             //render each service status.
             foreach (XmlNode xmlNodeResource in objXMLnodeList)
             {
                 writer.Write("<tr height=\"20px\"><td>&#160;");
                 writer.Write(xmlNodeResource.Attributes["name"].Value.ToString());
                 writer.Write("&#160;</td>");
                 if (xmlNodeResource.Attributes["value"].Value.ToString() == "true")
                 {
                     if (!blnCheckValue)
                     {
                         //if the service is available shows the resource available image.
                         writer.Write("<td align=\"center\"><img align='absmiddle' src='/_layouts/DREAM/images/Resource_Available.gif' alt='Available' />");
                         writer.Write("</td>");
                     }
                     else
                     {
                         writer.Write("<td align=\"center\"><img align='absmiddle' src='/_layouts/DREAM/images/Resource_Available.gif' alt='Available' />");
                         writer.Write("</td>");
                         writer.Write("<td>&#160;</td>");
                     }
                 }
                 else
                 {
                     if (!blnCheckValue)
                     {
                         //if the service is available shows the resource available image.
                         writer.Write("<td align=\"center\"><img align='absmiddle' src='/_layouts/DREAM/images/Resource_Unavailable.gif' alt='Unavailable' />");
                         writer.Write("</td>");
                     }
                     else
                     {
                         writer.Write("<td align=\"center\"><img align='absmiddle' src='/_layouts/DREAM/images/Resource_Unavailable.gif' alt='Unavailable' />");
                         writer.Write("</td><td>");
                         writer.Write(xmlNodeResource.Attributes["desc"].Value.ToString());
                         writer.Write("&#160;</td>");
                     }
                 }
                 writer.Write("</tr>");
             }
             writer.Write("</table></tbody></table></div>");
         }
         else
         {
             //renders the exception message.
             RenderException(ERRORMESSAGE, writer);
         }
     }
     catch (SoapException soapEx)
     {
         if (!string.Equals(soapEx.Message.ToString(), NORECORDSFOUND))
         {
             CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
         }
         RenderException(soapEx.Message.ToString(),writer);
     }
     catch (Exception Ex)
     {
         RenderException(Ex.Message.ToString(),writer);
     }
     finally
     {
         objCommonUtility.CloseAjaxBusyBox(this.Page);
     }
 }
コード例 #25
0
        /// <summary>
        /// Handles the Click event of the cmdSubmit 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 cmdSubmit_Click(object sender, EventArgs e)
        {
            DataTable dtListValue = null;
            try
            {

                if(Page.IsPostBack)
                {

                    string strToMailID = string.Empty;
                    string strCAMLQuery = string.Empty;
                    string strStatus = string.Empty;
                    string strActive = string.Empty;
                    bool blnSendMail = false;
                    objUtility = new CommonUtility();
                    objADS = new ActiveDirectoryService();

                    string strParentSiteURL = HttpContext.Current.Request.Url.ToString();
                    string strUserName = txtUserAcc.Text.ToString();

                    StringBuilder strMessage = new StringBuilder();

                    ServiceProvider objFactory = new ServiceProvider();
                    objMossController = objFactory.GetServiceManager("MossService");

                    dtListValue = new DataTable();
                    DataRow listRow;

                    strMessage.Append("User ID : " + strUserName);
                    strMessage.Append("<BR>Region: " + txtRegion.Text);
                    strMessage.Append("<BR>Purpose : " + txtPurpose.Text);
                    strToMailID = objADS.GetEmailID(strUserName);

                    if(Request.QueryString["teamId"] == null)
                    {
                        strCAMLQuery = "<OrderBy><FieldRef Name=\"LinkTitleNoMenu\" /></OrderBy><Where><Eq><FieldRef Name=\"LinkTitle\" /><Value Type=\"Computed\">" + strUserName + "</Value></Eq></Where>";
                        dtListValue = ((MOSSServiceManager)objMossController).ReadList(strParentSiteURL, USERACCESSREQUESTLIST, strCAMLQuery);

                        if(dtListValue.Rows.Count > 0)
                        {
                            listRow = dtListValue.Rows[0];
                            strStatus = listRow["Access_x0020_Approval_x0020_Stat"].ToString();
                            strActive = listRow["Active"].ToString();
                        }

                        if(string.Compare(strStatus, STATUSINPROGRESS, true) == 0)
                        {
                            lblMessage.Text = "You have already requested for access. Please contact administrator.";
                        }
                        else
                        {

                            if((string.IsNullOrEmpty(strStatus)) || ((string.Compare(strStatus, STATUSAPPROVED, true) == 0) && (string.Compare(strActive, "No", true) == 0)))
                            {
                                ((MOSSServiceManager)objMossController).CreateAccessRequest(strUserName, txtRegion.Text, txtPurpose.Text, string.Empty, USERACCESSREQUESTLIST);
                                blnSendMail = true;
                            }
                            else if(string.Compare(strStatus, STATUSREJECTED, true) == 0)
                            {
                                strMessage.Append("<BR><BR><font color='red'><b>Please note that the user's request has been rejected earlier</b></font>");
                                blnSendMail = true;
                            }
                        }

                        if(blnSendMail)
                        {
                            objUtility.SendMailforUserAccessRequest(strToMailID, strMessage.ToString());
                            lblMessage.Text = "Thank you for your access request. You will receive an email shortly in response.";
                        }

                    }
                    else
                    {
                        objUtility.SendTeamAccessRequestEmail(strToMailID, strMessage.ToString(), lblTeamName.Text, hidTeamOwner.Value);
                        lblMessage.Text = "Thank you for your access request. You will receive an email shortly in response.";
                    }

                    cmdSubmit.Visible = false;
                    cmdReset.Visible = false;
                }
            }
            catch(WebException webEx)
            {
                //  ExceptionPanel.Visible = true;
                // lblException.Visible = true;
                //  lblException.Text = webEx.Message;
            }
            catch(Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                if(dtListValue != null)
                    dtListValue.Dispose();
            }
        }
コード例 #26
0
ファイル: ChartHelper.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Gets the response XML.
 /// </summary>
 /// <param name="criteriaName">Name of the criteria.</param>
 /// <param name="selectedCriteriaValues">The selected criteria values.</param>
 /// <returns></returns>
 protected XmlDocument GetResponseXML(string criteriaName, string selectedCriteriaValues)
 {
     objRequestInfo = GetRequestInfo(criteriaName, selectedCriteriaValues);
     objFactory = new ServiceProvider();
     objReportController = objFactory.GetServiceManager(REPORTSERVICE);
     objRespXmlDocument = objReportController.GetSearchResults(objRequestInfo, -1, SearchType, null, 0);
     //objRespXmlDocument = new XmlDocument();
     //objRespXmlDocument.Load(@"C:\yasotha\RadChart\Shell.SharePoint.DREAM.WebParts.ChartPOC\dir survey detail resp-SIEP.xml");
     return objRespXmlDocument;
 }
コード例 #27
0
ファイル: ManageTeam.ascx.cs プロジェクト: vijaymca/Dotnet
 /// <summary>
 /// Gets the list of projects OW.
 /// </summary>
 /// <param name="entityName">Name of the entity.</param>
 /// <returns></returns>
 private XmlDocument GetListOfProjectsOW(string entityName)
 {
     XmlDocument objListOfProjectsXml = null;
     XmlDocument objRequestXML = null;
     objRequestInfo = new ShellEntities.RequestInfo();
     objRequestInfo.Entity = new ShellEntities.Entity();
     objRequestInfo.Entity.Name = entityName;
     ShellEntities.Attributes objAttributes = new ShellEntities.Attributes();
     ShellEntities.Value objValue = new ShellEntities.Value();
     objAttributes.Name = "source";
     objValue.InnerText = STAROPERATOR;
     objAttributes.Value = new ArrayList();
     objAttributes.Value.Add(objValue);
     objAttributes.Operator = GetOperator(objAttributes.Value);
     objRequestInfo.Entity.Attribute = new ArrayList();
     objRequestInfo.Entity.Attribute.Add(objAttributes);
     objFactory = new ServiceProvider();
     objReportController = objFactory.GetServiceManager(REPORTSERVICE);
     objRequestInfo.Entity.ResponseType = string.Empty;
     objRequestXML = objReportController.CreateSearchRequest(objRequestInfo);
     objListOfProjectsXml = objReportController.GetSearchResults(objRequestXML, -1, OWPROJECTS, null, 0);
     return objListOfProjectsXml;
 }
コード例 #28
0
        /// <summary>
        /// Handles the Click event of the btnConvert 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 btnConvert_Click(object sender, EventArgs e)
        {
            try
            {
                ServiceProvider objFactory = new ServiceProvider();
                objReportController = objFactory.GetServiceManager(ServiceName.ToString());
                objRequestInfo = SetDataObject(strAHTVDWeb);
                //Below methos is used to call the webservice, response XML will render into HTML table.
                xmlDocSearchResultAHTVD = objReportController.GetSearchResults(objRequestInfo, intMaxRecord,
                                                                               "AHTVCONVERTEDPATH", null, intSortOrder);
                clearAHTVDepthValues();
                PopulateDepthvalues(xmlDocSearchResultAHTVD);

            }
            catch (SoapException soapEx)
            {
                if (!string.Equals(soapEx.Message.ToString(), SOAPEXCEPTIONMESSAGE))
                {
                    CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
                }
                RenderExceptionMessage(soapEx.Message.ToString());
            }
            catch (WebException webEx)
            {
                RenderExceptionMessage(webEx.Message.ToString());
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
        }
コード例 #29
0
ファイル: DetailReport.cs プロジェクト: vijaymca/Dotnet
        /// <summary>
        /// Renders the control to the specified HTML writer.
        /// </summary>
        /// <param name="writer">The <see cref="T:System.Web.UI.HtmlTextWriter"></see> object that receives the control content.</param>
        protected override void Render(HtmlTextWriter writer)
        {
            try
            {
                ServiceProvider objFactory = new ServiceProvider();
                objReportController = objFactory.GetServiceManager(REPORTSERVICE);
                objMossController = objFactory.GetServiceManager(MOSSSERVICE);

                RenderPage(writer);
                //Intializes the user preferences.
                InitializeUserPreference();
            }
            catch (SoapException soapEx)
            {
                if (!string.Equals(soapEx.Message.ToString(), NORECORDSFOUND))
                {
                    CommonUtility.HandleException(strCurrSiteUrl, soapEx, 1);
                }
                RenderExceptionMessage(writer, soapEx.Message.ToString());
            }
            catch (WebException webEx)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), webEx, 1);
                RenderExceptionMessage(writer, webEx.Message.ToString());
            }
            catch (Exception ex)
            {
                CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex);
            }
            finally
            {
                this.Page.Response.Write("<script>try{busyBox1.Hide();}catch(Ex){}</script>");
                this.Page.Response.Write("<script>try{busyBox.Hide();}catch(Ex){}</script>");
            }
        }
コード例 #30
0
        /// <summary>
        /// Finds the key.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="siteURL">The site URL.</param>
        /// <returns></returns>
        public string FindWebServiceKey(string key, string siteURL,bool isWebServiceCall)
        {
            DataTable dtListValues = null;
            string strOutput = string.Empty;
            try
            {
                if (isWebServiceCall)
                {
                    ServiceProvider objFactory = new ServiceProvider();
                    objMossController = objFactory.GetServiceManager("MossService");
                    string strCamlQuery = string.Format("<Where><Eq><FieldRef Name='Title' /><Value Type='Text'>{0}</Value></Eq></Where>",key);
                    dtListValues = ((MOSSServiceManager)objMossController).ReadList(siteURL, CONFIGLISTNAME, strCamlQuery);
                    if (dtListValues != null && dtListValues.Rows.Count > 0)
                    {
                        strOutput = Convert.ToString(dtListValues.Rows[0]["Value"]);
                    }
                }
            }

            catch (Exception)
            {
                throw;
            }
            finally
            {
                if (dtListValues != null)
                    dtListValues.Dispose();
            }
            return strOutput;
        }