Esempio n. 1
0
        /// <summary>
        /// Saves my assets.
        /// </summary>
        /// <param name="bookMarks">The book marks.</param>
        /// <param name="userID">The user ID.</param>
        /// <returns></returns>
        public XmlDocument SaveMyAssets(BookMarks bookMarks, string identifier,string listName)
        {
            try
            {
                objXmlDocument = new XmlDocument();
                objXmlDocument = ReadMyAssetXML(identifier, listName);

                if (objXmlDocument.DocumentElement != null)
                {
                    // Xml File saved earlier
                    objXmlDocument = UpdateMyAssetXML(bookMarks);

                }
                else
                {
                    //Calling the Create Xml File method.
                    objXmlDocument = CreateMyAssetXML(bookMarks);
                }
                objSaveSearchHandler.UploadToDocumentLib(listName, identifier, objXmlDocument);
            }
            catch (Exception)
            {
                throw;
            }
            return objXmlDocument;
        }
Esempio n. 2
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;
        }
Esempio n. 3
0
        /// <summary>
        /// Updates the existing My Asset XML
        /// </summary>
        /// <param name="objBookMarks"></param>
        /// <returns></returns>
        private XmlDocument UpdateMyAssetXML(BookMarks bookMarks)
        {
            try
            {
                XmlNode BookMarksNode = objXmlDocument.DocumentElement;
                XmlNode BookMarkNode = null;

                foreach (BookMark objBookMark in bookMarks.BookMark)
                {
                    switch (objBookMark.BookMarkType.ToLower())
                    {
                        case ASSETWELL:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Well']");
                                break;
                            }
                        case ASSETWELLBORE:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Wellbore']");
                                break;
                            }
                        case ASSETBASIN:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Basin']");
                                break;
                            }
                        case ASSETFIELD:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Field']");
                                break;
                            }
                        case ASSETPARS:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Project Archives']");
                                break;
                            }
                        case ASSETLOGSBYFIELD:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Logs By Field Depth']");
                                break;
                            }
                        case ASSETRESERVOIR:
                            {
                                BookMarkNode = BookMarksNode.SelectSingleNode("BookMark[@type='Reservoir']");
                                break;
                            }
                    }

                    if (objBookMark.Value != null)
                    {

                        if (BookMarkNode == null)
                        {
                            BookMarkNode = CreateBookMark(bookMarks, BookMarksNode);
                        }
                        else
                        {
                            CreateBookMarkValue(objBookMark, BookMarkNode);
                        }
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return objXmlDocument;
        }
Esempio n. 4
0
        /// <summary>
        /// Builds the My Asset XML
        /// </summary>
        /// <param name="objbookMarks"></param>
        /// <returns></returns>
        private XmlDocument CreateRootElement(BookMarks bookMarks)
        {
            try
            {
                //Creating the root Xml Element BookMarks.
                XmlElement BookMarksElement = objXmlDocument.CreateElement(BOOKMARKS);
                objXmlDocument.AppendChild(BookMarksElement);

                XmlNode BookMarksNode = objXmlDocument.DocumentElement;

                if (bookMarks.BookMark != null)
                {
                    CreateBookMark(bookMarks, BookMarksNode);
                }
            }
            catch (Exception)
            {
                throw;
            }
            //returns the final My Asset Xml.
            return objXmlDocument;
        }
Esempio n. 5
0
 /// <summary>
 /// Builds the My Asset XML
 /// </summary>
 /// <param name="objBookMarks"></param>
 /// <returns></returns>
 private XmlDocument CreateMyAssetXML(BookMarks bookMarks)
 {
     try
     {
         return CreateRootElement(bookMarks);
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 6
0
        /// <summary>
        /// Creates BookMark node in the My Asset XML
        /// </summary>
        /// <param name="objbookMarks"></param>
        /// <param name="BookMarksNode"></param>
        /// <returns></returns>
        private XmlNode CreateBookMark(BookMarks bookMarks,XmlNode bookMarksNode)
        {
            XmlNode BookMarkNode = null;
            string strType = string.Empty;
            string strIdentifierName = string.Empty;

            try
            {
                foreach (BookMark objBookMark in bookMarks.BookMark)
                {
                    strType = objBookMark.BookMarkType;
                    strIdentifierName = objBookMark.IdentifierName;
                    //Method call to create BookMark Node.
                    XmlElement BookMarkElement = objXmlDocument.CreateElement(BOOKMARK);
                    ///create attribute for BookMark node
                    XmlAttribute BookMarkTypeAttribute = objXmlDocument.CreateAttribute(TYPE);
                    strType = strType.Replace("_", " ");
                    BookMarkTypeAttribute.InnerText = strType;
                    BookMarkElement.Attributes.Append(BookMarkTypeAttribute);
                    XmlAttribute BookMarkNameAttribute = objXmlDocument.CreateAttribute(IDENTIFIERNAME);
                    BookMarkNameAttribute.InnerText = strIdentifierName;
                    BookMarkElement.Attributes.Append(BookMarkNameAttribute);

                    BookMarkNode = SetNodeOrder(objBookMark.BookMarkType, BookMarkNode, bookMarksNode, BookMarkElement);
                    ///reset the child nodes.
                    CreateBookMarkValue(objBookMark, BookMarkNode);
                }
                return BookMarkNode;
            }
            catch
            {
                throw;
            }
        }