Exemplo n.º 1
0
        static void Main()
        {
            log4net.Config.XmlConfigurator.Configure();
            Logger.Info("INFO");
            Logger.Error("ERROR");
            Logger.Debug("DEBUG");

            BeerstyleWebDao beerstyleDao = new BeerstyleWebDao();
            BeerstyleGroup bsg = new BeerstyleGroup() { BeerstyleGroupKey = "dbj2011" };
            beerstyleDao.GetBeerstyles(bsg);

            IndexCrawlerWebDao indexCrawler = new IndexCrawlerWebDao();
            List<IndexItem> indexItems = indexCrawler.GetIndexItems(2, 0, 25);
            RecipeWebDao recipeDao = new RecipeWebDao();
            List<BeerstyleGroup> beerstyleGroups = recipeDao.GetBeerstyleGroups (indexItems [0]);
            beerstyleDao.GetBeerstyles (beerstyleGroups);
            List<Hop> hopList = recipeDao.GetHops(indexItems[0]);
            List<Malt> maltList = recipeDao.GetMalts(indexItems[0]);
            List<Yeast> yeastList = recipeDao.GetYeasts(indexItems[0]);
            List<Recipe> recipes = recipeDao.GetRecipes(indexItems);
            /*
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
            */
        }
        public List<BeerstyleGroup> Parse(string content)
        {
            List<BeerstyleGroup> results = new List<BeerstyleGroup> ();

            String styleContent = content.Substring ("Style Guide:", "</select>");

            List<string> styleValues = styleContent.Substrings("<option", "</option>");

            foreach (string styleValue in styleValues)
            {
                string name = styleValue.Substring(">");
                string value = styleValue.Substring ("value=\"", "\"");

                if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value))
                {
                    BeerstyleGroup bsg = new BeerstyleGroup () {
                        BeerstyleGroupName = name,
                        BeerstyleGroupKey = value
                    };
                    results.Add (bsg);
                }
            }

            return results;
        }
 public void GetBeerstyles(BeerstyleGroup beerstyleGroup)
 {
     beerstyleGroup.Beerstyles = GetBeerstyles(beerstyleGroup.BeerstyleGroupKey);
 }