/// <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> /// Handles the Click event of the CmdCancel 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 CmdCancel_Click(object sender, EventArgs e) { objUtility = new CommonUtility(); string strPermission = objUtility.GetTeamPermission(strCurrSiteUrl); objMossController = objFactory.GetServiceManager("MossService"); if ((!((MOSSServiceManager)objMossController).IsAdmin(strCurrSiteUrl, HttpContext.Current.User.Identity.Name)) && (string.Equals(strPermission, TEAMOWNERPERMISSION))) Response.Redirect("/Pages/MyTeam.aspx", false); else if (((MOSSServiceManager)objMossController).IsAdmin(strCurrSiteUrl, HttpContext.Current.User.Identity.Name)) Response.Redirect("/Pages/TeamManagement.aspx", false); }
/// <summary> /// Activates the List items /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listName">Name of the list.</param> /// <param name="rowID">The row ID.</param> /// <param name="auditlistName">Name of the auditlist.</param> /// <param name="updatePageSequence">if set to <c>true</c> [update page sequence].</param> /// <param name="updateAuditHistory">if set to <c>true</c> [update audit history].</param> /// <returns>bool</returns> public bool ActivateListValues(string siteURL, string listName, int rowID, string auditlistName, bool updatePageSequence, bool updateAuditHistory) { objCommonDAL = new CommonDAL(); objCommonUtility = new CommonUtility(); objCommonDAL.ListStatusUpdate(siteURL, listName, rowID, NO, updatePageSequence); if (updateAuditHistory) { objCommonDAL.UpdateListAuditHistory(siteURL, auditlistName, rowID, objCommonUtility.GetUserName(), AUDIT_ACTION_ACTIVATE); } return true; }
/// <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); } }
/// <summary> /// Saves the search XML to library. /// </summary> /// <param name="searchName">Name of the search.</param> /// <param name="saveSearchName">Name of the save search.</param> /// <param name="labelException">The label exception.</param> /// <param name="shared">if set to <c>true</c> [shared].</param> /// <param name="saveSearch">The save search.</param> /// <param name="searchRequest">The search request.</param> public void ModifySaveSearchXML(string searchName, string saveSearchName, bool shared, DropDownList saveSearch, XmlDocument searchRequest) { objMossController = objFactory.GetServiceManager(MOSSSERVICE); SaveSearchXMLGenerator objSaveSearchXMLGenerator = new SaveSearchXMLGenerator(); SaveSearchRequest objSaveSearchRequest = new SaveSearchRequest(); CommonUtility objUtility = null; try { SPSecurity.RunWithElevatedPrivileges(delegate() { objUtility = new CommonUtility(); string strUserID = objUtility.GetSaveSearchUserName(); ((MOSSServiceManager)objMossController).ModifySaveSearch(searchName, strUserID, saveSearchName, searchRequest, shared.ToString()); saveSearch.Items.Clear(); ((MOSSServiceManager)objMossController).LoadSaveSearch(searchName, saveSearch); }); } catch { throw; } }
/// <summary> /// Updates the Terminate Status of the List Item /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listName">List Name.</param> /// <param name="rowID">RowID</param> /// <param name="actionPeformed">Audit Action ID.</param> /// <param name="itemStatus">Status of the Item(Terminated/Activated)</param> public void ListItemStatusUpdateForChapterPages(string siteUrl, string listName, int rowID, string itemStatus) { objCommonDAL = new CommonDAL(); objCommonUtility = new CommonUtility(); objCommonDAL.ListItemStatusUpdateForChapterPages(siteUrl, listName, rowID, itemStatus); }
/// <summary> /// Handles the Click event of the CmdSave 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 CmdSave_Click(object sender, EventArgs e) { try { objUtility = new CommonUtility(); objMossController = objFactory.GetServiceManager("MossService"); Dictionary<string, string> dicListValues = null; //read from the USERRegistration list the staff list for the particular team. string strStaffQuery = "<Where><And><And><Eq><FieldRef Name=\"TeamID\" /><Value Type=\"Text\">" + Request.QueryString["idValue"].ToString() + "</Value></Eq><Eq><FieldRef Name=\"IsTeamOwner\"/><Value Type=\"Text\">No</Value></Eq></And><Eq><FieldRef Name=\"Active\"/><Value Type=\"Text\">Yes</Value></Eq></And></Where>"; DataTable dtTeamStaff = ((MOSSServiceManager)objMossController).ReadList(strCurrSiteUrl, USERACCESSREQUESTLIST, strStaffQuery); ArrayList arlTeamStaff = new ArrayList(); foreach (DataRow objRow in dtTeamStaff.Rows) { arlTeamStaff.Add(objRow["ID"].ToString()); } /// Multi Team Owner Implementation /// Changed By: Yasotha /// Date : 20-Jan-2010 foreach (ListItem objItem in dualManageStaff.RightItems) { if (arlTeamStaff.Count > 0) { if (!arlTeamStaff.Contains(objItem.Value) && (!hidTeamOwnerUserId.Value.Contains(objItem.Value))) /// Multi Team Owner Implementation /// End { dicListValues = new Dictionary<string, string>(); dicListValues.Add("ID", objItem.Value); dicListValues.Add("TeamID", Request.QueryString["idValue"].ToString()); ((MOSSServiceManager)objMossController).UpdateListItem(dicListValues, USERACCESSREQUESTLIST); objUtility.SendEmailForTeamAccessStatus(objItem.Value, "Approved", Request.QueryString["idValue"].ToString()); } } else { /// Multi Team Owner Implementation /// Changed By: Yasotha /// Date : 20-Jan-2010 if (!hidTeamOwnerUserId.Value.Contains(objItem.Value)) { /// Multi Team Owner Implementation /// End dicListValues = new Dictionary<string, string>(); dicListValues.Add("ID", objItem.Value); dicListValues.Add("TeamID", Request.QueryString["idValue"].ToString()); ((MOSSServiceManager)objMossController).UpdateListItem(dicListValues, USERACCESSREQUESTLIST); objUtility.SendEmailForTeamAccessStatus(objItem.Value, "Approved", Request.QueryString["idValue"].ToString()); } } } foreach (ListItem objItem in dualManageStaff.LeftItems) { if (arlTeamStaff.Count > 0) { if (arlTeamStaff.Contains(objItem.Value)) { dicListValues = new Dictionary<string, string>(); dicListValues.Add("ID", objItem.Value); dicListValues.Add("TeamID", "0"); ((MOSSServiceManager)objMossController).UpdateListItem(dicListValues, USERACCESSREQUESTLIST); objUtility.SendEmailForTeamAccessStatus(objItem.Value, "Rejected", Request.QueryString["idValue"].ToString()); } } } string strPermission = objUtility.GetTeamPermission(strCurrSiteUrl); objMossController = objFactory.GetServiceManager("MossService"); if ((!((MOSSServiceManager)objMossController).IsAdmin(strCurrSiteUrl, HttpContext.Current.User.Identity.Name)) && (string.Equals(strPermission, TEAMOWNERPERMISSION))) Response.Redirect("/Pages/MyTeam.aspx", false); else if (((MOSSServiceManager)objMossController).IsAdmin(strCurrSiteUrl, HttpContext.Current.User.Identity.Name)) Response.Redirect("/Pages/TeamManagement.aspx", false); } catch (WebException webEx) { ShowLableMessage(webEx.Message); } catch (Exception ex) { CommonUtility.HandleException(strCurrSiteUrl, ex); } }
/// <summary> /// To Update Batch Import Audit History /// </summary> /// <param name="siteURL"></param> /// <param name="bookID"></param> /// <param name="actionPerformed"></param> public void UpdateBatchImportAuditHistory(string siteURL, string bookID, string actionPerformed) { objCommonDAL = new CommonDAL(); Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); objCommonDAL.UpdateBatchImportAuditHistory(siteURL, DWBWELLBOOKAUDITLIST, bookID, strUserName, actionPerformed); }
/// <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> /// 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() { objCommonUtility = new CommonUtility(); base.CreateChildControls(); try { SetReportProperties(); CreateMessageLabel(); CreateHyperLinks(); CreateHiddenControl(); CreateRadioControls(); this.Controls.Add(lblMessage); this.Controls.Add(linkExcel); this.Controls.Add(linkPrint); } 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>"); } }
/// <summary> /// Gets the camlQuery based on the report type /// </summary> /// <returns></returns> private string GetsCAMLQuery() { string strTerminated = string.Empty; string strCamlQuery = string.Empty; string strMasterID = string.Empty; if (!ActiveStatus) strTerminated = STATUS_TERMINATED; else strTerminated = STATUS_ACTIVE; switch (ListReportName) { case "Audit Trail": { strMasterID = HttpContext.Current.Request.QueryString["auditID"]; strCamlQuery = @"<OrderBy><FieldRef Name='Created' Ascending='False' /></OrderBy><Where><Eq><FieldRef Name='Master_ID' /><Value Type='Number'>" + strMasterID + "</Value></Eq></Where>"; break; } case MASTERPAGEREPORT: { strCamlQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } case CHAPTERPAGEMAPPINGREPORT: { strCamlQuery = GetCAMLQueryForWellBookPages(); if (strCamlQuery.Length == 0) { strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq></Where>"; } break; } case WELLBOOKPAGEVIEW: { strCamlQuery = GetCAMLQueryForWellBookSummaryPages(); if (strCamlQuery.Length == 0) { strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq></Where>"; } break; } case CHAPTERREPORT: { strCamlQuery = GetCAMLQueryForWellBookChapters(); if (strCamlQuery.Length == 0) { #region DREAM 4.0 - eWB2.0 - Deletion Module /// <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></And> is added. /// And condition added to the CAML query //strCamlQuery = @"<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq></Where>"; strCamlQuery = @"<Where><And><Eq><FieldRef Name='ID' /><Value Type='Counter'>-9999</Value></Eq> <Or> <IsNull> <FieldRef Name='ToBeDeleted' /> </IsNull><Eq> <FieldRef Name='ToBeDeleted' /> <Value Type='Choice'>No</Value> </Eq> </Or> </And></Where>"; #endregion } break; } case CHAPTERPAGEREPORT: { strCamlQuery = @"<OrderBy><FieldRef Name='Page_Sequence' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq><Eq><FieldRef Name='Chapter_ID'/><Value Type='Number'>" + HttpContext.Current.Request.QueryString["ChapterID"] + "</Value></Eq></And></Where>"; break; } case TEMPLATEREPORT: { /// Title column in DWB Templates list is renamed to "Template_Name". the Internal name remains as "Title"; strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } case TEMPLATEPAGESREPORT: { strCamlQuery = GetCAMLQueryForTemplatePages(); break; } case USERREGISTRATION: { strCamlQuery = @"<OrderBy><FieldRef Name='DWBUserName' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } case TEAMREGISTRATION: { object objStoredPrivilege = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPrivileges.ToString()); if (objStoredPrivilege != null) { Privileges objPrivileges = (Privileges)objStoredPrivilege; if (objPrivileges != null) { if (objPrivileges.SystemPrivileges != null) { if (objPrivileges.SystemPrivileges.AdminPrivilege) { /// Get all the teams from "DWB Team" strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; } else if (objPrivileges.SystemPrivileges.BookOwner) { /// Get the teams where loggedin user is member objCommonBLL = new CommonBLL(); strCamlQuery = objCommonBLL.GetCAMLQueryForBOUsers(strSiteURL, "ID", "Counter", strTerminated,false); } } } } break; } case STAFFREGISTRATION: { strCamlQuery = @"<OrderBy><FieldRef Name='Discipline' /><FieldRef Name='User_Rank' /></OrderBy><Where><Eq><FieldRef Name='Team_ID' /><Value Type='Number'>" + HttpContext.Current.Request.QueryString[IDVALUEQUERYSTRING] + "</Value></Eq></Where>"; break; } case WELLBOOKREPORT: { strCamlQuery = string.Empty; object objStoredPrivilege = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPrivileges.ToString()); if (objStoredPrivilege != null) { Privileges objPrivileges = (Privileges)objStoredPrivilege; if (objPrivileges != null && objPrivileges.SystemPrivileges != null) { if (objPrivileges.SystemPrivileges.AdminPrivilege) { /// <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></And> is added. /// And condition added to the CAML query // strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + //strTerminated + "</Value></Eq></Where>"; #region DREAM 4.0 - eWB2.0 - Deletion Module strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq><Or><IsNull><FieldRef Name='ToBeDeleted' /></IsNull><Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></Or></And></Where>"; #endregion } else if (objPrivileges.SystemPrivileges.BookOwner) { /// Find the Team_IDs where user is member "DWB Team Staff" list /// and Get Only the Books where Team (DWB Books) == Team_Name(Title) in "DWB Team" list /// <TODO> /// Add the <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq> at proper location /// </TODO> objCommonBLL = new CommonBLL(); strCamlQuery = objCommonBLL.GetCAMLQueryForBOUsers(strSiteURL, "Team_ID", "Number", strTerminated,true); } else if (objPrivileges.SystemPrivileges.PageOwner || objPrivileges.SystemPrivileges.DWBUser) { if (objPrivileges.FocalPoint != null && !string.IsNullOrEmpty(objPrivileges.FocalPoint.BookIDs)) { objCommonUtility = new CommonUtility(); /// Get only the Books where "Owner" = logged in user //strCamlQuery = @" <Where> <And><Eq><FieldRef Name='Owner' /><Value Type='Lookup'>" + objCommonUtility.GetUserName() + "</Value></Eq><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq></And></Where>"; #region DREAM 4.0 - eWB2.0 - Deletion Module /// <Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></And> is added. /// Another And condition added to the CAML query strCamlQuery = @" <Where><And> <Eq><FieldRef Name='Owner' /><Value Type='Lookup'>" + objCommonUtility.GetUserName() + "</Value></Eq><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq> <Or><IsNull><FieldRef Name='ToBeDeleted' /></IsNull><Eq><FieldRef Name='ToBeDeleted' /><Value Type='Choice'>No</Value></Eq></Or></And></And></Where>"; #endregion } } } } break; } case DWBHOME: { objCommonBLL = new CommonBLL(); strCamlQuery = @"<Where><Eq><FieldRef Name='Windows_User_ID' /><Value Type='Text'>" + GetUserName() + "</Value></Eq></Where>"; DataTable dtListDetails = objCommonBLL.ReadList(strSiteURL, USERLIST, strCamlQuery); string strFavoriteBooksIds = string.Empty; if (dtListDetails.Rows.Count > 0) strFavoriteBooksIds = Convert.ToString(dtListDetails.Rows[0]["FavoriteBooks"]); ((HiddenField)FindControl("hdnUserFavorites")).Value = strFavoriteBooksIds; RadioButtonList rdblFavorites = (RadioButtonList)FindControl("rdoFavourites"); if (rdblFavorites != null) { if (rdblFavorites.SelectedIndex == 0) { /// Get all the Books /// strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq><Gt><FieldRef Name='NoOfActiveChapters' /><Value Type='Number'>0</Value></Gt></And></Where>"; #region DREAM 4.0 - eWB2.0 - Deletion Module strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><And><And><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>No</Value></Eq> <Or> <IsNull> <FieldRef Name='ToBeDeleted' /> </IsNull> <Eq> <FieldRef Name='ToBeDeleted' /> <Value Type='Choice'>No</Value> </Eq> </Or> </And><Gt><FieldRef Name='NoOfActiveChapters' /><Value Type='Number'>0</Value></Gt></And></Where>"; #endregion } else if (rdblFavorites.SelectedIndex == 1) { /// Get only Favourite Books string[] strBookIds = strFavoriteBooksIds.Split(";".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); strCamlQuery = CreateCAMLQuery(strBookIds); } } if (dtListDetails != null) { dtListDetails.Dispose(); } break; } default: strCamlQuery = @"<OrderBy><FieldRef Name='Title' /></OrderBy><Where><Eq><FieldRef Name='Terminate_Status' /><Value Type='Choice'>" + strTerminated + "</Value></Eq></Where>"; break; } return strCamlQuery; }
/// <summary> /// 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; }
/// <summary> /// To get logged in User Name /// </summary> /// <returns></returns> private string GetUserName() { Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); return strUserName; }
/// <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> /// Gets the name of the user. /// </summary> /// <returns></returns> protected string GetUserName() { string strUserName = string.Empty; objCommonUtility = new CommonUtility(); strUserName = objCommonUtility.GetSaveSearchUserName(); return strUserName; }
/// <summary> /// Sends the email to user on print. /// </summary> /// <param name="results">The results.</param> /// <param name="parentSiteURL">The parent site URL.</param> /// <param name="strAddress">The STR address.</param> /// <param name="contextForMail">The context for mail.</param> public void SendEmailToUserOnPrint(string results, string parentSiteURL, string strAddress, SPContext contextForMail) { DataTable dtPrintChapterDetails = null; ActiveDirectoryService objADS = null; try { try { objADS = new ActiveDirectoryService(); } catch (Exception) { objADS = new ActiveDirectoryService(contextForMail); } dtPrintChapterDetails = new DataTable(); CommonUtility objUtility = new CommonUtility(); objCommonDAL = new CommonDAL(); string strToMailID = string.Empty; string strAccessLink = string.Empty; string strMessage = string.Empty; string strCamlQuery = @"<Where><Eq><FieldRef Name='RequestID' /><Value Type='Text'>" + results + "</Value></Eq></Where>"; dtPrintChapterDetails = objCommonDAL.GetChapterPrintDetails(strCamlQuery, parentSiteURL, "DWB Chapter Print Details"); if (dtPrintChapterDetails != null && dtPrintChapterDetails.Rows.Count > 0) { /// Loop through the values in Chapter Print Details list. foreach (DataRow dtRow in dtPrintChapterDetails.Rows) { try { strToMailID = objADS.GetEmailID(dtRow["UserName"].ToString()); } catch (Exception) { } strAccessLink = parentSiteURL + "/Pages/eWBPDFViewer.aspx?mode=chapter&requestID=" + results; objUtility.SendMailforPrintUpdate(strToMailID, strAccessLink, parentSiteURL, strAddress, contextForMail); } } } catch (Exception) { throw; } finally { if (dtPrintChapterDetails != null) dtPrintChapterDetails.Dispose(); } }
/// <summary> /// Updates the Sign of Status /// </summary> /// <param name="siteUrl">Site URL.</param> /// <param name="listName">List Name.</param> /// <param name="signOffStatus">Yes/No.</param> /// <param name="pageId">Page ID.</param> /// <param name="actionperformed">ID of Audit Action.</param> public void UpdateWellBookPageSignOffStatus(string siteURL, string listName, string signOffStatus, int pageId, string actionPerformed) { objWellBookDAL = new WellBookDAL(); Dictionary<string, string> listItemCollection = new Dictionary<string, string>(); listItemCollection.Add("Sign_Off_Status", signOffStatus); string strCAMLQuery = "<Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" + pageId + "</Value></Eq></Where>"; WellBookDAL.UpdateListItemCollectionValues(siteURL, listName, strCAMLQuery, listItemCollection); objCommonDAL = new CommonDAL(); Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); objCommonDAL.UpdateListAuditHistory(siteURL, CHAPTERPAGESMAPPINGAUDITLIST, pageId, strUserName, actionPerformed); }
/// <summary> /// Update Sign Off Status /// Added By: Praveena /// Date:11/09/2010 /// Reason: For module Simplify Sign Off /// </summary> /// <param name="siteURL"></param> /// <param name="listName"></param> /// <param name="signOffStatus"></param> /// <param name="pageIDs"></param> /// <param name="actionPerformed"></param> public void UpdateBulkSignOffStatus(string siteURL, string listName, string signOffStatus, string pageIDs, string actionPerformed) { objWellBookDAL = new WellBookDAL(); objCommonBLL = new CommonBLL(); string strCAMLQuery = objCommonBLL.CreateCAMLQuery(pageIDs, "ID", "Number"); WellBookDAL.UpdateBulkSignOffSatus(siteURL, listName, strCAMLQuery, signOffStatus); objCommonDAL = new CommonDAL(); Shell.SharePoint.DREAM.Utilities.CommonUtility objCommonUtility = new Shell.SharePoint.DREAM.Utilities.CommonUtility(); string strUserName = objCommonUtility.GetUserName(); objCommonDAL.UpdateBulkListAuditHistory(siteURL, CHAPTERPAGESMAPPINGAUDITLIST, pageIDs, strUserName, actionPerformed); }
/// <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() { base.CreateChildControls(); try { objCommonUtility = new CommonUtility(); objMOSSController = objFactory.GetServiceManager("MossService"); strUserName = objCommonUtility.GetUserName(); Permission = objCommonUtility.GetTeamPermission(HttpContext.Current.Request.Url.ToString()); CreateViewerControls(); } catch (Exception ex) { CommonUtility.HandleException(HttpContext.Current.Request.Url.ToString(), ex); } }
/// <summary> /// Updates the master page details. /// </summary> private void UpdateMasterPageDetails() { string strActionPerformed = AUDITACTIONCREATION; if (string.Compare(strMode,EDIT) == 0) { strActionPerformed = AUDITACTIONUPDATION; } objUtility = new CommonUtility(); string strUserName = objUtility.GetUserName(); switch (strListType) { case BOOKPAGES: objWellBook = new WellBookBLL(); objWellBook.UpdateBookPage(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, strUserName, strActionPerformed); break; case CHAPTERPAGES: objWellBook = new WellBookBLL(); objWellBook.UpdateBookPage(strParentSiteURL, objListEntry, CHAPTERPAGESMAPPINGLIST, CHAPTERPAGESMAPPINGAUDITLIST, strUserName, strActionPerformed); break; case TEMPLATEMASTERPAGES: objTemplateBLL = new TemplateDetailBLL(); objTemplateBLL.UpdateMasterPageDetail(strParentSiteURL, TEMPLATEPAGESMAPPINGLIST, TEMPLATECONFIGURATIONAUDIT, objListEntry, strActionPerformed, strUserName); break; default: UpdateListEntry(objListEntry, MASTERPAGELIST, MASTERPAGEAUDITLIST, MASTERPAGE, strActionPerformed); break; } }
/// <summary> /// Gets the user priviledges from the list. /// </summary> private Privileges GetUserPrivileges() { AdminBLL objMOSSService = new AdminBLL(); Privileges objPrivileges = null; CommonUtility objUtility = new CommonUtility(); string userId = objUtility.GetUserName(); DataTable dtSystemPrivileges = objMOSSService.GetDWBPrivileges(strParentSiteURL, userId, SYSTEMPRIVILEGES); if (dtSystemPrivileges != null ) { objPrivileges = objMOSSService.SetPrivilegesObjects(strParentSiteURL, dtSystemPrivileges); } else { objPrivileges = new Privileges(); objPrivileges.IsNonDWBUser = true; } if (dtSystemPrivileges != null) { dtSystemPrivileges.Dispose(); } return objPrivileges; }
protected void TransformAuditListDetail() { XmlTextReader xmlTextReader = null; XslTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; string strSortBy = string.Empty; string strSortType = string.Empty; try { objCommonBLL = new CommonBLL(); xmlTextReader = objCommonBLL.GetXSLTemplate("List Viewer", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); /// Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); /// <!-- Set the number of records per page--> /// <xsl:param name="recordsPerPage" select="0" /> if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { objCommonUtility = new CommonUtility(); string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.Dispose(); } } }
/// <summary> /// Sets the Well Book details data object from the UI. /// </summary> /// <returns></returns> private WellBookDetails SetWellBookDetails() { WellBookDetails objWellBookDetails = new WellBookDetails(); CommonUtility objCommonUtilities = new CommonUtility(); int intRowId = 0; objWellBookDetails.Title = txtWellBookTitle.Text.Trim(); if (cboTeam.SelectedItem != null && !cboTeam.SelectedItem.Value.Contains(DROPDOWNDEFAULTTEXTNONE)) { objWellBookDetails.TeamID = cboTeam.SelectedItem.Value; } if (cboOwner.SelectedItem != null && !cboOwner.SelectedItem.Value.Contains(DROPDOWNDEFAULTTEXTNONE)) { objWellBookDetails.BookOwnerID = cboOwner.SelectedItem.Value; } else { /// If no user is selected as Book Owner, assign the logged in user as Book Owner /// Read the value from Session object (UserRecordID) object objPrivileges = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPrivileges.ToString()); Privileges objStoredPrivileges = null; if (objPrivileges != null) { objStoredPrivileges = (Privileges)objPrivileges; } if (objStoredPrivileges != null && objStoredPrivileges.SystemPrivileges != null) { objWellBookDetails.BookOwnerID = objStoredPrivileges.SystemPrivileges.UserRecordID.ToString(); } } if (string.Compare(strMode,EDIT) == 0) { if (int.TryParse(strSelectedID, out intRowId)) { objWellBookDetails.RowId = intRowId; } } else { objWellBookDetails.Terminated = STATUSACTIVE; } return objWellBookDetails; }
/// <summary> /// Signs the off page. /// </summary> /// <param name="siteURL">The site URL.</param> /// <param name="listName">Name of the list.</param> /// <param name="id">The id.</param> /// <param name="auditListName">Name of the audit list.</param> /// <param name="signOffStatus">if set to <c>true</c> [sign off status].</param> public void SignOffPage(string siteURL, string listName, string rowId, string auditListName, bool signOffStatus) { objCommonDAL = new CommonDAL(); objCommonUtility = new CommonUtility(); if (signOffStatus) objCommonDAL.SignOffStatusUpdate(siteURL, listName, Convert.ToInt32(rowId), YES, auditListName, objCommonUtility.GetUserName(), AUDIT_ACTION_SIGNEDOFF); else objCommonDAL.SignOffStatusUpdate(siteURL, listName, Convert.ToInt32(rowId), NO, auditListName, objCommonUtility.GetUserName(), AUDIT_ACTION_UNSIGNEDOFF); }
/// <summary> /// Transforms the list detail DWB home. /// </summary> /// <param name="noOfRecords">The no of records.</param> protected void TransformListDetailDWBHome(int noOfRecords) { XmlTextReader xmlTextReader = null; XslCompiledTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; /// For Paging and Sorting int intrecordsPerPage = 0; int intPageNumber = 0; int intMaxPages = 5; int intCurrentPage = 1; string strSortBy = string.Empty; string strSortType = string.Empty; object objSessionUserPreference = null; Shell.SharePoint.DREAM.Business.Entities.UserPreferences objPreferences = null; try { objCommonBLL = new CommonBLL(); xmlTextReader = objCommonBLL.GetXSLTemplate("List Viewer DWBHome", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslCompiledTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); /// Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); xsltArgsList.AddParam("listType", string.Empty, ListReportName); /// Parameters for Paging/Sorting xsltArgsList.AddParam("activeStatus", string.Empty, ActiveStatus.ToString().ToLower()); /// <!-- Set the number of records per page--> /// <xsl:param name="recordsPerPage" select="0" /> objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString()); if (objSessionUserPreference != null) { objPreferences = (Shell.SharePoint.DREAM.Business.Entities.UserPreferences)objSessionUserPreference; intrecordsPerPage = Convert.ToInt32(objPreferences.RecordsPerPage); } xsltArgsList.AddParam("recordsPerPage", string.Empty, intrecordsPerPage); /// <!-- Page Number field --> /// <xsl:param name="pageNumber" select="1" /> if (HttpContext.Current.Request.QueryString["pageNumber"] != null) { intPageNumber = Int32.Parse(HttpContext.Current.Request.QueryString["pageNumber"]); if (blnInitializePageNumber) intPageNumber = 0; } if (HttpContext.Current.Request.QueryString["sortBy"] != null) { strSortBy = HttpContext.Current.Request.QueryString["sortBy"]; } if (HttpContext.Current.Request.QueryString["sortType"] != null) { strSortType = HttpContext.Current.Request.QueryString["sortType"]; } else { strSortType = "descending"; } if (intPageNumber > (noOfRecords / intrecordsPerPage)) { intPageNumber--; } xsltArgsList.AddParam("pageNumber", string.Empty, intPageNumber); xsltArgsList.AddParam("recordCount", string.Empty, noOfRecords); intMaxPages = 5; xsltArgsList.AddParam("MaxPages", string.Empty, intMaxPages); intCurrentPage = intPageNumber; xsltArgsList.AddParam("CurrentPage", string.Empty, intPageNumber); if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { objCommonUtility = new CommonUtility(); string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } xsltArgsList.AddParam("sortBy", string.Empty, strSortBy); xsltArgsList.AddParam("sortType", string.Empty, strSortType); XmlNode xmlNode = xmlListDocument.SelectSingleNode("records/record/recordInfo/attribute[@name='" + strSortBy + "']"); if (xmlNode != null) { xsltArgsList.AddParam("sortDataType", string.Empty, xmlNode.Attributes["datatype"].Value); } xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.Dispose(); } } }
/// <summary> /// 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 name of the user. /// </summary> /// <returns></returns> public string GetUserName() { string strUserName = string.Empty; objCommonUtility = new CommonUtility(); strUserName = objCommonUtility.GetUserName(); return strUserName; }
/// <summary> /// Activates the List items /// </summary> /// <param name="siteUrl">The site URL.</param> /// <param name="listName">Name of the list.</param> /// <param name="rowID">The row ID.</param> /// <param name="auditlistName">Name of the auditlist.</param> /// <param name="actionPeformed">The action peformed.</param> /// <param name="itemStatus">The item status.</param> /// <param name="sequenceField">The sequence field.</param> public void UpdateListItemStatus(string siteUrl, string listName, int rowID, string auditlistName, string actionPeformed, string itemStatus, string sequenceField) { objCommonDAL = new CommonDAL(); objCommonUtility = new CommonUtility(); objCommonDAL.ListItemStatusUpdate(siteUrl, listName, rowID, itemStatus, auditlistName, objCommonUtility.GetUserName(), actionPeformed, sequenceField); }
/// <summary> /// Transforms the list detail. /// </summary> /// <param name="listType">Type of the list.</param> /// <param name="noOfRecords">The no of records.</param> protected void TransformListDetail(int noOfRecords) { XmlTextReader xmlTextReader = null; XslTransform xslTransform = null; XmlDocument objXmlDocForXSL = null; XsltArgumentList xsltArgsList = null; XPathDocument objXPathDocument = null; MemoryStream objMemoryStream = null; int intrecordsPerPage = 0; int intPageNumber = 0; int intMaxPages = 5; int intCurrentPage = 1; string strSortBy = string.Empty; string strSortType = string.Empty; object objSessionUserPreference = null; Shell.SharePoint.DREAM.Business.Entities.UserPreferences objPreferences = null; try { objCommonBLL = new CommonBLL(); xmlTextReader = objCommonBLL.GetXSLTemplate("List Viewer", strSiteURL); if (xmlListDocument != null && xmlTextReader != null) { xslTransform = new XslTransform(); XslCompiledTransform xslTransformTest = new XslCompiledTransform(); objXmlDocForXSL = new XmlDocument(); xsltArgsList = new XsltArgumentList(); objMemoryStream = new MemoryStream(); xmlListDocument.Save(objMemoryStream); objMemoryStream.Position = 0; objXPathDocument = new XPathDocument(objMemoryStream); /// Inititlize the XSL objXmlDocForXSL.Load(xmlTextReader); xslTransform.Load(objXmlDocForXSL); xsltArgsList.AddParam("historyColumn", string.Empty, IsExpandCollapseApplicable.ToString()); xsltArgsList.AddParam("editColumn", string.Empty, IsEditApplicable.ToString()); if (ActiveStatus) { xsltArgsList.AddParam("listItemAction", string.Empty, STATUSTERMINATE); } else { xsltArgsList.AddParam("listItemAction", string.Empty, STATUSACTIVATE); } xsltArgsList.AddParam("addMasterLinkColumn", string.Empty, IsAddMasterApplicable.ToString()); xsltArgsList.AddParam("viewMasterLinkColumn", string.Empty, IsViewMasterApplicable.ToString()); xsltArgsList.AddParam("listType", string.Empty, ListReportName); xsltArgsList.AddParam("activeStatus", string.Empty, ActiveStatus.ToString().ToLower()); /// <!-- Set the number of records per page--> /// <xsl:param name="recordsPerPage" select="0" /> objSessionUserPreference = CommonUtility.GetSessionVariable(Page, enumSessionVariable.UserPreferences.ToString()); if (objSessionUserPreference != null) { objPreferences = (Shell.SharePoint.DREAM.Business.Entities.UserPreferences)objSessionUserPreference; intrecordsPerPage = Convert.ToInt32(objPreferences.RecordsPerPage); } xsltArgsList.AddParam("recordsPerPage", string.Empty, intrecordsPerPage); xsltArgsList.AddParam("AuditListName", string.Empty, AuditListName); if (!(string.Compare(ListReportName, WELLBOOKPAGEVIEW, true) == 0)) { /// <!-- Page Number field --> /// <xsl:param name="pageNumber" select="1" /> if (HttpContext.Current.Request.QueryString["pageNumber"] != null) { intPageNumber = Int32.Parse(HttpContext.Current.Request.QueryString["pageNumber"]); if (blnInitializePageNumber) intPageNumber = 0; } if (HttpContext.Current.Request.QueryString["sortBy"] != null) { strSortBy = HttpContext.Current.Request.QueryString["sortBy"]; } if (HttpContext.Current.Request.QueryString["sortType"] != null) { strSortType = HttpContext.Current.Request.QueryString["sortType"]; } else { strSortType = "descending"; } } else { intPageNumber = string.IsNullOrEmpty(pageNumber) ? 0 : Convert.ToInt32(pageNumber); sortType = string.Equals(sortType, "ASC") ? "ascending" : "descending"; xsltArgsList.AddParam("sortBy", string.Empty, sortBy); xsltArgsList.AddParam("sortType", string.Empty, sortType); if (!(string.IsNullOrEmpty(sortBy)) && !(string.IsNullOrEmpty(sortBy))) { strSortBy = sortBy; } } int intNoofPages = 0; if (intrecordsPerPage > 0) { intNoofPages = noOfRecords / intrecordsPerPage; } if (intPageNumber > intNoofPages) { intPageNumber--; } xsltArgsList.AddParam("pageNumber", string.Empty, intPageNumber); xsltArgsList.AddParam("recordCount", string.Empty, noOfRecords); intMaxPages = 5; xsltArgsList.AddParam("MaxPages", string.Empty, intMaxPages); intCurrentPage = intPageNumber; xsltArgsList.AddParam("CurrentPage", string.Empty, intPageNumber); if (!string.IsNullOrEmpty(HttpContext.Current.Request.Url.Query)) { objCommonUtility = new CommonUtility(); string strURL = GetCurrentPageName(true); xsltArgsList.AddParam("CurrentPageName", string.Empty, strURL); } else { xsltArgsList.AddParam("CurrentPageName", string.Empty, HttpContext.Current.Request.Url.AbsolutePath + "?"); } if (!(string.Compare(ListReportName, WELLBOOKPAGEVIEW, true) == 0)) { xsltArgsList.AddParam("sortBy", string.Empty, strSortBy); xsltArgsList.AddParam("sortType", string.Empty, strSortType); } XmlNode xmlNode = xmlListDocument.SelectSingleNode("records/record/recordInfo/attribute[@name='" + strSortBy + "']"); if (xmlNode != null) { xsltArgsList.AddParam("sortDataType", string.Empty, xmlNode.Attributes["datatype"].Value); } #region DREAM 4.0 - eWB 2.0 - AJAX Implemenation // xslTransform.Transform(objXPathDocument, xsltArgsList, HttpContext.Current.Response.Output); StringBuilder builder = new StringBuilder(); StringWriter stringWriter = new StringWriter(builder); xslTransform.Transform(objXPathDocument, xsltArgsList, stringWriter); strResultTable = stringWriter.GetStringBuilder(); #endregion } else { throw new Exception("Invalid Arguments"); } } catch { throw; } finally { if (objMemoryStream != null) { objMemoryStream.Close(); objMemoryStream.Dispose(); } } }
/// <summary> /// 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; }