Exemplo n.º 1
0
        public List<DndFeat> GetFeat(string id)
        {
            long longId;
            FeatQuery fq = new FeatQuery();
            List<DndFeat> featdb = new List<DndFeat>();

            if (long.TryParse(id, out longId) == true)
            {
                featdb = fq.Query_dndFeatByID(longId);
            }
            else
            {
                if (id.IndexOf(' ') > 0) {
                    featdb = fq.Query_dndFeatByName(id);
                }
                else
                {
                    featdb = fq.Query_dndFeatBySlug(id);
                }
            }

            if (featdb != null)
            {
                Console.WriteLine(string.Format("log - get feat - ({0}) ", id));
            };
            return featdb;
        }
Exemplo n.º 2
0
        public FeatTree GetFeatRequirements(string id)
        {
            FeatQuery fq = new FeatQuery();

            List<DndFeat> feat = GetFeat(id);
            List<DndFeatrequiresfeat> queryRequired = fq.Query_dndFeatRequiredFeat(feat.First().Id);
            List<DndFeatrequiresfeat> queryRequiredBy = fq.Query_dndFeatRequiredBy(feat.First().Id);
            FeatTree data = new FeatTree();

            data.RootFeatid = feat.First().Id;
            data.RootFeatName = feat.First().Name;

            foreach (var item in queryRequired)
            {
                var thisfeat = GetFeat(item.Id.ToString());
                foreach (var each in thisfeat)
                {
                    var bf = new BasicFeat
                    {
                        id = each.Id,
                        name = each.Name
                    };
                    data.requiredFeats.Add(bf);
                }
            }

            foreach (var item in queryRequiredBy)
            {
                var thisfeat = GetFeat(item.Id.ToString());
                foreach (var each in thisfeat)
                {
                    var bf = new BasicFeat
                    {
                        id = each.Id,
                        name = each.Name
                    };
                    data.FeatsRequiredBy.Add(bf);

                }
            }

            return data;
        }