コード例 #1
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);
 }
コード例 #2
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);
 }
コード例 #3
0
        public ActionResult AcceptWatchRequest(int id)
        {
            FeedClimberChannelRequest watchedClimberEntry = new CFController().GetClimberWatchEntry(id);

            new CFController().AcceptWatchRequest(watchedClimberEntry);
            return RedirectToAction("ClimbersWatchingMe");
        }
コード例 #4
0
        public static void RecordException(Exception ex, string extraMSGContext)
        {
            Guid   userID = new Guid();
            string email  = "anonymous";

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                email  = HttpContext.Current.User.Identity.Name;
                userID = new CFController().GetClimberProfileByEmail(email).ID;
            }

            MailMan.SendAppExceptionEmail(ex, email);

            LogExceptionEvent exceptionEvent = exDA.Insert(
                new LogExceptionEvent
            {
                Browser           = HttpContext.Current.Request.Browser.Browser.ToString() + " v" + HttpContext.Current.Request.Browser.Version.ToString(),
                ExceptionDateTime = DateTime.Now,
                InnerMessage      = extraMSGContext + ", " + ex.Message,
                IP         = HttpContext.Current.Request.UserHostName.Take(15), //Try see if the length of this field is causing the truncated exception
                Url        = HttpContext.Current.Request.Url.ToString(),
                UserEmail  = email,
                Reviewed   = false,
                UserID     = userID,
                StackTrace = ex.StackTrace.ToString()
            });

            string messsage = String.Format("{0} experienced exception[{1}]: {2}", UsersEmail, exceptionEvent.ID, ex.Message).Take(254);

            da.Insert(new LogEvent(userID, CFLogEventType.Exception, messsage.Take(254)));
        }
コード例 #5
0
        public PartnerCallShowReplyViewData(Guid id)
        {
            CFController cf = new CFController();

            CurrentReply = cf.GetPartnerCallReply(id);
            CurrentCall = cf.GetPartnerCall(CurrentReply.PartnerCallID);
            Replier = cf.GetClimberProfile(CurrentReply.ReplyingUserID);
        }
コード例 #6
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 });
        }
コード例 #7
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 });
        }
コード例 #8
0
        public ActionResult AddPlaceYouTube(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);
        }
コード例 #9
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);
     }
 }
コード例 #10
0
        public ActionResult Delete(Guid id)
        {
            MediaShare media = new CFController().GetMedia(id);

            if (media.SubmittedByUserID != UserID) { throw new Exception("You cannot delete media that does not belong to you media ID = " + id.ToString()); }

            new CFController().DeleteMedia(id);

            return RedirectToAction("UsersMedia", new { id = media.SubmittedByUserID });
        }
コード例 #11
0
        public ActionResult CommentOnPost(int id)
        {
            FeedClimbingPost post = new CFController().GetFeedClimbingPost(id);

            if (post == null) { return RedirectToAction("Index", "Home"); }
            else
            {
                return NoMetaView(post);
            }
        }
コード例 #12
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);
        }
コード例 #13
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);
            }
        }
コード例 #14
0
        public ActionResult DeletePost(int id)
        {
            FeedClimbingPost post = new CFController().GetFeedClimbingPost(id);

            if ((post.UserID != UserID) && !CFProfile.UserIsKrez) { throw new Exception("Cannot delete a feed post that doesn't belong to you"); }
            else
            {
                new CFController().DeleteFeedClimbingPost(post);
            }

            return RedirectToAction("Index", "Home");
        }
コード例 #15
0
        public ActionResult Detail(Guid id)
        {
            MediaShare media = new CFController().GetMedia(id);
            if (media == null) { return PageGoneView(); }
            else
            {
                string title = string.Format("{0} - Climbing {1} - Climbfind.com", media.Name, media.MediaTypeString);
                string keywords = string.Format("Climbing {1}, {0}", media.Name, media.MediaTypeString);

                SetPageMetaData(title, media.Description, keywords, PageRobots.IndexNoFollow);
                return View(media);
            }
        }
コード例 #16
0
 public override void OnActionExecuting(System.Web.Mvc.ActionExecutingContext filterContext)
 {
     IIdentity user = HttpContext.Current.User.Identity;
     if (user.IsAuthenticated)
     {
         ClimberProfile profile = new CFController().GetClimberProfileByEmail(user.Name);
         if (profile.IsUnfinished)
         {
             HttpContext.Current.Response.Redirect("/ClimberProfiles/Me", false);
             filterContext.Cancel = true;
         }
     }
 }
コード例 #17
0
        public ActionResult Detail(string country, string friendlyUrlName)
        {
            Club club = new CFController().GetClub(friendlyUrlName);

            if (club == default(Club)) { return RedirectToAction("Index"); }
            else
            {
                string title = club.Name + " - Mountaineering and Climbing Clubs - Climbfind.com";
                string description = string.Format("About the {0} and its members", club.Name);
                string keywords = string.Format("{0}, {1} Rock Climbing Clubs, Mountaineering in {1}", club.Name, club.Country);

                SetPageMetaData(title, description, keywords, PageRobots.IndexNoFollow);
                return View(club);
            }
        }
コード例 #18
0
        public ActionResult DeletePostComment(int id)
        {
            FeedPostComment comment = new CFController().GetFeedPostComment(id);

            if (comment == null) { return RedirectToAction("Index", "Home"); }
            else
            {
                if (comment.UserID != UserID) { throw new Exception("Cannot delete a feed post comment that doesn't belong to you"); }
                else
                {
                    new CFController().DeleteFeedPostComment(comment);
                }

                return RedirectToAction("CommentOnPost", new { id = comment.FeedPostID });
            }
        }
コード例 #19
0
 public void DelteLogs_Click(Object sender, EventArgs e)
 {
     CFController cf = new CFController();
     SaveLogEvents(l => cf.DeleteLogExceptionEvent(l));
 }
コード例 #20
0
 public ActionResult UsersMedia(Guid id)
 {
     ClimberProfile user = new CFController().GetClimberProfile(id);
     if (user == null) { return RedirectToAction("Index"); }
     else
     {
         string title = "Climbing media submitted by " + user.FullName + " - Climbfind.com";
         string description = "Climbing related movies, photos and other webmedia submitted by " + user.FullName + " on www.climbfind.com";
         string keywords = "Climbing movies, climbing photos, climbing media";
         SetPageMetaData(title, description, keywords, PageRobots.NoIndexNoFollow);
         return View(user);
     }
 }
コード例 #21
0
 public ActionResult PartnerAreaWidget(string countryUrl, string areaNameUrl)
 {
     AreaTag area = new CFController().GetAreaTagByCountryUrlAndName(countryUrl, areaNameUrl);
     if (area == null) { return RedirectToAction("Index"); }
     else
     {
         SetPageMetaData("Partner Area Widget: " + area.Name, "", "", PageRobots.NoIndexNoFollow);
         return View(area);
     }
 }
コード例 #22
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);
 }
コード例 #23
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);
 }
コード例 #24
0
        public ActionResult Subscribe(string location, string name)
        {
            Place place = new CFController().GetPlace(location, name);

            if (place == null) { return RedirectToAction("Index"); }
            else
            {
                SetPageMetaData();
                return View(place);
            }
        }
コード例 #25
0
        public static void RecordException(Exception ex, string extraMSGContext)
        {
            Guid userID = new Guid();
            string email = "anonymous";

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                email = HttpContext.Current.User.Identity.Name;
                userID = new CFController().GetClimberProfileByEmail(email).ID;
            }

            MailMan.SendAppExceptionEmail(ex, email);

            LogExceptionEvent exceptionEvent = exDA.Insert(
                new LogExceptionEvent
                {
                    Browser = HttpContext.Current.Request.Browser.Browser.ToString() + " v" + HttpContext.Current.Request.Browser.Version.ToString(),
                    ExceptionDateTime = DateTime.Now,
                    InnerMessage = extraMSGContext + ", " + ex.Message,
                    IP = HttpContext.Current.Request.UserHostName.Take(15), //Try see if the length of this field is causing the truncated exception
                    Url = HttpContext.Current.Request.Url.ToString(),
                    UserEmail = email,
                    Reviewed = false,
                    UserID = userID,
                    StackTrace = ex.StackTrace.ToString()
                });

            string messsage = String.Format("{0} experienced exception[{1}]: {2}", UsersEmail, exceptionEvent.ID, ex.Message).Take(254);
            da.Insert(new LogEvent(userID, CFLogEventType.Exception, messsage.Take(254)));
        }
コード例 #26
0
        public ActionResult NewPost(int? placeID)
        {
            SetPageMetaData();

            if (!placeID.HasValue)
            {
                return RedirectToAction("NewPostPlace");
            }
            else
            {
                Place place = new CFController().GetPlace(placeID.Value);

                if (place == null) { return RedirectToAction("NewPostPlace"); }
                else
                {
                    return Content("You can no longer post on CF3, please use www.climbfind.com");
                }
            }
        }
コード例 #27
0
        public ActionResult RequestToWatchClimber(Guid id)
        {
            FeedClimberChannelRequest watchedClimberEntry = new CFController().GetClimberWatchEntry(UserID, id);

            if (watchedClimberEntry == null)
            {
                new CFController().SendClimberWatchRequest(id, UserID);
            }
            else
            {
                throw new Exception("You have already sent a watch request to this climber.");
            }

            return RedirectToAction("ClimbersImWatching");
        }