Exemple #1
0
        /// <summary>
        /// Creates a BOOKMARKS object
        /// </summary>
        /// <param name="searchType">Type of the search.</param>
        /// <returns></returns>
        private BookMarks SetQuickBookMarks(string searchType)
        {
            BookMarks objRootNode = new BookMarks();
            BookMark objBookMark = null;
            Value objValue;
            ArrayList arlBookMark = new ArrayList();

            strAssetIdentifier = HttpContext.Current.Request.Form["hidSelectedCriteriaName"].ToString();

            objBookMark = new BookMark();
            objBookMark.BookMarkType = searchType;
            objBookMark.IdentifierName = strAssetIdentifier;

            if (!arlBookMark.Contains(objBookMark))
                arlBookMark.Add(objBookMark);

            string[] arrMyAssetVal = SelectedIdentifiers;
            ArrayList arlValue = null;

            foreach (string strAssetVal in arrMyAssetVal)
            {
                if (strAssetVal.Trim().Length > 0)
                {
                    if (objBookMark.Value == null)
                    {
                        arlValue = new ArrayList();
                    }
                    else
                        arlValue = objBookMark.Value;

                    objValue = new Value();
                    objValue.InnerText = strAssetVal.Trim();

                    if (!arlValue.Contains(objValue))
                        arlValue.Add(objValue);

                    objBookMark.Value = arlValue;
                }
            }

            objRootNode.BookMark = arlBookMark;
            return objRootNode;
        }
        /// <summary>
        /// Recursively creates Value nodes in the respective BookMark Node
        /// </summary>
        /// <param name="bookMark"></param>
        /// <param name="BookMarkNode"></param>
        private void CreateBookMarkValue(BookMark bookMark, XmlNode bookMarkNode)
        {
            try
            {
                if (bookMark.Value != null)
                {
                    XmlNode rootNode = objXmlDocument.DocumentElement;

                    foreach (Value objValue in bookMark.Value)
                    {
                        XmlNode ValueNode = rootNode.SelectSingleNode("BookMark[value='" + objValue.InnerText + "']");
                        if (ValueNode == null)
                        {
                            XmlElement BookMarkValueElement = objXmlDocument.CreateElement(VALUE);
                            XmlNode BookMarkValueNode = bookMarkNode.AppendChild(BookMarkValueElement);
                            BookMarkValueNode.InnerText = objValue.InnerText;
                        }
                    }
                }
            }
            catch
            {
                throw;
            }
        }