Example #1
0
        public void GetResortPage(string countryName, string resortUrl)
        {
            string[] arrUrl = resortUrl.Split(',');
            string   html   = GetPage(arrUrl[0]);
            string   tmp;
            Resort   resort = new Resort();

            resort.Name = arrUrl[1].Replace(" - ", "-");
            Country country = new Country();

            country.CountryName = countryName;
            resort.Country      = country;
            ResortStats stats = new ResortStats();

            stats.GreenRuns = GetValue(html, "Beginner Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");
            stats.BlueRuns  = GetValue(html, "Intermediate Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");
            stats.RedRuns   = GetValue(html, "Advanced Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");
            stats.BlackRuns = GetValue(html, "Expert Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");

            stats.LiftTotal     = GetValue(html, "Total # Of Lifts\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.GondolaCount  = GetValue(html, "Gondolas & Trams\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.QuadPlusCount = GetValue(html, "High Speed Sixes\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            int quads = 0;

            tmp                   = GetValue(html, "High Speed Quads\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            quads                 = (string.IsNullOrEmpty(tmp)) ? 0 : int.Parse(tmp);
            tmp                   = GetValue(html, "Quad Chairs\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            quads                += (string.IsNullOrEmpty(tmp)) ? 0 : int.Parse(tmp);
            stats.QuadCount       = (quads == 0) ? string.Empty : quads.ToString();
            stats.TripleCount     = GetValue(html, "Triple Chairs\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.DoubleCount     = GetValue(html, "Double Chairs\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.SurfaceCount    = GetValue(html, "Surface Lifts\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.AverageSnowfall = GetValue(html, "Average Snowfall\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)  cm</strong>");


            stats.TopLevel           = GetValue(html, "Top: <strong>(?<VALUE>.+?) m</strong>");
            stats.VerticalDrop       = GetValue(html, "Vertical Drop: <strong>(?<VALUE>.+?) m</strong>");
            stats.BaseLevel          = GetValue(html, "Bottom: <strong>(?<VALUE>.+?) m</strong>");
            stats.LongestRunDistance = GetValue(html, "Longest Run: <strong>(?<VALUE>.+?) km</strong>");
            decimal hectares = 0;

            tmp = GetValue(html, "Longest Run: <strong>(?<VALUE>.+?) km</strong>");
            if (!tmp.Contains("N/A"))
            {
                hectares = (string.IsNullOrEmpty(tmp)) ? 0 : decimal.Parse(tmp);
                decimal metres = hectares * 10000;
                stats.SkiableTerrianSize = metres.ToString();
            }
            stats.SnowmakingCoverage = GetValue(html, "Snow Making: <strong>(?<VALUE>.+?) km</strong>");

            //insert
            int retid = ResortDataManager.AddScrapeResortStats(resort, stats);
        }
Example #2
0
        public static int AddScrapeResortStats(Resort resort, ResortStats resortStats)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQL2005_615410_sporthubConnectionString"].ConnectionString);
            //SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog=SQL2005_615410_sporthub;Persist Security Info=True;User ID=sa;Integrated Security=True");
            SqlCommand cmd = new SqlCommand("AddScrapeResortStats", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@Name", resort.Name));
            cmd.Parameters.Add(new SqlParameter("@PrettyUrl", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@CountryName", resort.Country.CountryName));
            cmd.Parameters.Add(new SqlParameter("@BaseLevel", resortStats.BaseLevel));
            cmd.Parameters.Add(new SqlParameter("@TopLevel", resortStats.TopLevel));
            cmd.Parameters.Add(new SqlParameter("@VerticalDrop", resortStats.VerticalDrop));
            cmd.Parameters.Add(new SqlParameter("@Height", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@AverageSnowfall", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@HasSnowmaking", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SnowmakingCoverage", resortStats.SnowmakingCoverage));
            cmd.Parameters.Add(new SqlParameter("@PreSeasonStartMonth", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SeasonStartMonth", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SeasonEndMonth", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@Population", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@MountainRestaurants", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@LiftDescription", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@LiftTotal", resortStats.LiftTotal));
            cmd.Parameters.Add(new SqlParameter("@LiftCapacityHour", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@QuadPlusCount", resortStats.QuadPlusCount));
            cmd.Parameters.Add(new SqlParameter("@QuadCount", resortStats.QuadCount));
            cmd.Parameters.Add(new SqlParameter("@TripleCount", resortStats.TripleCount));
            cmd.Parameters.Add(new SqlParameter("@DoubleCount", resortStats.DoubleCount));
            cmd.Parameters.Add(new SqlParameter("@SingleCount", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SurfaceCount", resortStats.SurfaceCount));
            cmd.Parameters.Add(new SqlParameter("@GondolaCount", resortStats.GondolaCount));
            cmd.Parameters.Add(new SqlParameter("@FunicularCount", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SurfaceTrainCount", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@RunTotal", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@BlackRuns", resortStats.BlackRuns));
            cmd.Parameters.Add(new SqlParameter("@RedRuns", resortStats.RedRuns));
            cmd.Parameters.Add(new SqlParameter("@BlueRuns", resortStats.BlueRuns));
            cmd.Parameters.Add(new SqlParameter("@GreenRuns", resortStats.GreenRuns));
            cmd.Parameters.Add(new SqlParameter("@LongestRunDistance", resortStats.LongestRunDistance));
            cmd.Parameters.Add(new SqlParameter("@SkiableTerrianSize", resortStats.SkiableTerrianSize));

            conn.Open();

            string resortLinkID = cmd.ExecuteScalar().ToString();

            return(int.Parse(resortLinkID));
        }
Example #3
0
        public static int AddScrapeResortStats(Resort resort, ResortStats resortStats)
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQL2005_615410_sporthubConnectionString"].ConnectionString);
            //SqlConnection conn = new SqlConnection("Data Source=localhost;Initial Catalog=SQL2005_615410_sporthub;Persist Security Info=True;User ID=sa;Integrated Security=True");
            SqlCommand cmd = new SqlCommand("AddScrapeResortStats", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@Name", resort.Name));
            cmd.Parameters.Add(new SqlParameter("@PrettyUrl", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@CountryName", resort.Country.CountryName));
            cmd.Parameters.Add(new SqlParameter("@BaseLevel", resortStats.BaseLevel));
            cmd.Parameters.Add(new SqlParameter("@TopLevel", resortStats.TopLevel));
            cmd.Parameters.Add(new SqlParameter("@VerticalDrop", resortStats.VerticalDrop));
            cmd.Parameters.Add(new SqlParameter("@Height", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@AverageSnowfall", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@HasSnowmaking", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SnowmakingCoverage", resortStats.SnowmakingCoverage));
            cmd.Parameters.Add(new SqlParameter("@PreSeasonStartMonth", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SeasonStartMonth", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SeasonEndMonth", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@Population", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@MountainRestaurants", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@LiftDescription", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@LiftTotal", resortStats.LiftTotal));
            cmd.Parameters.Add(new SqlParameter("@LiftCapacityHour", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@QuadPlusCount", resortStats.QuadPlusCount));
            cmd.Parameters.Add(new SqlParameter("@QuadCount", resortStats.QuadCount));
            cmd.Parameters.Add(new SqlParameter("@TripleCount", resortStats.TripleCount));
            cmd.Parameters.Add(new SqlParameter("@DoubleCount", resortStats.DoubleCount));
            cmd.Parameters.Add(new SqlParameter("@SingleCount", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SurfaceCount", resortStats.SurfaceCount));
            cmd.Parameters.Add(new SqlParameter("@GondolaCount", resortStats.GondolaCount));
            cmd.Parameters.Add(new SqlParameter("@FunicularCount", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@SurfaceTrainCount", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@RunTotal", string.Empty));
            cmd.Parameters.Add(new SqlParameter("@BlackRuns", resortStats.BlackRuns));
            cmd.Parameters.Add(new SqlParameter("@RedRuns", resortStats.RedRuns));
            cmd.Parameters.Add(new SqlParameter("@BlueRuns", resortStats.BlueRuns));
            cmd.Parameters.Add(new SqlParameter("@GreenRuns", resortStats.GreenRuns));
            cmd.Parameters.Add(new SqlParameter("@LongestRunDistance", resortStats.LongestRunDistance));
            cmd.Parameters.Add(new SqlParameter("@SkiableTerrianSize", resortStats.SkiableTerrianSize));

            conn.Open();

            string resortLinkID = cmd.ExecuteScalar().ToString();

            return int.Parse(resortLinkID);
        }
Example #4
0
        public void GetResortPage(string countryName, string resortUrl)
        {
            string[] arrUrl = resortUrl.Split(',');
            string html = GetPage(arrUrl[0]);
            string tmp;
            Resort resort = new Resort();
            resort.Name = arrUrl[1].Replace(" - ", "-");
            Country country = new Country();
            country.CountryName = countryName;
            resort.Country = country;
            ResortStats stats = new ResortStats();
            stats.GreenRuns = GetValue(html, "Beginner Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");
            stats.BlueRuns = GetValue(html, "Intermediate Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");
            stats.RedRuns = GetValue(html, "Advanced Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");
            stats.BlackRuns = GetValue(html, "Expert Runs\" border=\"0\" />(?<VALUE>.+?)%</strong>");

            stats.LiftTotal = GetValue(html, "Total # Of Lifts\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.GondolaCount = GetValue(html, "Gondolas & Trams\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.QuadPlusCount = GetValue(html, "High Speed Sixes\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            int quads = 0;
            tmp = GetValue(html, "High Speed Quads\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            quads = (string.IsNullOrEmpty(tmp)) ? 0 : int.Parse(tmp);
            tmp = GetValue(html, "Quad Chairs\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            quads += (string.IsNullOrEmpty(tmp)) ? 0 : int.Parse(tmp);
            stats.QuadCount = (quads == 0) ? string.Empty : quads.ToString();
            stats.TripleCount = GetValue(html, "Triple Chairs\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.DoubleCount = GetValue(html, "Double Chairs\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.SurfaceCount = GetValue(html, "Surface Lifts\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)</strong>");
            stats.AverageSnowfall = GetValue(html, "Average Snowfall\" border=\"0\" align=\"absmiddle\" />(?<VALUE>.+?)  cm</strong>");

            stats.TopLevel = GetValue(html, "Top: <strong>(?<VALUE>.+?) m</strong>");
            stats.VerticalDrop = GetValue(html, "Vertical Drop: <strong>(?<VALUE>.+?) m</strong>");
            stats.BaseLevel = GetValue(html, "Bottom: <strong>(?<VALUE>.+?) m</strong>");
            stats.LongestRunDistance = GetValue(html, "Longest Run: <strong>(?<VALUE>.+?) km</strong>");
            decimal hectares = 0;
            tmp = GetValue(html, "Longest Run: <strong>(?<VALUE>.+?) km</strong>");
            if (!tmp.Contains("N/A"))
            {
                hectares = (string.IsNullOrEmpty(tmp)) ? 0 : decimal.Parse(tmp);
                decimal metres = hectares * 10000;
                stats.SkiableTerrianSize = metres.ToString();
            }
            stats.SnowmakingCoverage = GetValue(html, "Snow Making: <strong>(?<VALUE>.+?) km</strong>");

            //insert
            int retid = ResortDataManager.AddScrapeResortStats(resort, stats);
        }