Beispiel #1
0
        public static CacheMetaData ParseXml(string xml)
        {
            try
            {
                CacheMetaData metaData = new CacheMetaData();

                // get the root element
                XmlDocument document = new XmlDocument();
                document.LoadXml(xml);
                XmlElement rootElement = document.SelectSingleNode(metaDataTag) as XmlElement;

                // get the users
                XmlElement  usersElement = rootElement.SelectSingleNode(usersTag) as XmlElement;
                XmlNodeList nodes        = usersElement.GetElementsByTagName(userTag);
                if ((nodes != null) && (nodes.Count > 0))
                {
                    foreach (XmlNode userNode in nodes)
                    {
                        XmlElement userElement     = userNode as XmlElement;
                        XmlElement userIDElement   = userElement.SelectSingleNode(userIdTag) as XmlElement;
                        int        userID          = int.Parse(userIDElement.InnerText);
                        XmlElement userNameElement = userElement.SelectSingleNode(userNameTag) as XmlElement;
                        string     userName        = userNameElement.InnerText;
                        metaData.AddUser(userID, userName);
                    }
                }

                // get the note types
                XmlElement noteTypesElement = rootElement.SelectSingleNode(noteTypesTag) as XmlElement;
                nodes = noteTypesElement.GetElementsByTagName(noteTypeTag);
                if ((nodes != null) && (nodes.Count > 0))
                {
                    foreach (XmlNode noteTypeNode in nodes)
                    {
                        XmlElement noteTypeElement            = noteTypeNode as XmlElement;
                        XmlElement noteTypeIDElement          = noteTypeElement.SelectSingleNode(noteTypeIdTag) as XmlElement;
                        int        noteTypeID                 = int.Parse(noteTypeIDElement.InnerText);
                        XmlElement noteTypeDescriptionElement = noteTypeElement.SelectSingleNode(noteTypeDescriptionTag) as XmlElement;
                        string     description                = noteTypeDescriptionElement.InnerText;
                        metaData.AddNoteType(noteTypeID, description);
                    }
                }

                return(metaData);
            }
            catch
            {
                return(null);
            }
        }
Beispiel #2
0
        private CacheMetaData createDefaultMetaData()
        {
            // this data can change over time in the DB but we need initial data
            // so we use this snapshot which is valid as of July 23, 2011
            CacheMetaData metaData = new CacheMetaData();

            metaData.AddNoteType(1, "INTERNAL");
            metaData.AddNoteType(2, "NOTE TO EXPEDITOR");
            metaData.AddNoteType(3, "NOTE FROM EXPEDITOR");
            metaData.AddNoteType(4, "CALL TO CUSTOMER HOME");
            metaData.AddNoteType(5, "CALL TO CUSTOMER WORK");
            metaData.AddNoteType(6, "CALL TO CUSTOMER ALL NOS.");
            metaData.AddNoteType(7, "CALL FROM CUSTOMER");
            metaData.AddNoteType(8, "CALL TO STORE");
            metaData.AddNoteType(9, "CALL FROM STORE");
            metaData.AddNoteType(10, "FAX TO STORE");
            metaData.AddNoteType(11, "FAX FROM STORE");
            metaData.AddNoteType(12, "INFORMATION ONLY");
            metaData.AddNoteType(13, "CALL TO INSTALLER");
            metaData.AddNoteType(14, "CALL FROM INSTALLER");
            metaData.AddNoteType(15, "MANAGER ACTION");
            metaData.AddNoteType(16, "CALL TO CUSTOMER MOBILE");

            metaData.AddUser(3, "hillary");
            metaData.AddUser(6, "dbartram");
            metaData.AddUser(7, "kendra2");
            metaData.AddUser(9, "rosie");
            metaData.AddUser(10, "monica");
            metaData.AddUser(11, "michael");
            metaData.AddUser(12, "carri");
            metaData.AddUser(14, "paul");
            metaData.AddUser(20, "administrator");
            metaData.AddUser(23, "mbone");
            metaData.AddUser(38, "cpace");
            metaData.AddUser(39, "abaker");
            metaData.AddUser(41, "cbarker");
            metaData.AddUser(50, "twalker");
            metaData.AddUser(57, "chendrix");
            metaData.AddUser(58, "cparris");
            metaData.AddUser(59, "thazel");
            metaData.AddUser(67, "cmckee");
            metaData.AddUser(69, "jthai");
            metaData.AddUser(70, "dprice");
            metaData.AddUser(72, "bdunn");
            metaData.AddUser(75, "athai");
            metaData.AddUser(76, "ahansen");
            metaData.AddUser(80, "vesparza");
            metaData.AddUser(81, "tweaver");
            metaData.AddUser(84, "lwalker");
            metaData.AddUser(85, "lbrown");
            metaData.AddUser(86, "cyoung");
            metaData.AddUser(88, "ntodaro");
            metaData.AddUser(89, "bcataneo");
            metaData.AddUser(90, "rstewart");

            return(metaData);
        }