/// <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 BtnSubmit_Click(object sender, EventArgs e) { objController = objFactory.GetServiceManager("MossService"); objUtility = new CommonUtility(); try { bool blnIsSaved = false; string strUserId = objUtility.GetUserName(); string strMessage = string.Empty; //set the values selected by the user. if (rdoRating.SelectedIndex != -1) { objFeedback.Rating = rdoRating.SelectedItem.Text; } objFeedback.Reason = txtReasonForRating.Text.Trim(); objFeedback.AdditionalInformation = txtAdditionalInformation.Text.Trim(); objFeedback.PageName = ddlPageName.SelectedItem.Text; objFeedback.Comment = txtPageLevelComment.Text.Trim(); //check the type of feedback has selected. if (string.Compare(rdoFeedback.SelectedItem.Text, PAGELEVELFEEDBACK) == 0) { objFeedback.TypeofFeedback = PAGELEVELFEEDBACK; } else { objFeedback.TypeofFeedback = GENERALFEEDBACK; } ///Check if the Session object for the uploaded file is not null. if (Session["FileAttached"] != null) { objFeedback.FileAttached = (byte[])Session["FileAttached"]; objFeedback.FileName = hidFileName.Value; } //Enters the Feedback details into sharepoint list. blnIsSaved = ((MOSSServiceManager)objController).UpdateFeedback(strUserId, objFeedback); if (blnIsSaved) { lblMessage.Text = SUCCESSMESSEGE; objUtility.SendAlertMailforNewFeedback(strMessage); } else { lblMessage.Text = ERRORMESSEGE; } pnlConfirmFeedback.Visible = true; pnlFeedback.Visible = false; } catch (WebException webEx) { lblErrorMessage.Visible = true; lblErrorMessage.Text = webEx.Message; } catch (Exception ex) { CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex); } }
/// <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 { XmlDocument objDataOwnerXML; objDataOwnerXML = objDataOwnerXMLGenerator.GetDataOwnerXML(GetDataOwnerDetails(GetDataOwnerNames()), arrDataBaseName); objMossController = objFactory.GetServiceManager("MossService"); XmlTextReader objXmlTextReader = ((MOSSServiceManager)objMossController).GetXSLTemplate("DataOwner", SPContext.Current.Site.Url); DisplayDetails(objDataOwnerXML, objXmlTextReader); } catch (Exception ex) { CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex); } finally { objCommonUtility.CloseBusyBox(this.Page); } }
/// <summary> /// Gets the Source Email ID of the admin. /// </summary> /// <returns></returns> public string GetSourceAdminEmailID() { DataTable objDtListValue = null; DataRow objListRow; string strAdminEmailID = string.Empty; string strCAMLQuery = string.Empty; string strParentSiteURL = string.Empty; try { strParentSiteURL = HttpContext.Current.Request.Url.ToString(); objDtListValue = new DataTable(); objMossController = objFactory.GetServiceManager(MOSSSERVICE); strCAMLQuery = "<OrderBy><FieldRef Name=\"Title\" /></OrderBy><Where><Eq><FieldRef Name=\"IsUsedToSendMail\" /><Value Type=\"Choice\">Yes</Value></Eq></Where>"; objDtListValue = ((MOSSServiceManager)objMossController).ReadList(strParentSiteURL, CONFIGLISTNAME, strCAMLQuery); if(objDtListValue.Rows.Count > 0) { //Loop through the values in ConfigList. for(int intIndex = 0; intIndex < objDtListValue.Rows.Count; intIndex++) { objListRow = objDtListValue.Rows[intIndex]; strAdminEmailID = objListRow["Title"].ToString(); if(!string.IsNullOrEmpty(strAdminEmailID)) break; } } } catch(Exception) { throw; } finally { if(objDtListValue != null) objDtListValue.Dispose(); } return strAdminEmailID; }
/// <summary> /// Gets the active data owner list. /// </summary> /// <returns></returns> public DataTable GetActiveDataOwnerList() { string strCamlQuery = string.Empty; string strFoldrName = string.Empty; DataTable dtblDataOwnerList = null; DataTable dtblDataOwnerNames = null; strCamlQuery = "<Where><Eq><FieldRef Name=\"Active\"/><Value Type=\"Boolean\">1</Value></Eq></Where>"; try { objMossController = objFactory.GetServiceManager("MossService"); dtblDataOwnerList = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, strListName, strCamlQuery); if ((dtblDataOwnerList != null) && (dtblDataOwnerList.Rows.Count > 0)) { strFoldrName = dtblDataOwnerList.Rows[0]["Title"].ToString(); dtblDataOwnerNames = ((MOSSServiceManager)objMossController).ReadFolderList(strCurrSiteUrl, strListName, strFoldrName); } } catch { throw; } finally { if (dtblDataOwnerList != null) { dtblDataOwnerList.Dispose(); } } return dtblDataOwnerNames; }
/// <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 { trSiteMaintenance.Visible = false; if(!Page.IsPostBack) { /// Set Region Title SetRegionTitle(); objUtility = new CommonUtility(); txtUserAcc.Text = objUtility.GetUserName(); if(Request.QueryString["IsMaintenance"] != null) { if(Request.QueryString["IsMaintenance"].ToLowerInvariant().Equals("true")) { /// Display the Site Maintenace message trAccessApproval.Visible = false; trSiteMaintenance.Visible = true; lblSiteMaintenanceMessage.Text = PortalConfiguration.GetInstance().GetKey("SiteMaintenanceMessage"); this.Page.Title = lblRegionTitle.Text; } } else if(Request.QueryString["teamId"] != null) { lblTitle.Text = "Request Access for "; DataTable dtTeamDetail = new DataTable(); objMossController = objFactory.GetServiceManager("MossService"); dtTeamDetail = ((MOSSServiceManager)objMossController).ReadList( HttpContext.Current.Request.Url.ToString(), TEAMREGISTRATIONLIST, "<Where><Eq><FieldRef Name='ID'/><Value Type=\"Counter\">" + Request.QueryString["teamId"].ToString() + "</Value></Eq></Where>"); if(dtTeamDetail != null) { lblTeamName.Text = dtTeamDetail.Rows[0]["Title"].ToString(); hidTeamOwner.Value = dtTeamDetail.Rows[0]["TeamOwner"].ToString(); if(dtTeamDetail != null) dtTeamDetail.Dispose(); } } else { lblTitle.Text = "Access Approval Login"; lblTeamName.Visible = false; } txtRegion.Text = objUtility.GetUserDomain(); } } catch(WebException webEx) { //ExceptionPanel.Visible = true; //lblException.Visible = true; //lblException.Text = webEx.Message; } catch(Exception ex) { CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex); } }
/// <summary> /// Gets the response XML. /// </summary> /// private XmlDocument GetResponseXML(string searchName) { XmlDocument xmlDocResponse = null; objRequestInfo = new RequestInfo(); int intMaxRecords = Convert.ToInt32(PortalConfiguration.GetInstance().GetKey(MAXRECORDS)); string strIdentifiedItem = string.Empty; base.ResponseType = TABULAR; base.EntityName = searchName; if (!string.IsNullOrEmpty(strSelectedRows)) { /// Gets the Selected Identifier value from the results page. strIdentifiedItem = strSelectedRows; /// Gets the Selected Identifier Column name from the results page. arrIdentifierValue = strIdentifiedItem.Split('|'); /// Creates the requestInfo object to fetch result from report service. objRequestInfo = SetBasicDataObjects(searchName, strSelectedCriteriaName, arrIdentifierValue, false, false, intMaxRecords); } else { objRequestInfo = null; } if (objRequestInfo != null) { if (string.Equals(searchName.ToLowerInvariant(), PALEOMARKERSREPORT)) { AddPaleoMarkersAttribute(); } string strLengthType = string.Empty; if (!string.IsNullOrEmpty(strLengthType = objCommonUtility.GetFormControlValue("rdoLengthType"))) { if (strLengthType.Equals(TRUEVERTICAL)) { objRequestInfo.Entity.TVDSS = true; } else { objRequestInfo.Entity.TVDSS = false; } } //end /// Call for the GetSearchResults() method to fetch the search results from webservice. if (strSearchType.Equals("Query Search")) { objQueryBuildController = objFactory.GetServiceManager(QUERYSERVICE); xmlDocResponse = objQueryBuildController.GetSearchResults(objRequestInfo, intMaxRecords, searchName, null, 0); } else { xmlDocResponse = objReportController.GetSearchResults(objRequestInfo, intMaxRecords, searchName, null, 0); } } return xmlDocResponse; }
/// <summary> /// Handles the Click event of the linkDeleteButton 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> void linkDeleteButton_Click(object sender, EventArgs e) { string strUserID = string.Empty; if(hidDeleteSearchName.Value != null) { try { strUserID = objUtility.GetSaveSearchUserName(); objMossController = objFactory.GetServiceManager("MossService"); if(hidDeleteSearchName.Value.ToString().Length > 0) ((MOSSServiceManager)objMossController).DeleteSaveSearch(hidSearchType.Value.ToString(), strUserID, hidDeleteSearchName.Value.ToString()); } catch(Exception ex) { throw ex; } } }
/// <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> "); writer.Write(xmlNodeResource.Attributes["name"].Value.ToString()); writer.Write(" </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> </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(" </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); } }
/// <summary> /// Deletes the record. /// </summary> /// <param name="listName">Name of the list.</param> /// <param name="itemId">The item id.</param> /// <returns></returns> protected void DeleteRecord(string listName,string itemId) { objMOSSController = objFactory.GetServiceManager("MossService"); ((MOSSServiceManager)objMOSSController).DeleteListItem(listName, itemId); //releases the staff belonging to this team string strQuery = @"<Where><Eq><FieldRef Name='TeamID' /><Value Type='Text'>" + itemId + "</Value></Eq></Where>"; DataTable dtStaff = ((MOSSServiceManager)objMOSSController).ReadList(strSiteURL, USERACCESSREQUESTLIST, strQuery); Dictionary<string, string> dicListValues = null; foreach (DataRow drStaff in dtStaff.Rows) { dicListValues = new Dictionary<string, string>(); dicListValues.Add("ID", drStaff["ID"].ToString()); dicListValues.Add("TeamID", "0"); dicListValues.Add("IsTeamOwner", "No"); ((MOSSServiceManager)objMOSSController).UpdateListItem(dicListValues, USERACCESSREQUESTLIST); } }
/// <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>"); } }
/// <summary> /// Sets the entity. /// </summary> /// <param name="xpatpageNode">The xpatpage node.</param> /// <returns>Entity</returns> private Entity SetEntity(string[] strarrPageDetails) { try { objEntity = new Entity(); objQueryServiceController = null; objEntity.Property = true; switch (strarrPageDetails[3]) { case "PreProdRFT": objEntity.ResponseType = Constant.TABULAR; break; case "WellboreHeader": objEntity.ResponseType = Constant.DATASHEETREPORT; break; case "WellHistory": objEntity.ResponseType = Constant.DATASHEETREPORT; break; case "WellSummary": objEntity.ResponseType = Constant.DATASHEETREPORT; break; } ArrayList arlAttribute = new ArrayList(); arlAttribute = SetBasicAttribute(strarrPageDetails); objEntity.Attribute = arlAttribute; } catch { throw; } return objEntity; }
/// <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()); }
/// <summary> /// Gets the user info. /// </summary> /// <param name="detail">The detail.</param> /// <returns></returns> public string GetUserTeamID() { DataTable dtUserTeam = null; try { objMossController = objFactory.GetServiceManager(MOSSSERVICE); dtUserTeam = ((MOSSServiceManager)objMossController).ReadList(HttpContext.Current.Request.Url.ToString(), USERACCESSREQUESTLIST, "<Where><Eq><FieldRef Name='Title'/><Value Type=\"Text\">" + GetUserName() + "</Value></Eq></Where>", "<FieldRef Name=\"TeamID\"/>"); if((dtUserTeam != null) && (dtUserTeam.Rows.Count > 0)) { return dtUserTeam.Rows[0]["TeamID"].ToString(); } else return "0"; } catch(Exception) { throw; } finally { if(dtUserTeam != null) { dtUserTeam.Dispose(); } } }
/// <summary> /// Gets the user role. /// </summary> /// <returns></returns> public string GetUserRole() { DataTable dtUserAccessList = null; try { objMossController = objFactory.GetServiceManager(MOSSSERVICE); dtUserAccessList = ((MOSSServiceManager)objMossController).ReadList(HttpContext.Current.Request.Url.ToString(), USERACCESSREQUESTLIST, "<Where><Eq><FieldRef Name='Title'/><Value Type=\"Text\">" + GetUserName() + "</Value></Eq></Where>", "<FieldRef Name=\"Role\"/>"); if((dtUserAccessList != null) && (dtUserAccessList.Rows.Count > 0) && (dtUserAccessList.Rows[0]["Role"] != null) && (!string.IsNullOrEmpty((string)dtUserAccessList.Rows[0]["Role"]))) { return (string)dtUserAccessList.Rows[0]["Role"]; } else return "NormalUser";//If user does not belong to any role,Then his role is a normal user,He can be admin also } finally { if(dtUserAccessList != null) { dtUserAccessList.Dispose(); } } }
/// <summary> /// Gets the team permission. /// </summary> /// <param name="siteUrl">The site URL.</param> /// <returns></returns> public string GetTeamPermission(string siteUrl) { string strPermission = string.Empty; objMossController = objFactory.GetServiceManager(MOSSSERVICE); if(((MOSSServiceManager)objMossController).IsCurrentUserTeamOwner(siteUrl, GetUserName())) { strPermission = TEAMOWNERPERMISSION; } else if(!string.Equals(GetUserTeamID(), "0")) { strPermission = STAFFPERMISSION; } else { strPermission = NONREGUSERPERMISSION; } return strPermission; }
/// <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(); } }
/// <summary> /// Read active countries from 'Country' SPList and add to arraylist /// </summary> private ArrayList ReadActiveCountriesList() { ArrayList arlActiveCountries = new ArrayList(); DataTable objDtCountryList = new DataTable(); try { objMossController = objFactory.GetServiceManager("MossService"); string strCamlQuery = "<OrderBy><FieldRef Name=\"Title\"/></OrderBy><Where><Eq>" + "<FieldRef Name=\"Active\" /><Value Type=\"Choice\">Yes</Value></Eq></Where>"; //this will read values from Country Sharepoint list. objDtCountryList = ((MOSSServiceManager)objMossController).ReadList(CurrSiteUrl, COUNTRYLIST, strCamlQuery); if(objDtCountryList != null) { if(objDtCountryList.Rows.Count > 0) { //Loop through the values in country list. foreach(DataRow dtRow in objDtCountryList.Rows) { if(string.Compare(PROJECTARCHIVES, Asset, true) == 0) { arlActiveCountries.Add(SetValue(dtRow["Title"].ToString())); } else { arlActiveCountries.Add(SetValue(dtRow["Country_x0020_Code"].ToString())); } } } } } catch(Exception) { throw; } finally { if(objDtCountryList != null) objDtCountryList.Dispose(); } return arlActiveCountries; }
/// <summary> /// This method retrieves the List Items to be rendered on the page /// The CAML is formed based on the CustomListType value /// </summary> /// <returns>DataTable</returns> protected DataTable GetRecords() { DataTable dtListDetails = null; string strCamlQuery = string.Empty; objMOSSController = objFactory.GetServiceManager("MossService"); strCamlQuery = GetsCAMLQuery(); if (!string.IsNullOrEmpty(strCamlQuery)) { dtListDetails = ((MOSSServiceManager)objMOSSController).ReadList(strSiteURL, ListName.ToString(), strCamlQuery); } return dtListDetails; }
/// <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 { objMossController = objFactory.GetServiceManager("MOSSService"); // arlAdvSaveSearchNames = new ArrayList(); arlWellAdvSaveSearchNames = new ArrayList(); arlWellboreAdvSaveSearchNames = new ArrayList(); arlPARSSaveSearchNames = new ArrayList(); arlLOGSSaveSearchNames = new ArrayList(); arlFieldSaveSearchNames = new ArrayList(); arlBasinSaveSearchNames = new ArrayList(); arlQuerySaveSearchNames = new ArrayList(); arlReservoirAdvSaveSearchNames = new ArrayList(); if(Page.Request.QueryString["Type"] != null) { if(string.Equals(Page.Request.QueryString["Type"].ToString(), MANAGESEARCH)) { hidDeleteSearchName.RenderControl(writer); hidSearchType.RenderControl(writer); objUtility = new CommonUtility(); #region DeleteSearches string strUserID = objUtility.GetSaveSearchUserName(); GetSaveSearchNames(strUserID, true); //validates the Saved Searches and displays information if there are no saved searches. if((arlWellAdvSaveSearchNames.Count == 0) && (arlWellboreAdvSaveSearchNames.Count == 0) && (arlPARSSaveSearchNames.Count == 0) && (arlLOGSSaveSearchNames.Count == 0) && (arlFieldSaveSearchNames.Count == 0) && (arlBasinSaveSearchNames.Count == 0) && (arlQuerySaveSearchNames.Count == 0) && (arlReservoirAdvSaveSearchNames.Count == 0)) { writer.Write("<div id=\"divStandardSearch\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" valign=\"middle\" class=\"breadcrumbRow\"><b>My Searches</b></td></tr>"); writer.Write("<tr><td height=\"10\" align=\"left\" valign=\"top\"></td></tr>"); writer.Write("<tr><td align=\"left\" valign=\"top\">"); writer.Write("<div class=\"iframeBorderException\"><table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); lblNoRecords.Text = "There are no saved searches defined."; lblNoRecords.Visible = true; writer.Write("<table><tr><td><BR/>"); lblNoRecords.RenderControl(writer); writer.Write("</td></tr></table>"); writer.Write("</table></div></td></tr></table></div>"); } else { writer.Write("<div id=\"divStandardSearch\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" valign=\"middle\" class=\"breadcrumbRow\"><b>My Searches</b></td></tr>"); RenderSaveSearchLayout(writer); } #endregion writer.Write("<Script language=\"javascript\">setWindowTitle('My Searches');</Script>"); } else { #region StandardSearches GetSaveSearchNames(ADMIN, false); //validates the Saved Searches and displays information if there are no saved searches. if((arlWellAdvSaveSearchNames.Count == 0) && (arlWellboreAdvSaveSearchNames.Count == 0) && (arlPARSSaveSearchNames.Count == 0) && (arlLOGSSaveSearchNames.Count == 0) && (arlFieldSaveSearchNames.Count == 0) && (arlBasinSaveSearchNames.Count == 0) && (arlQuerySaveSearchNames.Count == 0) && (arlReservoirAdvSaveSearchNames.Count == 0)) { writer.Write("<div id=\"divStandardSearch\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" valign=\"middle\" class=\"breadcrumbRow\"><b>Shared Searches</b></td></tr>"); writer.Write("<tr><td height=\"10\" align=\"left\" valign=\"top\"></td></tr>"); writer.Write("<tr><td align=\"left\" valign=\"top\">"); writer.Write("<div class=\"iframeBorderException\"><table width=\"98%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"); lblNoRecords.Text = "There are no shared searches defined by the administrator."; lblNoRecords.Visible = true; writer.Write("<table><tr><td><BR/>"); lblNoRecords.RenderControl(writer); writer.Write("</td></tr></table>"); writer.Write("</table></div></td></tr></table></div>"); } else { writer.Write("<div id=\"divStandardSearch\"><table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td align=\"left\" valign=\"middle\" class=\"breadcrumbRow\"><b>Shared Searches</b></td></tr>"); RenderSaveSearchLayout(writer); } #endregion writer.Write("<Script language=\"javascript\">setWindowTitle('Shared Searches');</Script>"); } } } catch(Exception ex) { CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex); } }
/// <summary> /// Transforms the list detail. /// </summary> /// <param name="noOfRecords">The no of records.</param> protected void TransformListDetail(int noOfRecords) { XmlTextReader xmlTextReader = null; XslCompiledTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; objCommonUtility = new CommonUtility(); objMOSSController = objFactory.GetServiceManager("MossService"); /// For Paging and Sorting int intrecordsPerPage = 0; int intPageNumber = 0; int intMaxPages = 5; int intCurrentPage = 1; string strSortBy = string.Empty; string strSortType = string.Empty; object objSessionUserPreference = null; strSortType = SORTDEFAULTORDER; Shell.SharePoint.DREAM.Business.Entities.UserPreferences objPreferences = null; try { xmlTextReader = ((MOSSServiceManager)objMOSSController).GetXSLTemplate("Dream List View", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslCompiledTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); //Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); xsltArgsList.AddParam("listType", string.Empty, ListReportName); /// Parameters for Paging/Sorting objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString()); if (objSessionUserPreference != null) { objPreferences = (Shell.SharePoint.DREAM.Business.Entities.UserPreferences)objSessionUserPreference; intrecordsPerPage = Convert.ToInt32(objPreferences.RecordsPerPage); } xsltArgsList.AddParam("recordsPerPage", string.Empty, intrecordsPerPage); //<!-- Page Number field --> if (HttpContext.Current.Request.QueryString["pageNumber"] != null) { intPageNumber = Int32.Parse(HttpContext.Current.Request.QueryString["pageNumber"]); if (blnInitializePageNumber) intPageNumber = 0; } if (HttpContext.Current.Request.QueryString["sortBy"] != null) { strSortBy = HttpContext.Current.Request.QueryString["sortBy"]; } if (HttpContext.Current.Request.QueryString["sortType"] != null) { strSortType = HttpContext.Current.Request.QueryString["sortType"]; } if (intPageNumber > (noOfRecords / intrecordsPerPage)) { intPageNumber--; } xsltArgsList.AddParam("pageNumber", string.Empty, intPageNumber); xsltArgsList.AddParam("recordCount", string.Empty, noOfRecords); intMaxPages = 5; xsltArgsList.AddParam("MaxPages", string.Empty, intMaxPages); intCurrentPage = intPageNumber; xsltArgsList.AddParam("CurrentPage", string.Empty, intPageNumber); if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL);// + "&"); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } xsltArgsList.AddParam("sortBy", string.Empty, strSortBy); xsltArgsList.AddParam("sortType", string.Empty, strSortType); // XmlNode xmlNode = xmlListDocument.SelectSingleNode("records/record/recordInfo/attribute[@name='" + strSortBy + "']"); if (xmlNode != null) { xsltArgsList.AddParam("sortDataType", string.Empty, xmlNode.Attributes["datatype"].Value); } if (((MOSSServiceManager)objMOSSController).IsAdmin(strSiteURL, HttpContext.Current.User.Identity.Name.ToString())) { xsltArgsList.AddParam("TeamPermission", string.Empty, "DreamAdmin"); } else xsltArgsList.AddParam("TeamPermission", string.Empty, Permission); xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.Dispose(); } } }
/// <summary> /// Gets the 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; }
//Dream4.0 changes replaced listbox control type to listcontrol /// <summary> /// Gets the asset columns. /// </summary> protected void GetAssetColumns(string listName, ListControl cboAssetColumn, string asset) { DataTable objListData = null; DataRow objListRow = null; objReportController = objFactory.GetServiceManager(MOSSSERVICE); string strColumnName = string.Empty; string strDisplayName = string.Empty; string strParentSiteURL = SPContext.Current.Site.Url.ToString(); string strCamlQueryAssetColumns = string.Empty; try { //Modification for list tunning dated - 09/feb/2009 strCamlQueryAssetColumns = GetCamlQueryColumnList(strCamlQueryAssetColumns, asset); objListData = ((MOSSServiceManager)objReportController).ReadList(strParentSiteURL, listName, strCamlQueryAssetColumns); if(objListData.Rows.Count > 0) { cboAssetColumn.Items.Clear(); cboAssetColumn.Items.Add(DEFAULTDROPDOWNTEXT); cboAssetColumn.Items[0].Value = string.Empty; for(int index = 0; index < objListData.Rows.Count; index++) { objListRow = objListData.Rows[index]; strColumnName = objListRow["Title"].ToString(); strDisplayName = objListRow["Display_x0020_Name"].ToString(); cboAssetColumn.Items.Add(strDisplayName); cboAssetColumn.Items[index + 1].Value = strColumnName; } } objListData.Clear(); } finally { if(objListData != null) objListData.Dispose(); } }
/// <summary> /// Gets the result XML doument. /// </summary> /// <returns></returns> private XmlDocument GetResponseXml() { int intMaxRecords = 0; XmlDocument xmlDocResponse; objQueryBuildController = objFactory.GetServiceManager(QUERYSERVICE); objRequestInfo = new RequestInfo(); xmlDocResponse = new XmlDocument(); intMaxRecords = Convert.ToInt32(PortalConfiguration.GetInstance().GetKey(MAXRECORDS)); base.ResponseType = "Tabular"; objRequestInfo = SetBasicDataObjects(string.Empty, string.Empty, null, true, true, intMaxRecords); if (strSearchType.Equals("Query Search")) { xmlDocResponse = objQueryBuildController.GetSearchResults(objRequestInfo, intMaxRecords, strSearchType, null, 0); } else { xmlDocResponse = objReportController.GetSearchResults(objRequestInfo, intMaxRecords, strSearchType, null, 0); } return xmlDocResponse; }
/// <summary> /// Gets the basins. /// </summary> /// <returns>XmlDocument</returns> protected XmlDocument GetBasinFromWebService() { objReportController = objFactory.GetServiceManager(REPORTSERVICE); RequestInfo objRequestInfo = new RequestInfo(); Entity objEntity = new Entity(); Criteria objCriteria = new Criteria(); objCriteria.Value = STAROPERATOR; objCriteria.Operator = LIKEOPERATOR; objEntity.Criteria = objCriteria; objRequestInfo.Entity = objEntity; XmlDocument xmlDocResponse = objReportController.GetSearchResults(objRequestInfo, intListValMaxRecord, BASINITEMVAL, null, 0); return xmlDocResponse; }
/// <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(); } } }
/// <summary> /// Initializes a new instance of the <see cref="Reorder"/> class. /// </summary> public Reorder() { objFactory = new ServiceProvider(); objCommonUtility = new CommonUtility(); objMOSSController = objFactory.GetServiceManager(MOSSSERVICE); }
/// <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(); } }
/// <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; }
/// <summary> /// Gets the tectonic setting list. /// </summary> /// <param name="siteURL">The site URL.</param> /// <returns></returns> private DataTable GetTectonicSettingList(string siteURL) { objMossController = objFactory.GetServiceManager(MOSSSERVICE); dtTectonicSetting = ((MOSSServiceManager)objMossController).ReadList(siteURL, TECTONICSETTINGLIST, strCamlQuery); return dtTectonicSetting; }
/// <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(); } }