/// <summary>
 /// Saves the search.
 /// </summary>
 /// <param name="searchName">Name of the search.</param>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <param name="SearchRequestsXML">The search requests XML.</param>
 /// <param name="saveSearchRequestInformation">The save search request object.</param>
 public void SaveSearch(string searchName, string searchType, string userID, XmlDocument SearchRequestsXML, string searchOrder, SaveSearchRequest saveSearchRequestInformation)
 {
     try
     {
         //The commented code will be removed in next release
         //SPSecurity.RunWithElevatedPrivileges(delegate()
         // {
              SaveSearchHandler objSaveSearchHandler = new SaveSearchHandler();
              //creates the xmlDocument for save search.
              XmlDocument objXmldocumentFinal = CreateSaveSearch(searchName, searchType, userID, SearchRequestsXML, searchOrder, saveSearchRequestInformation);
              if (objXmldocumentFinal != null)
                  objSaveSearchHandler.UploadToDocumentLib(searchType, userID, objXmldocumentFinal);
         // });
     }
     catch (Exception)
     {
         throw;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Deletes the save search.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <param name="saveSearchName">Name of the save search.</param>
 public void ModifySaveSearch(string searchType, string userID, string saveSearchName, XmlDocument updatedXmlDocument, string shared)
 {
     XmlDocument xmlSaveSearchDoc = null;
     XmlNodeList xmlnodelistSaveSearch;
     try
     {
         objSaveSearchHandler = new SaveSearchHandler();
         //Gets the Xml Document for the current user.
         xmlSaveSearchDoc = GetDocLibXMLFile(searchType, userID);
         if(xmlSaveSearchDoc != null)
         {
             xmlnodelistSaveSearch = xmlSaveSearchDoc.SelectNodes(SAVESEARCHXSLPATH);
             foreach(XmlNode xmlNodeSaveSearch in xmlnodelistSaveSearch)
             {
                 //Checks whether the name of the XmlNode is equals to the SaveSearch Name user has selected to delete.
                 if(string.Compare(xmlNodeSaveSearch.Attributes.GetNamedItem("name").Value.ToString(), saveSearchName) == 0)
                 {
                     xmlNodeSaveSearch.RemoveChild(xmlNodeSaveSearch.FirstChild);
                     xmlNodeSaveSearch.Attributes.GetNamedItem("shared").Value = shared;
                     xmlNodeSaveSearch.InnerXml = updatedXmlDocument.OuterXml;
                     if(updatedXmlDocument.SelectSingleNode(ENTITYPATH).Attributes[ATTRITYPE] != null)
                     {
                         string strType = updatedXmlDocument.SelectSingleNode(ENTITYPATH).Attributes[ATTRITYPE].Value;
                         xmlNodeSaveSearch.Attributes.GetNamedItem(ATTRITYPE).Value = strType;
                     }
                 }
             }
             XmlDocument xmlDoc = new XmlDocument();
             xmlDoc.LoadXml(xmlSaveSearchDoc.OuterXml);
             if(xmlDoc != null)
                 objSaveSearchHandler.UploadToDocumentLib(searchType, userID, xmlDoc);
         }
     }
     catch(Exception Ex)
     {
         throw Ex;
     }
 }
Beispiel #3
0
 /// <summary>
 /// Deletes the save search.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <param name="saveSearchName">Name of the save search.</param>
 public void DeleteSaveSearch(string searchType, string userID, string saveSearchName)
 {
     XmlDocument xmlSaveSearchDoc = null;
     XmlNodeList xmlnodelistSaveSearch;
     int intSearchOrderCount = 0;
     try
     {
         objSaveSearchHandler = new SaveSearchHandler();
         //Gets the Xml Document for the current user.
         xmlSaveSearchDoc = GetDocLibXMLFile(searchType, userID);
         if(xmlSaveSearchDoc != null)
         {
             xmlnodelistSaveSearch = xmlSaveSearchDoc.SelectNodes(SAVESEARCHXSLPATH);
             foreach(XmlNode xmlNodeSaveSearch in xmlnodelistSaveSearch)
             {
                 //Checks whether the name of the XmlNode is equals to the SaveSearch Name user has selected to delete.
                 if(string.Compare(xmlNodeSaveSearch.Attributes.GetNamedItem("name").Value.ToString(), saveSearchName) == 0)
                 {
                     xmlSaveSearchDoc.DocumentElement.RemoveChild(xmlNodeSaveSearch);
                     intSearchOrderCount++;
                 }
                 if(intSearchOrderCount > 0)
                 {
                     if(xmlNodeSaveSearch.Attributes.GetNamedItem("order") != null)
                     {
                         int intOrder = Convert.ToInt32(xmlNodeSaveSearch.Attributes.GetNamedItem("order").Value.ToString());
                         intOrder = intOrder - 1;
                         xmlNodeSaveSearch.Attributes.GetNamedItem("order").Value = intOrder.ToString();
                     }
                 }
             }
             XmlDocument xmlDoc = new XmlDocument();
             xmlDoc.LoadXml(xmlSaveSearchDoc.OuterXml);
             if(xmlSaveSearchDoc != null)
                 objSaveSearchHandler.UploadToDocumentLib(searchType, userID, xmlDoc);
         }
     }
     catch(Exception Ex)
     {
         throw Ex;
     }
 }
Beispiel #4
0
 /// <summary>
 /// Uploads to document lib.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <param name="finalDocument">The final document.</param>
 public void UploadToDocumentLib(string searchType, string userID, XmlDocument finalDocument)
 {
     objSaveSearchHandler = new SaveSearchHandler();
     try
     {
         if(finalDocument != null)
         {
             objSaveSearchHandler.UploadToDocumentLib(searchType, userID, finalDocument);
         }
     }
     catch(Exception)
     {
         throw;
     }
 }