示例#1
0
 /// <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;
     }
 }
示例#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;
     }
 }
示例#3
0
 /// <summary>
 /// Loads the save search.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="comboBoxControl">The combo box control.</param>
 public void LoadSaveSearch(string searchType, DropDownList comboBoxControl)
 {
     objSaveSearchHandler = new SaveSearchHandler();
     try
     {
         objSaveSearchHandler.LoadSaveSearch(searchType, comboBoxControl);
     }
     catch(Exception)
     {
         throw;
     }
 }
示例#4
0
 /// <summary>
 /// Determines whether [is doc lib file exist] [the specified doc lib name].
 /// </summary>
 /// <param name="docLibName">Name of the doc lib.</param>
 /// <param name="userID">The user ID.</param>
 /// <returns>
 /// 	<c>true</c> if [is doc lib file exist] [the specified doc lib name]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsDocLibFileExist(string docLibName, string userID)
 {
     objSaveSearchHandler = new SaveSearchHandler();
     bool blnIsDocLibFileExist = false;
     try
     {
         blnIsDocLibFileExist = objSaveSearchHandler.IsDocLibFileExist(docLibName, userID);
     }
     catch(Exception)
     {
         throw;
     }
     return blnIsDocLibFileExist;
 }
示例#5
0
 /// <summary>
 /// Determines whether [is doc lib exist] [the specified doc lib name].
 /// </summary>
 /// <param name="docLibName">Name of the doc lib.</param>
 /// <param name="currentSiteUrl">The current site URL.</param>
 /// <returns>
 /// 	<c>true</c> if [is doc lib exist] [the specified doc lib name]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsDocLibExist(string docLibName, string currentSiteUrl)
 {
     objSaveSearchHandler = new SaveSearchHandler();
     return objSaveSearchHandler.IsDocLibExist(docLibName, currentSiteUrl);
 }
示例#6
0
 /// <summary>
 /// Gets the name of the shared save search.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <returns></returns>
 public ArrayList GetSharedSaveSearchName(string searchType, string userID, bool fetchAll)
 {
     ArrayList arlListSaveSearch = new ArrayList();
     objSaveSearchHandler = new SaveSearchHandler();
     try
     {
         //get the shared save search names based on the search type.
         arlListSaveSearch = objSaveSearchHandler.GetSharedSaveSearchName(searchType, userID, fetchAll);
     }
     catch(Exception)
     {
         throw;
     }
     return arlListSaveSearch;
 }
示例#7
0
 /// <summary>
 /// Gets the save order number.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <returns></returns>
 public ArrayList GetSaveOrderNumber(string searchType, string userID)
 {
     ArrayList arlListSaveSearch = new ArrayList();
     objSaveSearchHandler = new SaveSearchHandler();
     try
     {
         arlListSaveSearch = objSaveSearchHandler.GetSaveOrderNumber(searchType, userID);
     }
     catch(Exception)
     {
         throw;
     }
     return arlListSaveSearch;
 }
示例#8
0
 /// <summary>
 /// Gets the doc lib XML file.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <returns></returns>
 public XmlDocument GetDocLibXMLFile(string searchType, string userID)
 {
     XmlDocument objXmlDocument = new XmlDocument();
     objSaveSearchHandler = new SaveSearchHandler();
     try
     {
         objXmlDocument = objSaveSearchHandler.GetDocLibXMLFile(searchType, userID);
     }
     catch(Exception)
     {
         throw;
     }
     return objXmlDocument;
 }
示例#9
0
 /// <summary>
 /// Gets the admin save search XML.
 /// </summary>
 /// <param name="searchType">Type of the search.</param>
 /// <param name="userID">The user ID.</param>
 /// <param name="strSaveSearchName">Name of the STR save search.</param>
 /// <returns></returns>
 public XmlDocument GetAdminSaveSearchXML(string searchType, string userID, string saveSearchName)
 {
     XmlDocument objXmlDocument = new XmlDocument();
     objSaveSearchHandler = new SaveSearchHandler();
     try
     {
         objXmlDocument = objSaveSearchHandler.GetAdminSaveSearchXML(searchType, userID, saveSearchName);
     }
     catch(Exception)
     {
         throw;
     }
     return objXmlDocument;
 }
示例#10
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;
     }
 }
示例#11
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;
     }
 }
示例#12
0
        /// <summary>
        /// Creates the save 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="searchRequestXML">The search request XML.</param>
        /// <param name="saveSearchRequestInformation">The save search request object.</param>
        /// <returns></returns>
        private XmlDocument CreateSaveSearch(string searchName, string searchType, string userID, XmlDocument searchRequestXML, string searchOrder, SaveSearchRequest saveSearchRequestInformation)
        {
            ArrayList arlSaveOrderNumber = new ArrayList();
            XmlDocument objXmlFinalDoc = new XmlDocument();
            XmlDocument objXmlRootDoc = new XmlDocument();
            string strSaveSearchLimit = string.Empty;
            SaveSearchHandler objSaveSearchHandler = new SaveSearchHandler();
            try
            {

                     strSaveSearchLimit = PortalConfiguration.GetInstance().GetKey("SaveSearchLimit");
                     if (!objSaveSearchHandler.IsDocLibFileExist(searchType, userID))
                     {
                         objXmlRootDoc = CreateSaveSearchOuterXML();
                         objXmlFinalDoc = AppendInnerToOuterXML(objXmlRootDoc, searchRequestXML, searchName, searchOrder, saveSearchRequestInformation);
                     }
                     else
                     {
                         arlSaveOrderNumber = objSaveSearchHandler.GetSaveOrderNumber(searchType, userID);
                         if (arlSaveOrderNumber.Contains(strSaveSearchLimit))
                         {
                             //throw Exception message : Save Search Criteria Exceeds the limit..
                             throw new Exception("You have exceeded the Save Search Criteria Limit. Please contact administrator.");
                         }
                         else
                         {
                             objXmlRootDoc = objSaveSearchHandler.GetDocLibXMLFile(searchType, userID);
                             if (objSaveSearchHandler.IsDuplicateExists(searchRequestXML, objXmlRootDoc))
                             {
                                 //throw Exception message : Duplicate Criteria name Exist..
                                 throw new Exception("Save Search criteria already exist. Please choose a different criteria.");
                             }
                             else
                             {
                                 objXmlFinalDoc = AppendInnerToOuterXML(objXmlRootDoc, searchRequestXML, searchName, searchOrder, saveSearchRequestInformation);
                             }
                         }
                     }//end if

            }//end Try

            catch (Exception)
            {
                throw;
            }
            return objXmlFinalDoc;
        }