Esempio n. 1
0
        private static ItemClass _getItem(XElement rev, string sitem, string srev, string sMasterFormS, string smasterRevFormS)
        {
            //var islandElements = Islands[rev.Attribute("island_id").Value];
            IEnumerable <XElement> Item;

            Islands.TryGetValue(sitem, out Item);
            Item = Item ?? Enumerable.Empty <XElement>();

            try
            {
                ItemClass qItem = (from item in Item
                                   where item.Attribute("puid").Value == rev.Attribute("items_tag").Value
                                   select new ItemClass(item, srev, sMasterFormS, smasterRevFormS)).SingleOrDefault();


                //check if in another island
                if (qItem == null)
                {
                    qItem = (from item in _xml.Elements(_ns + sitem)
                             where item.Attribute("puid").Value == rev.Attribute("items_tag").Value
                             select new ItemClass(item, srev, sMasterFormS, smasterRevFormS)).Single();
                }

                return(qItem);
            }
            catch (System.Exception ex)
            {
                Global._errList.Add(new ErrorList.ErrorInfo(0, ErrorCodes.ITEM_NOT_FOUND, rev.Attribute("puid").Value, srev, TCTypes.ItemRevision, "<" + rev.Attribute("items_tag").Value + ">", rev.Attribute("item_revision_id").Value));

                return(null);
            }
        }