Esempio n. 1
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);
        }
Esempio n. 2
0
        private static void UpdateResort(Resort resort, ScrapeResort scrape, ResortService resortService)
        {
            resort.ResortStats.BaseLevel = scrape.BaseLevel;
            resort.ResortStats.TopLevel = scrape.TopLevel;
            resort.ResortStats.VerticalDrop = scrape.VerticalDrop;

            resort.ResortStats.LiftTotal = scrape.LiftTotal;
            resort.ResortStats.QuadPlusCount = scrape.QuadPlusCount;
            resort.ResortStats.QuadCount = scrape.QuadCount;
            resort.ResortStats.TripleCount = scrape.TripleCount;
            resort.ResortStats.DoubleCount = scrape.DoubleCount;
            resort.ResortStats.SingleCount = scrape.SingleCount;
            resort.ResortStats.SurfaceCount = scrape.SurfaceCount;
            resort.ResortStats.GondolaCount = scrape.GondolaCount;
            resort.ResortStats.FunicularCount = scrape.FunicularCount;
            resort.ResortStats.SurfaceTrainCount = scrape.SurfaceTrainCount;
            resort.ResortStats.RunTotal = scrape.RunTotal;
            resort.ResortStats.RedRuns = scrape.RedRuns;
            resort.ResortStats.BlueRuns = scrape.BlueRuns;
            resort.ResortStats.GreenRuns = scrape.GreenRuns;
            resort.ResortStats.BlackRuns = scrape.BlackRuns;
            resort.ResortStats.LongestRunDistance = scrape.LongestRunDistance;
            resort.ResortStats.AverageSnowfall = scrape.AverageSnowfall;
            resort.ResortStats.SnowmakingCoverage = scrape.SnowmakingCoverage;
            resort.ResortStats.SkiableTerrianSize = scrape.SkiableTerrianSize;

            resort.Display = true;

            resortService.Update(resort);
        }
Esempio n. 3
0
        public static Resort GetResortByName(string prettyUrl)
        {
            Resort resort = new Resort();

            //TODO: put all this in a method
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["SQL2005_615410_sporthubConnectionString"].ConnectionString);
            SqlCommand cmd = new SqlCommand("GetResortByName", conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@PrettyUrl", prettyUrl));
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            DataSet dataSet = new DataSet();
            da.Fill(dataSet);

            DataTable resortTable = dataSet.Tables[0];
            DataTable continentTable = dataSet.Tables[1];
            DataTable countryTable = dataSet.Tables[2];
            DataTable regionTable = dataSet.Tables[3];
            DataTable resortLinksTable = dataSet.Tables[4];

            //TODO: error handle
            try
            {
                if (resortTable.Rows.Count > 0)
                {
                    resort = DataConverter.ToType<Resort>(resortTable.Rows[0]);

                    if (continentTable.Rows.Count > 0)
                    {
                        resort.Continent = DataConverter.ToType<Continent>(continentTable.Rows[0]);
                    }
                    if (countryTable.Rows.Count > 0)
                    {
                        resort.Country = DataConverter.ToType<Country>(countryTable.Rows[0]);
                    }
                    //TODO: regions
                    if (resortLinksTable.Rows.Count > 0)
                    {
                        resort.ResortLinks = new List<ResortLink>();
                        foreach (DataRow resortLink in resortLinksTable.Rows)
                        {
                            resort.ResortLinks.Add(DataConverter.ToType<ResortLink>(resortLink));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var message = ex.Message;
                //TODO: error handle
            }

            return resort;
        }
Esempio n. 4
0
 public static bool ResortSuitsGroup4Check(Resort resort)
 {
     if (resort.ResortSuitsExpensive == 0 && resort.ResortSuitsAffordable == 0 && resort.ResortSuitsCheap == 0)
     {
         return false;
     }
     return true;
 }
Esempio n. 5
0
        private void GetResort()
        {
            dgvLinks.Rows.Clear();
            NewLinkName.Text = string.Empty;
            NewUrl.Text = string.Empty;
            lblStatus.Text = string.Empty;

            _resortService = new ResortService(_resortRepository);
            _resort = _resortService.GetByName(coResorts.SelectedItem.ToString());
            ResortName.Text = _resort.Name;
            PrettyUrl.Text = _resort.PrettyUrl;
            Longitude.Text = _resort.Longitude.ToString();
            Latitude.Text = _resort.Latitude.ToString();
            if (!_resort.IsSkiArea)
            {
                BaseLevel.Text = _resort.ResortStats.BaseLevel;
                TopLevel.Text = _resort.ResortStats.TopLevel;
                VerticalDrop.Text = _resort.ResortStats.VerticalDrop;
                Height.Text = _resort.ResortStats.Height;
                AverageSnowfall.Text = _resort.ResortStats.AverageSnowfall;
                HasSnowmaking.Checked = (_resort.ResortStats.HasSnowmaking == "True") ? true : false;
                SnowmakingCoverage.Text = _resort.ResortStats.SnowmakingCoverage;
                PreSeasonStartMonth.Text = _resort.ResortStats.PreSeasonStartMonth;
                SeasonStartMonth.Text = _resort.ResortStats.SeasonStartMonth;
                SeasonEndMonth.Text = _resort.ResortStats.SeasonEndMonth;
                Population.Text = _resort.ResortStats.Population;
                MountainRestaurants.Text = _resort.ResortStats.MountainRestaurants;

                HasNightskiing.Checked = (_resort.ResortStats.HasNightskiing == "True") ? true : false;
                NightskiingDescription.Text = _resort.ResortStats.NightskiingDescription;
                HasSummerskiing.Checked = (_resort.ResortStats.HasSummerskiing == "True") ? true : false;
                SummerskiingDescription.Text = _resort.ResortStats.SummerskiingDescription;
                SummerStartMonth.Text = _resort.ResortStats.SummerStartMonth;
                SummerEndMonth.Text = _resort.ResortStats.SummerEndMonth;

                BlackRuns.Text = _resort.ResortStats.BlackRuns;
                RedRuns.Text = _resort.ResortStats.RedRuns;
                BlueRuns.Text = _resort.ResortStats.BlueRuns;
                GreenRuns.Text = _resort.ResortStats.GreenRuns;
                LongestRunDistance.Text = _resort.ResortStats.LongestRunDistance;
                RunTotalDistance.Text = _resort.ResortStats.RunTotalDistance;
                RunTotal.Text = _resort.ResortStats.RunTotal;
                SkiableTerrianSize.Text = _resort.ResortStats.SkiableTerrianSize;
                HasSnowpark.Checked = (_resort.ResortStats.HasSnowpark == "True") ? true : false;
                SnowparkTotal.Text = _resort.ResortStats.SnowparkTotal;
                SnowparkDescription.Text = _resort.ResortStats.SnowparkDescription;
                HasHalfpipe.Checked = (_resort.ResortStats.HasHalfpipe == "True") ? true : false;
                HalfpipeTotal.Text = _resort.ResortStats.HalfpipeTotal;
                HalfpipeDescription.Text = _resort.ResortStats.HalfpipeDescription;
                HasQuarterpipe.Checked = (_resort.ResortStats.HasQuarterpipe == "True") ? true : false;
                QuarterpipeTotal.Text = _resort.ResortStats.QuarterpipeTotal;
                QuarterpipeDescription.Text = _resort.ResortStats.QuarterpipeDescription;

                AverageSnowfall.Text = _resort.ResortStats.AverageSnowfall;
                SnowmakingCoverage.Text = _resort.ResortStats.SnowmakingCoverage;
                Snowfall1Jan.Text = _resort.ResortStats.Snowfall1Jan;
                Snowfall2Feb.Text = _resort.ResortStats.Snowfall2Feb;
                Snowfall3Mar.Text = _resort.ResortStats.Snowfall3Mar;
                Snowfall4Apr.Text = _resort.ResortStats.Snowfall4Apr;
                Snowfall5May.Text = _resort.ResortStats.Snowfall5May;
                Snowfall6Jun.Text = _resort.ResortStats.Snowfall6Jun;
                Snowfall7Jul.Text = _resort.ResortStats.Snowfall7Jul;
                Snowfall8Aug.Text = _resort.ResortStats.Snowfall8Aug;
                Snowfall9Sep.Text = _resort.ResortStats.Snowfall9Sep;
                Snowfall10Oct.Text = _resort.ResortStats.Snowfall10Oct;
                Snowfall11Nov.Text = _resort.ResortStats.Snowfall11Nov;
                Snowfall12Dec.Text = _resort.ResortStats.Snowfall12Dec;

                LiftDescription.Text = _resort.ResortStats.LiftDescription;
                LiftTotal.Text = _resort.ResortStats.LiftTotal;
                LiftCapacityHour.Text = _resort.ResortStats.LiftTotal;
                QuadPlusCount.Text = _resort.ResortStats.QuadPlusCount;
                QuadCount.Text = _resort.ResortStats.QuadCount;
                TripleCount.Text = _resort.ResortStats.TripleCount;
                DoubleCount.Text = _resort.ResortStats.DoubleCount;
                SurfaceCount.Text = _resort.ResortStats.SurfaceCount;
                GondolaCount.Text = _resort.ResortStats.GondolaCount;
                FunicularCount.Text = _resort.ResortStats.FunicularCount;
                SurfaceTrainCount.Text = _resort.ResortStats.SurfaceTrainCount;
            }

            IsSkiArea.Checked = _resort.IsSkiArea;

            var resorts = _resortService.GetAllByContinentID(_resort.ContinentID);
            var i = 0;
            for (var index = 0; index < resorts.Count; index++)
            {
                var resort = resorts[index];
                checkedListBoxResortsForSkiArea.Items.Add(resort.Name);
                var cnt = _resort.SkiAreas.Where(r => resort.ID == r.Resort.ID).Count();
                if (cnt > 0)
                    checkedListBoxResortsForSkiArea.SetItemChecked(index, true);

                i++;
            }

            PopulateLinks();
        }
Esempio n. 6
0
        public static int[,] GetGroup2Values(Resort resort)
        {
            int[,] values = new int[10, 2];
            values[0, 0] = 100;
            values[0, 1] = resort.ResortSuitsLively + resort.ResortSuitsAverage + resort.ResortSuitsQuiet;
            decimal onePercent = (decimal)values[0, 1] / 100;
            values[1, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsLively / onePercent), 0);
            values[2, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsAverage / onePercent), 0);
            values[3, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsQuiet / onePercent), 0);
            values[1, 1] = resort.ResortSuitsLively;
            values[2, 1] = resort.ResortSuitsAverage;
            values[3, 1] = resort.ResortSuitsQuiet;

            return values;
        }
Esempio n. 7
0
 public static bool ResortSuitsGroup3Check(Resort resort)
 {
     if (resort.ResortSuitsSkiers == 0 && resort.ResortSuitsSnowboarders == 0 && resort.ResortSuitsBoth == 0)
     {
         return false;
     }
     return true;
 }
Esempio n. 8
0
        public static string ResortSuits(this HtmlHelper helper, Resort resort)
        {
            if (!ResortSuitsGroup1Check(resort) && !ResortSuitsGroup2Check(resort) && !ResortSuitsGroup3Check(resort) && !ResortSuitsGroup4Check(resort))
            {
                return "<div style=\"margin: 0;line-height: 1.3em;\">No \"Resort Suits\" ratings are available yet. Do you have an opinion? Then be the first to <a class=\"rate\"  href=\"/review/" + resort.PrettyUrl + "?ReturnUrl=/resorts/" + resort.PrettyUrl + "\" id=\"rateReviewResort\">add your ratings</a></div>";
            }
            int[,] group1 = GetGroup1Values(resort);
            string ret = "<table class='table1 nobord'>";
            ret += "<tr><th class='ratinghead' colspan='2'>Ability most suits ...</th></tr>";
            ret += "<tr><td style='width: 60%'>Expert</td><td><span title='" + group1[1, 0] + "% (" + group1[1, 1] + " votes)' style='background-position: -" + (100 - group1[1, 0]) + "px 0;' class='rating-bar green'>" + group1[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Advanced</td><td><span title='" + group1[2, 0] + "% (" + group1[2, 1] + " votes)' style='background-position: -" + (100 - group1[2, 0]) + "px 0;' class='rating-bar green'>" + group1[2, 0] + "%</span></td></tr>";
            ret += "<tr><td>Intermediate</td><td><span title='" + group1[3, 0] + "% (" + group1[3, 1] + " votes)' style='background-position: -" + (100 - group1[3, 0]) + "px 0;' class='rating-bar green'>" + group1[3, 0] + "%</span></td></tr>";
            ret += "<tr><td>Beginner</td><td><span title='" + group1[4, 0] + "% (" + group1[4, 1] + " votes)' style='background-position: -" + (100 - group1[4, 0]) + "px 0;' class='rating-bar green'>" + group1[4, 0] + "%</span></td></tr>";
            int[,] group2 = GetGroup2Values(resort);
            ret += "<tr><th class='ratinghead' colspan='2'>Nightlife is ...</th></tr>";
            ret += "<tr><td style='width: 60%'>Lively</td><td><span title='" + group2[1, 0] + "% (" + group2[1, 1] + " votes)' style='background-position: -" + (100 - group2[1, 0]) + "px 0;' class='rating-bar green'>" + group2[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Average</td><td><span title='" + group2[2, 0] + "% (" + group2[2, 1] + " votes)' style='background-position: -" + (100 - group2[2, 0]) + "px 0;' class='rating-bar green'>" + group2[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Quiet</td><td><span title='" + group2[3, 0] + "% (" + group2[3, 1] + " votes)' style='background-position: -" + (100 - group2[3, 0]) + "px 0;' class='rating-bar green'>" + group2[1, 0] + "%</span></td></tr>";
            int[,] group3 = GetGroup3Values(resort);
            ret += "<tr><th class='ratinghead' colspan='2'>Terrian suits ...</th></tr>";
            ret += "<tr><td style='width: 60%'>Skiers</td><td><span title='" + group3[1, 0] + "% (" + group3[1, 1] + " votes)' style='background-position: -" + (100 - group3[1, 0]) + "px 0;' class='rating-bar green'>" + group3[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Snowboarders</td><td><span title='" + group1[2, 0] + "% (" + group3[2, 1] + " votes)' style='background-position: -" + (100 - group3[2, 0]) + "px 0;' class='rating-bar green'>" + group3[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Both</td><td><span title='" + group3[3, 0] + "% (" + group3[3, 1] + " votes)' style='background-position: -" + (100 - group3[3, 0]) + "px 0;' class='rating-bar green'>" + group3[1, 0] + "%</span></td></tr>";
            int[,] group4 = GetGroup4Values(resort);
            ret += "<tr><th class='ratinghead' colspan='2'>Expense level ...</th></tr>";
            ret += "<tr><td style='width: 60%'>Expensive</td><td><span title='" + group4[1, 0] + "% (" + group4[1, 1] + " votes)' style='background-position: -" + (100 - group4[1, 0]) + "px 0;' class='rating-bar green'>" + group4[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Affordable</td><td><span title='" + group4[2, 0] + "% (" + group4[2, 1] + " votes)' style='background-position: -" + (100 - group4[2, 0]) + "px 0;' class='rating-bar green'>" + group4[1, 0] + "%</span></td></tr>";
            ret += "<tr><td>Cheap</td><td><span title='" + group4[3, 0] + "% (" + group4[3, 1] + " votes)' style='background-position: -" + (100 - group4[3, 0]) + "px 0;' class='rating-bar green'>" + group4[1, 0] + "%</span></td></tr>";
            ret += "</table>";

            return ret;
        }
Esempio n. 9
0
 public static bool ResortSuitsGroup1Check(Resort resort)
 {
     if (resort.ResortSuitsExpert == 0 && resort.ResortSuitsAdvanced == 0 && resort.ResortSuitsIntermediate == 0 && resort.ResortSuitsBeginner == 0)
     {
         return false;
     }
     return true;
 }
Esempio n. 10
0
        public static string ResortNavigation(this HtmlHelper helper, Resort resort, string selectedTab, string returnUrl)
        {
            bool isFave = false;
            bool hasVisited = false;
            bool hasReviewed = false;
            string month = string.Empty;
            string year = string.Empty;
            string loggedIn = " not-logged-in";

            if (UserContext.UserIsLoggedIn())
            {
                loggedIn = string.Empty;
                var db = new Sporthub.Repository.DataAccess.SporthubDataContext(ConfigurationManager.ConnectionStrings["SQL2005_615410_sporthubConnectionString"].ConnectionString);
                var linkResortUserToUpdate = (from lru in db.LinkResortUsers
                                              where lru.ResortID == resort.ID && lru.UserID == UserContext.CurrentUser.ID
                                              select lru).SingleOrDefault();

                if (linkResortUserToUpdate != null)
                {
                    if (linkResortUserToUpdate.IsFavourite)
                    {
                        isFave = true;
                    }
                    if (linkResortUserToUpdate.HasVisited)
                    {
                        hasVisited = true;
                    }
                    if (linkResortUserToUpdate.Score > 0)
                    {
                        hasReviewed = true;
                    }
                    if (!string.IsNullOrEmpty(linkResortUserToUpdate.LastVisitDate))
                    {
                        string[] arr = linkResortUserToUpdate.LastVisitDate.Split('-');
                        year = arr[0];
                        month = arr[1];
                    }
                }
            }

            string[] months = new string[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
            string selectBoxes = "<select name=\"dob_m\" id=\"dob_m\" class=\"narrow\" style=\"float: left\">";
            selectBoxes += "<option value=\"\" selected=\"selected\">Month</option>";
            for (int i = 1; i <= 12; i++)
            {
                selectBoxes += string.Format("<option value=\"{0}\">{1}</option>", i, months[i-1]);
            }
            selectBoxes += "</select>";
            selectBoxes += "<select name=\"dob_y\" id=\"dob_y\" class=\"narrow\" style=\"float: left; margin-left: 8px;\">";
            selectBoxes += "<option value=\"\" selected=\"selected\">Year</option>";
            for (int i = DateTime.Now.Year; i >= 1960; i--)
            {
                selectBoxes += string.Format("<option value=\"{0}\">{1}</option>", i, i);
            }
            selectBoxes += "</select>";

            string ret = "<div id=\"PageHeader\" class=\"container_12\">";
            ret += "<div class=\"grid_12\">";
            //ret += "<h2 id=\"PageHeading\" class=\"pad\" style=\"background: transparent url(/static/images/flags/lg/24/" + resort.Country.ISO3166Alpha2 + ".png) 10px 9px no-repeat\">" + resort.Name + "<span>, " + resort.Country.CountryName + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + ((Sporthub.Utils.Helpers.IsAdmin()) ? "<a href=\"/admin/resorts/" + resort.PrettyUrl + "/edit\">edit</a>" : "") + "</h2>";
            ret += "<h2 class=\"pad\" style=\"background: transparent url(/static/images/flags/lg/24/" + resort.Country.ISO3166Alpha2 + ".png) 0 37% no-repeat\">" + resort.Name + "<span>, " + resort.Country.CountryName + "</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + ((Sporthub.Utils.Helpers.IsAdmin()) ? "<a href=\"/admin/resorts/" + resort.PrettyUrl + "/default\">edit</a>" : "") + "</h2>";
            ret += "</div>";
            ret += "</div>";
            ret += "<div class=\"container_12\">";
            ret += "<div class=\"grid_6\">";
            ret += "&nbsp;";
            ret += "</div>";
            ret += "<div class=\"grid_6\">";
            ret += "<div class=\"ratingButtons\">";

            ret += "<table>";
            ret += "<tr>";

            if (hasReviewed)
            {
                ret += "<td><a href=\"/review/" + resort.PrettyUrl + "?ReturnUrl=/resorts/" + resort.PrettyUrl + "\" class=\"actbutt left\" title=\"Edit your review/ratings for this resort\"><span><img src=\"/static/images/review_on.png\" alt=\"\" /> Rate</span</a></td>";
            }
            else
            {
                if (UserContext.UserIsLoggedIn())
                {
                    ret += "<td><a href=\"/review/" + resort.PrettyUrl + "?ReturnUrl=/resorts/" + resort.PrettyUrl + "\" class=\"actbutt left" + loggedIn + "\" title=\"Add a review for this resort and rate facilities\"><span><img src=\"/static/images/review_off.png\" alt=\"\" /> Rate</span</a></td>";
                }
                else
                {
                    ret += "<td><a href=\"#loginPopup\" class=\"actbutt left" + loggedIn + "\" title=\"Add a review for this resort and rate facilities\"><span><img src=\"/static/images/review_off.png\" alt=\"\" /> Rate</span</a></td>";
                }
            }
            if (isFave)
            {
                ret += "<td><a id=\"addAsFave\" href=\"#\" class=\"actbutt middle\" title=\"This resort is a favourite. Click again to clear\"><span><img src=\"/static/images/fave_on.png\" alt=\"\" /> Favourite</span</a></td>";
            }
            else
            {
                if (UserContext.UserIsLoggedIn())
                {
                    ret += "<td><a id=\"addAsFave\" href=\"#\" class=\"actbutt middle" + loggedIn + "\" title=\"Add this resort as a favourite\"><span><img src=\"/static/images/fave_off.png\" alt=\"\" />Favourite</span</a></td>";
                }
                else
                {
                    ret += "<td><a href=\"#loginPopup\" class=\"actbutt middle" + loggedIn + "\" title=\"Add this resort as a favourite\"><span><img src=\"/static/images/fave_off.png\" alt=\"\" />Favourite</span</a></td>";
                }
            }
            if (hasVisited)
            {
                ret += "<td><a id=\"markAsVisited\" href=\"#visitEntryPopup\" class=\"actbutt middle\" title=\"You have visited this resort. Click again to clear\"><span><img src=\"/static/images/been_on.png\" alt=\"\" /> You've Been</span</a></td>";
            }
            else
            {
                if (UserContext.UserIsLoggedIn())
                {
                    ret += "<td><a id=\"markAsVisited\" href=\"#visitEntryPopup\" class=\"actbutt middle" + loggedIn + "\" title=\"Mark resort as 'visited'\"><span><img src=\"/static/images/been_off.png\" alt=\"\" /> I've Been</span</a></td>";
                }
                else
                {
                    ret += "<td><a href=\"#loginPopup\" class=\"actbutt middle" + loggedIn + "\" title=\"Mark resort as 'visited'\"><span><img src=\"/static/images/been_off.png\" alt=\"\" /> I've Been</span</a></td>";
                }
            }
            if (UserContext.UserIsLoggedIn())
            {
                ret += "<td><a href=\"/resorts/checkin/" + resort.PrettyUrl + "?ReturnUrl=" + returnUrl + "\" class=\"actbutt right" + loggedIn + "\" title=\"If you are currently at this resort then 'Check In' here\"><span>Check In</span</a></td>";
            }
            else
            {
                ret += "<td><a href=\"#loginPopup\" class=\"actbutt right" + loggedIn + "\" title=\"If you are currently at this resort then 'Check In' here\"><span>Check In</span</a></td>";
            }

            //ret += "<td>&nbsp;</td>";
            //ret += "<td><a href=\"/places/add/" + resort.PrettyUrl + "?ReturnUrl=" + returnUrl + "\" class=\"actbutt single\" title=\"Add a bar, shop, business etc to this resort\"><span>Add a Place</span</a></td>";

            ret += "</tr>";
            ret += "</table>";
            ret += "<div style=\"display:none\"><div class=\"login\" id=\"loginPopup\"><div class=\"loginPopupIn\"><p>You must be logged-in to do that</p><p><a class=\"smlbutt\" href=\"/account/login\">Login</a> <a class=\"smlbutt\" href=\"/account/create\">Create an Account</a></p><p style=\"float: left; clear: both;\"><a href=\"#\" id=\"cnclButt\">No Thanks</a></p></div></div></div>";
            ret += string.Format("<div style=\"display:none\"><div class=\"visitEntry\" id=\"visitEntryPopup\"><div class=\"visitEntryIn\"><label>Please enter the date of your Last Visit</label>{0}<a id=\"cnclButt\" class=\"smlbutt cncl\" href=\"#\">Cancel</a><a id=\"svButt\" class=\"smlbutt\" href=\"#\">Save</a></div></div></div>", selectBoxes);

            //ret += "<a class=\"rb checkin\" href=\"/Resorts/CheckIn/" + resort.PrettyUrl + "?ReturnUrl=" + returnUrl + "\" id=\"checkInHere\"><span></span></a>&nbsp;&nbsp;";
            //if (hasVisited)
            //{
            //    ret += "<a class=\"rb visit isVisited\" href=\"#\" id=\"markAsVisited\"><span></span>Visited</a>&nbsp;&nbsp;";
            //}
            //else
            //{
            //    ret += "<a class=\"rb visit\" href=\"#\" id=\"markAsVisited\"><span></span></a>&nbsp;&nbsp;";
            //}
            //ret += string.Format("<div class=\"visitEntry\" id=\"visitEntryPopup\"><div class=\"visitEntryIn\"><label>Last Visit Date</label>{0}<a id=\"cnclButt\" class=\"smlbutt cncl\" href=\"#\">Cancel</a><a id=\"svButt\" class=\"smlbutt\" href=\"#\">Save</a></div></div>", selectBoxes);
            //if (isFave)
            //{
            //    ret += "<a class=\"rb fave isFave\" title\"This resort is a Favourite. Click to remove\" href=\"#\" id=\"addAsFave\"><span></span>A Favourite</a>&nbsp;&nbsp;";
            //}
            //else
            //{
            //    ret += "<a class=\"rb fave\"  href=\"#\" id=\"addAsFave\"><span></span></a>&nbsp;&nbsp;";
            //}
            //if (UserContext.UserIsLoggedIn())
            //{
            //    ret += "<a class=\"rb rate\" title=\"Rate and review this resort\" href=\"/review/" + resort.PrettyUrl + "?ReturnUrl=" + returnUrl + "\" id=\"rateReviewResort\"><span></span>Rate/Review</a>";
            //}
            //else
            //{
            //    ret += "<a class=\"rb ratewarn\" title=\"Rate and review this resort\" onclick=\"alert('You need to be logged in to do that')\" href=\"#\" id=\"rateReviewResort\"><span></span></a>";
            //}
            ret += "</div>";
            ret += "</div>";
            ret += "</div>";
            ret += "<div class=\"container_12\">";
            ret += "<div class=\"grid_12\" style=\"height: 23px;\">";
            ret += "<ul class=\"menuTabs tabNav\">";
            ret += "<li class=\"tab" + ((selectedTab == "overview") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "\"><span style=\"position: relative;\">Overview</span></a></li>";
            ret += "<li class=\"tab" + ((selectedTab == "map") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "/map\"><span>Map</span></a></li>";
            ret += "<li class=\"tab" + ((selectedTab == "reviews") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "/reviews\"><span>Reviews</span></a></li>";
            ret += "<li class=\"tab" + ((selectedTab == "places") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "/places\"><span>Places</span></a></li>";
            ret += "<li class=\"tab" + ((selectedTab == "photos") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "/photos\"><span>Photos</span></a></li>";
            ret += "<li class=\"tab" + ((selectedTab == "videos") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "/videos\"><span>Videos</span></a></li>";
            ret += "<li class=\"tab" + ((selectedTab == "webcams") ? " selectedTab" : "") + "\"><a title=\"\" href=\"/resorts/" + resort.PrettyUrl + "/webcams\"><span>Webcams</span></a></li>";
            ret += "</ul>";
            ret += "</div>";
            ret += "</div>";

            return ret;
        }
Esempio n. 11
0
        public static string ResortRuns(this HtmlHelper helper, Resort resort)
        {
            bool showPod = false;
            string ret = "<table class='runInfo'>";
            var x = 0;
            int w = 8;
            if (!string.IsNullOrEmpty(resort.ResortStats.GreenRuns))
            {
                if (int.Parse(resort.ResortStats.GreenRuns)>0)
                {
                    showPod = true;
                    x++;
                    ret += "<tr class='qt' title='Beginner. These are usually not marked trails, but tend to be large, open, gently sloping areas at the base of the ski area or traverse paths between the main trails.'><th class='green'>Green Runs</th><td class='green'><span style='width: " + GetRunWidth(int.Parse(resort.ResortStats.GreenRuns)) + "px;'>" + resort.ResortStats.GreenRuns + "%&nbsp;&nbsp;&nbsp;</span></td></tr>";
                }
            }
            if (!string.IsNullOrEmpty(resort.ResortStats.BlueRuns))
            {
                if (int.Parse(resort.ResortStats.BlueRuns)>0)
                {
                    showPod = true;
                    x++;
                    ret += "<tr class='qt' title='Easy (similar to the North American Green Circle). Almost always groomed, or on so shallow a slope as not to need it. The slope gradient shall not exceed 25% except for short wide sections with a higher gradient.'><th class='blue'>Blue Runs</th><td class='blue'><span style='width: " + GetRunWidth(int.Parse(resort.ResortStats.BlueRuns)) + "px;'>" + resort.ResortStats.BlueRuns + "%&nbsp;&nbsp;&nbsp;</span></td></tr>";
                }
            }
            if (!string.IsNullOrEmpty(resort.ResortStats.RedRuns))
            {
                if (int.Parse(resort.ResortStats.RedRuns)>0)
                {
                    showPod = true;
                    x++;
                    ret += "<tr class='qt' title='Intermediate. Steeper, or narrower than a blue slope, these are usually groomed, unless the narrowness of the trail prohibits it. The slope gradient shall not exceed 40% except for short wide sections with a higher gradient.'><th class='red'>Red Runs</th><td class='red'><span style='width: " + GetRunWidth(int.Parse(resort.ResortStats.RedRuns)) + "px;'>" + resort.ResortStats.RedRuns + "%&nbsp;&nbsp;&nbsp;</span></td></tr>";
                }
            }
            if (!string.IsNullOrEmpty(resort.ResortStats.BlackRuns))
            {
                if (int.Parse(resort.ResortStats.BlackRuns)>0)
                {
                    showPod = true;
                    x++;
                    ret += "<tr class='qt' title='Expert. Steep, may or may not be groomed, or may be groomed for moguls. Black can be a very wide classification, ranging from a slope marginally more difficult than a Red to very steep avalanche chutes. France tends to have a higher limit between red and black. Black ski trails should be approached with caution and sufficient prior research undertaken to ensure the level of skill required when tackling the run.'><th class='black'>Black Runs</th><td class='black'><span style='width: " + GetRunWidth(int.Parse(resort.ResortStats.BlackRuns)) + "px;'>" + resort.ResortStats.BlackRuns + "%&nbsp;&nbsp;&nbsp;</span></td></tr>";
                }
            }
            ret += "</table>";

            if (!showPod)
                return string.Empty;

            return ret;
        }
Esempio n. 12
0
        public static int[,] GetGroup4Values(Resort resort)
        {
            int[,] values = new int[10, 2];
            values[0, 0] = 100;
            values[0, 1] = resort.ResortSuitsExpensive + resort.ResortSuitsAffordable + resort.ResortSuitsCheap;
            decimal onePercent = (decimal)values[0, 1] / 100;
            values[1, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsExpensive / onePercent), 0);
            values[2, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsAffordable / onePercent), 0);
            values[3, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsCheap / onePercent), 0);
            values[1, 1] = resort.ResortSuitsExpensive;
            values[2, 1] = resort.ResortSuitsAffordable;
            values[3, 1] = resort.ResortSuitsCheap;

            return values;
        }
Esempio n. 13
0
        public static string AverageSnowfall(this HtmlHelper helper, Resort resort)
        {
            var showPod = false;
            var ret = string.Empty;
            if (resort.ResortStats != null)
            {

                ret += "<div class='pod'>";
                ret += "<div class='headwrap'>";
                ret += "<h3>Average Snowfall</h3>";
                ret += "</div>";
                ret += "<div class='podIn'>";
                ret += "<table class='avgSnow'>";
                //TODO: swap for southern hemisphere
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall7Jul))
                {
                    showPod = true;
                    ret += "<tr><th>JUL</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall7Jul)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall7Jul + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall8Aug))
                {
                    showPod = true;
                    ret += "<tr><th>AUG</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall8Aug)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall8Aug + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall9Sep))
                {
                    showPod = true;
                    ret += "<tr><th>SEP</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall9Sep)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall9Sep + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall10Oct))
                {
                    showPod = true;
                    ret += "<tr><th>OCT</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall10Oct)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall10Oct + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall11Nov))
                {
                    showPod = true;
                    ret += "<tr><th>NOV</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall11Nov)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall11Nov + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall12Dec))
                {
                    showPod = true;
                    ret += "<tr><th>DEC</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall12Dec)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall12Dec + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall1Jan))
                {
                    showPod = true;
                    ret += "<tr><th>JAN</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall1Jan)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall1Jan + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall2Feb))
                {
                    showPod = true;
                    ret += "<tr><th>FEB</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall2Feb)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall2Feb + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall3Mar))
                {
                    showPod = true;
                    ret += "<tr><th>MAR</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall3Mar)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall3Mar + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall4Apr))
                {
                    showPod = true;
                    ret += "<tr><th>APR</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall4Apr)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall4Apr + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall5May))
                {
                    showPod = true;
                    ret += "<tr><th>MAY</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall5May)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall5May + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                if (!string.IsNullOrEmpty(resort.ResortStats.Snowfall6Jun))
                {
                    showPod = true;
                    ret += "<tr><th>JUN</th><td><span style='width: " +
                           ((int.Parse(resort.ResortStats.Snowfall6Jun)/3) + 10) + "px;'>" +
                           resort.ResortStats.Snowfall6Jun + "cm&nbsp;&nbsp;</span></td></tr>";
                }
                ret += "</table>";
                ret += "<div class='cb'></div>";
                ret += "</div>";
                ret += "</div>";
            }

            if (!showPod)
                return string.Empty;

            return ret;
        }
Esempio n. 14
0
        public static int[,] GetGroup3Values(Resort resort)
        {
            int[,] values = new int[10, 2];
            values[0, 0] = 100;
            values[0, 1] = resort.ResortSuitsSkiers + resort.ResortSuitsSnowboarders + resort.ResortSuitsBoth;
            decimal onePercent = (decimal)values[0, 1] / 100;
            values[1, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsSkiers / onePercent), 0);
            values[2, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsSnowboarders / onePercent), 0);
            values[3, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsBoth / onePercent), 0);
            values[1, 1] = resort.ResortSuitsSkiers;
            values[2, 1] = resort.ResortSuitsSnowboarders;
            values[3, 1] = resort.ResortSuitsBoth;

            return values;
        }
Esempio n. 15
0
        private void btnGeoscrape_Click(object sender, EventArgs e)
        {
            if ((!string.IsNullOrEmpty(tbCountryID.Text)) ||
             (!string.IsNullOrEmpty(tbContinentID.Text)) ||
             (!string.IsNullOrEmpty(tbCountryName.Text)) ||
             (!string.IsNullOrEmpty(tbCountryName.Text)))
            {
                resortService = new ResortService(resortRepository);
                List<string> list = new List<string>();
                using (StreamReader reader = new StreamReader("scrape_in.txt"))
                {
                    char tab = '\u0009';
                    string line;
                    while ((line = reader.ReadLine()) != null)
                    {
                        line = line.Replace(" = ", "=");
                        line = line.Replace(tab, '¬');
                        line = line.Replace("¬", "");
                        //line = line.Replace("&#232;", "è");
                        //line = line.Replace("&#233;", "é");
                        //line = line.Replace("&#235;", "ë");
                        list.Add(line);
                    }
                }

                string store_id = string.Empty;
                string lat = string.Empty;
                string lng = string.Empty;
                string name = string.Empty;
                string encoded_name = string.Empty;

                foreach (string line in list)
                {

                    string id = getId(line);
                    if ((store_id != id) && (!string.IsNullOrEmpty(store_id)))
                    {
                        //write to DB
                        Resort resort = new Resort();
                        try
                        {
                            resort.Name = name;
                            resort.CountryID = int.Parse(tbCountryID.Text);
                            resort.CountryName = tbCountryName.Text;
                            resort.ContinentID = int.Parse(tbContinentID.Text);
                            resort.ContinentName = tbContinentName.Text;
                            resort.Latitude = double.Parse(lat);
                            resort.Longitude = double.Parse(lng);
                            resort.PrettyUrl = encoded_name;
                            resort.CanPublish = true;
                            resort.CreatedDate = DateTime.Now;
                            resort.UpdatedDate = DateTime.Now;

                            int resortID = resortService.Add(resort);

                            if (!string.IsNullOrEmpty(tbMountainRange.Text))
                            {
                                int lrmrID = LocationDataManager.AddResortToMountainRangeLink(resortID, int.Parse(tbMountainRange.Text));
                            }
                        }
                        catch (Exception ex)
                        {
                            ListViewItem item = new ListViewItem();
                            item.Text = string.Format("{0} = {1}", name, ex.Message);
                            listBox1.Items.Add(item);
                        }
                    }
                    store_id = id;

                    string type = line.Substring(0, 4);

                    switch (type)
                    {
                        case "lats":
                            lat = getLatLng(line);
                            break;
                        case "long":
                            lng = getLatLng(line);
                            break;
                        case "type":
                            //skip
                            break;
                        case "info":
                            name = getName(line);
                            name = name.Replace(" - ", "-");
                            name = name.Replace(" / ", "/");
                            encoded_name = EncodeURL(CheckEncodedName(name));
                            name = CheckEncodedName(name);
                            break;
                        default:
                            break;
                    }
                }

                ListViewItem item2 = new ListViewItem();
                item2.Text = "========== END ==========";
                listBox1.Items.Add(item2);
            }
            else
            {
                ListViewItem item2 = new ListViewItem();
                item2.Text = "Textboxes empty";
                listBox1.Items.Add(item2);
            }
        }
Esempio n. 16
0
 public static bool ResortSuitsGroup2Check(Resort resort)
 {
     if (resort.ResortSuitsLively == 0 && resort.ResortSuitsAverage == 0 && resort.ResortSuitsQuiet == 0)
     {
         return false;
     }
     return true;
 }
Esempio n. 17
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);
        }
Esempio n. 18
0
        public static int[,] GetGroup1Values(Resort resort)
        {
            int[,] values = new int[10, 2];
            values[0, 0] = 100;
            values[0, 1] = resort.ResortSuitsExpert + resort.ResortSuitsAdvanced + resort.ResortSuitsIntermediate + resort.ResortSuitsBeginner;
            decimal onePercent = (decimal)values[0, 1] / 100;
            values[1, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsExpert / onePercent), 0);
            values[2, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsAdvanced / onePercent), 0);
            values[3, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsIntermediate / onePercent), 0);
            values[4, 0] = (values[0, 1] == 0) ? 0 : (int)Math.Round(((decimal)resort.ResortSuitsBeginner / onePercent), 0);
            values[1, 1] = resort.ResortSuitsExpert;
            values[2, 1] = resort.ResortSuitsAdvanced;
            values[3, 1] = resort.ResortSuitsIntermediate;
            values[4, 1] = resort.ResortSuitsBeginner;

            return values;
        }