コード例 #1
0
        private void AddToSyndication(Guid userID, string rSSUri, SyndicationFeedFormatter feedFormatter)
        {
            try
            {
                ClimberProfile owner = new CFController().GetClimberProfile(userID);

                using (XmlReader reader = XmlReader.Create(rSSUri, new XmlReaderSettings {
                    CloseInput = true, IgnoreWhitespace = false
                }))
                {
                    feedFormatter.ReadFrom(reader);

                    var items = (from c in feedFormatter.Feed.Items where c.PublishDate > DateTime.Now.AddMonths(-1).AddDays(-10) select c); //.Take(NumberPerUser);

                    foreach (SyndicationItem item in items)
                    {
                        SyndicatedItems.Add(new CFUserSyndicationItem(item, owner));
                    }
                }
            }
            catch (Exception ex)
            {
                CFLogger.RecordException(ex, "Failed to load RSS from " + rSSUri);
            }
        }
コード例 #2
0
        //Check two comps with same url and different date
        //[OutputCache(Duration = 3600, VaryByParam = "friendlyUrl")]
        public ActionResult FeatureArticle(string date, string friendlyUrl)
        {
            try
            {
                if (date.Length != 10)
                {
                    throw new Exception("Date paramter invalid");
                }

                int year  = int.Parse(date.Substring(0, 4));
                int month = int.Parse(date.Substring(5, 2));
                int day   = int.Parse(date.Substring(8, 2));

                DateTime dateTime = new DateTime(year, month, day);

                FeatureArticle article = new CFController().GetFeatureArticle(dateTime, friendlyUrl);

                if (article == null)
                {
                    throw new Exception(string.Format("No feature article found for parameters [{0}] and [{1}]", date, friendlyUrl));
                }
                else
                {
                    SetPageMetaData(article.ArticleHeading + " - Climbfind Feature Articles & News - Climbfind.com",
                                    article.MetaDescription + ". News about the UK climbing community",
                                    article.MetaKeywords + "Climbfind, climbing news, climbing events, uk climbing, uk bouldering", PageRobots.IndexFollow);

                    return(View("2008-FeatureArticle", article));
                }
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
コード例 #3
0
        public ActionResult AcceptWatchRequest(int id)
        {
            FeedClimberChannelRequest watchedClimberEntry = new CFController().GetClimberWatchEntry(id);

            new CFController().AcceptWatchRequest(watchedClimberEntry);
            return(RedirectToAction("ClimbersWatchingMe"));
        }
コード例 #4
0
        public ActionResult DetailCrag(string location, string placename, string cragname)
        {
            OutdoorPlace place = new CFController().GetOutdoorPlace(location, placename);

            if (place == null)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                OutdoorCrag crag = new CFController().GetCrag(place.ID, cragname);
                if (crag == null)
                {
                    return(RedirectToAction("Index"));
                }
                else
                {
                    string country     = FlagList.GetCountryName((Nation)place.CountryID);
                    string title       = string.Format("{0}, Climbing at {1} - {2} Outdoor Rock Climbing - Climbfind.com", crag.Name, place.Name, country);
                    string description = string.Format("Infomation about {0} in {1} at {2} including the history of {0}, access to {0}, routes on {0}, movies & discussion.", crag.Name, country, place.Name);
                    string keywords    = string.Format("Climbing {0}, {0} routes, Rock Climbing {1}", crag.Name, country);
                    //-- TODO: fix up the meta data
                    SetPageMetaData(title, description, keywords, PageRobots.IndexFollow);
                    return(View(crag));
                }
            }
        }
コード例 #5
0
 protected void Page_Init(object sender, EventArgs e)
 {
     ClimbFind.Model.Objects.MessageBoard messageBoard = new CFController().GetMessageBoard(Current.MessageBoardID);
     extendedProfile          = cfController.GetExtendedClimberProfile(Current.ID);
     Current.PlacesUserClimbs = cfController.GetPlacesUserClimbs(Current.ID);
     clubs = cfController.GetClubsUserBelongsTo(Current.ID);
 }
コード例 #6
0
        //Check two comps with same url and different date
        public ActionResult Competitions(string date, string friendlyUrl)
        {
            try
            {
                if (date.Length != 10)
                {
                    throw new Exception("Date paramter invalid");
                }

                int year  = int.Parse(date.Substring(0, 4));
                int month = int.Parse(date.Substring(5, 2));
                int day   = int.Parse(date.Substring(8, 2));

                DateTime dateTime = new DateTime(year, month, day);

                Competition comp = new CFController().GetClimbingCompetition(dateTime, friendlyUrl);

                if (comp == null)
                {
                    throw new Exception(string.Format("No competition found for parameters [{0}] and [{1}]", date, friendlyUrl));
                }
                else
                {
                    SetPageMetaData(comp.ArticleHeading + " - Climbfind Climbing Competitions & News - Climbfind.com",
                                    comp.MetaDescription + ". Compeitions & news about the UK climbing community",
                                    comp.MetaKeywords + "Climbfind, climbing news, climbing events, uk climbing competitions, bouldering competition", PageRobots.IndexFollow);

                    return(View("2008-CompetitionTemplate", comp));
                }
            }
            catch
            {
                return(RedirectToAction("Index"));
            }
        }
コード例 #7
0
        protected void Page_Init(Object s, EventArgs e)
        {
            CFController cfController = new CFController();

            Areas = cfController.GetAllAreaTags();
            IndoorAreasAndPlaceCount  = cfController.GetAreaNamesAndPlaceCount(true);
            OutdoorAreasAndPlaceCount = cfController.GetAreaNamesAndPlaceCount(false);

            countriesWithLocations = (from c in CFDataCache.AllPlaces
                                      select c.CountryID).Distinct().ToList();

            countriesWithLocations.Remove((short)Nation.Canada);
            countriesWithLocations.Remove((short)Nation.UnitedStates);
            countriesWithLocations.Remove((short)Nation.England);
            countriesWithLocations.Remove((short)Nation.Australia);

            List <AreaTag> tags = (from c in countriesWithLocations
                                   from at in CFDataCache.AllAreaTags
                                   where c == at.CountryID &&
                                   at.IsCountry
                                   select at).ToList();

            countriesWithLocations = (from c in tags
                                      orderby c.Name ascending
                                      select(short) c.CountryID).ToList();
        }
コード例 #8
0
        public ActionResult JoinClub(int clubID, Guid userID)
        {
            Club club = new CFController().GetClub(clubID);

            new CFController().JoinClub(club.ID, club.Name, userID, User.Identity.Name);

            return(RedirectToAction("Detail", new { country = club.FriendlyCountryUrl, friendlyUrlName = club.FriendlyUrlName }));
        }
コード例 #9
0
        public ActionResult LeaveClub(int clubID, Guid userID)
        {
            Club club = new CFController().GetClub(clubID);

            new CFController().LeaveClub(club.Name, clubID, userID);

            return(RedirectToAction("Detail", new { country = club.FriendlyCountryUrl, friendlyUrlName = club.FriendlyUrlName }));
        }
コード例 #10
0
        /// <summary>
        ///
        /// </summary>
        protected void DeleteMessage_Click(object sender, CommandEventArgs e)
        {
            Guid messageID = new Guid(e.CommandArgument.ToString());

            CFMessageBoard updatedMessageBoard = new CFController().DeleteMessageBoardMessage(MessageBoardID, messageID);

            RenderMessageBoard(updatedMessageBoard);
        }
コード例 #11
0
 public PartnerCallReplyViewData(Guid id)
 {
     Current = new CFController().GetPartnerCall(id);
     if (Current != null)
     {
         PartnerCallPoster = new CFController().GetClimberProfile(Current.ClimberProfileID);
     }
 }
コード例 #12
0
        public PartnerCallShowReplyViewData(Guid id)
        {
            CFController cf = new CFController();

            CurrentReply = cf.GetPartnerCallReply(id);
            CurrentCall  = cf.GetPartnerCall(CurrentReply.PartnerCallID);
            Replier      = cf.GetClimberProfile(CurrentReply.ReplyingUserID);
        }
コード例 #13
0
        public static string OtherAreasInCountryCloud(ViewPage page, Nation nation)
        {
            AreaTag        currentViewedArea  = (from c in CFDataCache.AllAreaTags where c.CountryID == (short)nation && c.IsCountry select c).SingleOrDefault();
            List <AreaTag> areasInSameCountry = new CFController().GetAllAreaTagsInCountry(nation);

            return(page.Html.RenderUserControl("~/Views/Places/OtherAreasInCountryCloud.ascx",
                                               areasInSameCountry, new { CurrentViewedArea = currentViewedArea }));
        }
コード例 #14
0
        public static string Ad(string adUnitName, int adID)
        {
            string srcUrl = HttpContext.Current.Request.RawUrl.ToString();
            Ad     ad     = new CFController().GetAdAndRecordImpression(adID, adUnitName);

            return(string.Format(@"<a href=""/Ads/Record?adID={0}&srcUrl={1}&destinationUrl={2}"" target=""_blank"">
                <img src=""/images/ads/{3}"" title=""{4}"" style=""{5}"" />
            </a>", adID, srcUrl, ad.DestinationPageUrl, ad.ImageFileName, ad.ProductName, ad.ImageTagStyles));
        }
コード例 #15
0
        public ActionResult CustomHangarPartnerWidget(string Site)
        {
            List <int> hanger18s = new List <int>()
            {
                410, 420, 1218
            };
            List <PartnerCall> hangarPartnerCalls = new CFController().GetPartnerCallsForPlaceCombo(hanger18s, 7);

            return(View("PartnerCustomWidget", hangarPartnerCalls));
        }
コード例 #16
0
        public ActionResult CustomVWPartnerWidget(string Site)
        {
            List <int> vws = new List <int>()
            {
                316, 317, 318, 319
            };
            List <PartnerCall> vwPartnerCalls = new CFController().GetPartnerCallsForPlaceCombo(vws, 7);

            return(View("PartnerCustomWidget", vwPartnerCalls));
        }
コード例 #17
0
 public ActionResult VerifyEmailAddress(Guid id)
 {
     if (id != Guid.Empty)
     {
         CFController cf = new CFController();
         cf.VerifyUsersEmailAddress(UserID, id);
     }
     SetPageMetaData();
     return(View(new ISessionViewData()));
 }
コード例 #18
0
        protected void GoToPlacePage_Click(Object o, EventArgs e)
        {
            int selectedPlaceID;

            if (int.TryParse(ResultsHD.Value.ToString(), out selectedPlaceID))
            {
                Place place = new CFController().GetPlace(selectedPlaceID);
                RedirectTo("~" + place.ClimbfindUrl);
            }
        }
コード例 #19
0
        public ActionResult EditIndoorPlaceLogo(int id)
        {
            IndoorPlace indoorPlace = new CFController().GetIndoorPlace(id);

            if (indoorPlace == null)
            {
                throw new Exception(string.Format("No indoor place for id [{0}]", id));
            }
            SetPageMetaData();
            return(View(indoorPlace));
        }
コード例 #20
0
        public ActionResult EditClubLogo(int id)
        {
            Club club = new CFController().GetClub(id);

            if (club == null)
            {
                throw new Exception(string.Format("No club for id [{0}]", id));
            }
            SetPageMetaData();
            return(View(club));
        }
コード例 #21
0
        public ActionResult EditAreaTags(int id)
        {
            Place place = new CFController().GetPlace(id);

            if (place == null)
            {
                throw new Exception(string.Format("No place for id [{0}]", id));
            }
            SetPageMetaData();
            return(View(place));
        }
コード例 #22
0
        public ActionResult EditOutdoorLocationPictures(int id)
        {
            OutdoorPlace outdoorPlace = new CFController().GetOutdoorPlace(id);

            if (outdoorPlace == null)
            {
                throw new Exception(string.Format("No outdoor place for id [{0}]", id));
            }
            SetPageMetaData();
            return(View(outdoorPlace));
        }
コード例 #23
0
        public override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)
        {
            IIdentity      user = HttpContext.Current.User.Identity;
            ClimberProfile cp   = new CFController().GetClimberProfileByEmail(user.Name.ToString());

            if (!cp.IsModerator)
            {
                filterContext.Cancel = true;
                HttpContext.Current.Response.Redirect("/Moderate/UnauthorizedAccess", false);
            }
        }
コード例 #24
0
        public ActionResult EditAreaTag(int id)
        {
            AreaTag tag = new CFController().GetAreaTag(id);

            if (tag == null)
            {
                throw new Exception(string.Format("No area tag id [{0}]", id));
            }
            SetPageMetaData();
            return(View(tag));
        }
コード例 #25
0
        public ActionResult EditOutdoorCragPictures(Guid id)
        {
            OutdoorCrag crag = new CFController().GetCrag(id);

            if (crag == null)
            {
                throw new Exception(string.Format("No crag for id [{0}]", id));
            }
            SetPageMetaData();
            return(View(crag));
        }
コード例 #26
0
        public ActionResult Edit()
        {
            ClimberProfile climberProfile = new CFController().GetClimberProfile(UserID);

            if (climberProfile.IsDefault)
            {
                return(RedirectToAction("EditFirstTime"));
            }
            SetPageMetaData();

            return(View(new ClimberProfileViewData()));
        }
コード例 #27
0
        public ActionResult UpdatePartnerStatus()
        {
            CFController cf = new CFController();

            byte statusID = byte.Parse(Request.Form["PartnerStatus"].ToString());

            ClimberProfile profile = cf.GetClimberProfile(UserID);

            cf.SaveClimberProfilePartnerStatus(profile, (byte)statusID);

            return(RedirectToAction("Me"));
        }
コード例 #28
0
        public ActionResult MeetUp(int id)
        {
            FeedClimbingPost post = new CFController().GetFeedClimbingPost(id);

            if (post == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(NoMetaView(post));
            }
        }
コード例 #29
0
        public ActionResult SeekingPartnersRSS(string location, string name)
        {
            Place place = new CFController().GetPlace(location, name);

            if (place == null)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                return(View(place));
            }
        }
コード例 #30
0
        public ActionResult ConfirmDelete(Guid id)
        {
            PartnerCall call = new CFController().GetPartnerCall(id);

            if (call.ClimberProfileID != UserID)
            {
                throw new Exception(string.Format("You cannot delete someone else's call callID[{0}]", id));
            }

            SetPageMetaData();

            return(View(call));
        }
コード例 #31
0
ファイル: multicopter.cs プロジェクト: eomargr/fpv-sim-mx
    void Start()
    {
        //Multicopter motor configuration
        //Quadcopter
        motors = new motor[4];
        motors[0] = new motor(new Vector3(1, 0, 1), 0f, true); //Front left CW
        motors[1] = new motor(new Vector3(1, 0, -1), 0f, false); //Front righ CCW
        motors[2] = new motor(new Vector3(-1, 0, -1), 0f, true); //Rear right CW
        motors[3] = new motor(new Vector3(-1, 0, 1), 0, false); //Rear left CCW

        tx = new Transmitter();
        sensors = new Sensors(GetComponent<Rigidbody>());
        controller = new CFController(0);

        armed = true;
    }