예제 #1
0
        public ActionResult CreateAuto(Walk walk)
        {
            // ----This should really be done by a customised Model Binder-----------
            Walk oWalk = new Walk();

            WalkingStick.FillWalkFromFormVariables(ref oWalk, Request.Form);
            int iWalkID = this.repository.AddWalk(oWalk);

            // ---Add hill ascents-----------------
            List <HillAscent> arHillAscents = WalkingStick.FillHillAscentsFromFormVariables(iWalkID, this.Request.Form);

            repository.AddWalkSummitsVisited(arHillAscents);

            // ---Add the associated files-----
            // --TODO - this needs to change to pull files from disk rather than form variable
            List <Walk_AssociatedFile> arWalkAssociatedFiles = WalkingStick.FillWalkAssociatedFilesByExaminingDirectory(
                iWalkID,
                this.Request.Form,
                this.Server.MapPath("~/Content/images/").Replace("\\", "/"));

            repository.AddWalkAssociatedFiles(arWalkAssociatedFiles);

            //---Redirect to the newly created walk to continue editing
            return(RedirectToAction("Edit", new { id = iWalkID }));
        }
예제 #2
0
        public JsonResult HillSuggestions(string term, string areaid = "")
        {
            var hillsuggestions = new List <AutocompleteSuggestionOption>();

            IQueryable <Hill> IQHillsAboveHeight;

            if (areaid.Equals("") && areaid.Length < 2)
            {
                IQHillsAboveHeight = this.repository.FindHillsByNameLike(term);
            }
            else
            {
                IQHillsAboveHeight = this.repository.FindHillsInAreaByNameLike(term, areaid);
            }

            foreach (Hill item in IQHillsAboveHeight)
            {
                var optionlabel = WalkingStick.FormatHillSummaryAsLine(item);
                var optionvalue = optionlabel + "|" + item.Hillnumber;

                hillsuggestions.Add(new AutocompleteSuggestionOption {
                    label = optionlabel, value = optionvalue
                });
            }

            return(Json(hillsuggestions, JsonRequestBehavior.AllowGet));
        }
예제 #3
0
        public ActionResult Create(Walk walk)
        {
            // ----This should really be done by a customised Model Binder-----------
            Walk oWalk = new Walk();

            WalkingStick.FillWalkFromFormVariables(ref oWalk, Request.Form);
            int iWalkID = this.repository.AddWalk(oWalk);

            // ---Add hill ascents-----------------
            List <HillAscent> arHillAscents = WalkingStick.FillHillAscentsFromFormVariables(iWalkID, this.Request.Form);

            repository.AddWalkSummitsVisited(arHillAscents);

            // ---Add the associated files-----
            List <Walk_AssociatedFile> arAssociatedFiles = WalkingStick.FillHillAssociatedFilesFromFormVariables(
                iWalkID,
                this.Request.Form,
                this.Server.MapPath("/"));

            repository.AddWalkAssociatedFiles(arAssociatedFiles);

            // ---update any markers created by ajax call with walk id, and add any marker observations----------------
            repository.AssociateMarkersWithWalk(Request.Form, iWalkID);
            if ((walk.HillAscents.Count > 0))
            {
                return(RedirectToAction("HillsByArea", new { id = oWalk.Area.Arearef.Trim(), page = 1 }));
            }

            return(RedirectToAction("WalksByDate", new { OrderBy = "DateDesc" }));
        }
예제 #4
0
        public ActionResult Details(int id)
        {
            Walk   oWalk        = this.repository.GetWalkDetails(id);
            string strTotalTime = WalkingStick.ConvertTotalTimeToString(oWalk.WalkTotalTime, false);

            ViewData["TotalTime"] = strTotalTime;

            return(this.View(oWalk));
        }
예제 #5
0
        public ActionResult Create(Marker oFormMarker)
        {
            Marker oNewMarker = WalkingStick.FillMarkerFromFormVariables(oFormMarker, Request.Form);

            this.repository.CreateMarker(oNewMarker);

            var oMarkerStatusii = this.repository.GetAllMarkerStatusOptions().AsEnumerable();

            ViewData["MarkerStatusii"] = new SelectList(oMarkerStatusii, "Marker_Status1", "Marker_Status1");

            return(RedirectToAction("Index"));
        }
예제 #6
0
        public override void _Ready()
        {
            _stats = GetNode <Stats>("PlayerStats");
            _stats.Connect("NoHealth", this, nameof(Death));

            _animationTree        = GetNode <AnimationTree>("AnimationTree");
            _animationState       = (AnimationNodeStateMachinePlayback)_animationTree.Get("parameters/playback");
            _animationTree.Active = true;
            _blinkAnimationPlayer = GetNode <AnimationPlayer>("BlinkAnimationPlayer");

            _hurtBox = GetNode <HurtBox>("HurtBox");

            _walkingStickHitBox = GetNode <WalkingStick>("HitboxPivot/WalkingStickHitBox");
        }
예제 #7
0
        // ------------------------------------------------------------------------------------------------
        //  WalkSuggestions
        //  Used as the AJAX server side for an autocomplete function on a client side textbox - Create Marker
        // -----------------------
        public JsonResult WalkSuggestions(string term)
        {
            var IQWalks = repository.FindWalksByTitleLike(term);

            var suggestedWalks = new List <AutocompleteSuggestionOption>();

            foreach (Walk oWalk in IQWalks)
            {
                var walkTitle = WalkingStick.FormatWalkAsLine(oWalk);
                suggestedWalks.Add(new AutocompleteSuggestionOption {
                    label = walkTitle, value = walkTitle + " | " + oWalk.WalkID
                });
            }
            return(Json(suggestedWalks, JsonRequestBehavior.AllowGet));
        }
예제 #8
0
        // ------------------------------------------------------------------------------------------------
        //  MarkerSuggestions
        //  Used as the AJAX server side for an autocomplete function on a client side textbox
        // -----------------------
        public JsonResult MarkerSuggestions(string term)
        {
            var markeroptions = new List <AutocompleteSuggestionOption>();
            var IQMarkers     = repository.FindMarkersByNameLike(term);

            foreach (Marker item in IQMarkers)
            {
                markeroptions.Add(new AutocompleteSuggestionOption
                {
                    label = WalkingStick.FormatMarkerAsLine(item) + ("|" + (item.MarkerID.ToString().Trim())),
                    value = WalkingStick.FormatMarkerAsLine(item) + ("|" + (item.MarkerID.ToString().Trim()))
                });
            }

            return(Json(markeroptions, JsonRequestBehavior.AllowGet));
        }
예제 #9
0
        /// <summary>
        /// Called from Create walk and Edit walk jQuery UI autocomplete widget
        /// </summary>
        /// <param name="term">at least two characters of the walk area</param>
        /// <param name="options"></param>
        /// <returns>JSON formatted results</returns>
        public JsonResult WalkAreaSuggestions(string term, string options = "")
        {
            var IQWalkAreas = this.repository.FindWalkAreasByNameLike(term);

            var areaoptions = new List <AutocompleteSuggestionOption>();

            foreach (Area item in IQWalkAreas)
            {
                areaoptions.Add(new AutocompleteSuggestionOption {
                    label = WalkingStick.FormatWalkAreaAsLine(item), value = WalkingStick.FormatWalkAreaAsLine(item) + " | " + item.Arearef
                });
            }

            var myjson = Json(areaoptions, JsonRequestBehavior.AllowGet);

            return(myjson);
        }
예제 #10
0
        public ActionResult WalkingAreasByCountry(string strCountryCode, string strAreaType = "")
        {
            string strCountryName  = WalkingStick.CountryNameFromCountryCode(strCountryCode);
            string strAreaTypeName = "";

            ViewData["CountryName"] = strCountryName;

            IQueryable <Area> iqWalkingAreas;

            if (strAreaType.Equals(""))
            {
                iqWalkingAreas = this.repository.GetAllWalkingAreas(strCountryCode);
            }
            else
            {
                iqWalkingAreas  = this.repository.GetAllWalkingAreas(strCountryCode, strAreaType);
                strAreaTypeName = repository.GetWalkAreaTypeNameFromType(strAreaType);
            }
            ViewData["AreaTypeName"] = strAreaTypeName;

            return(this.View(iqWalkingAreas));
        }
예제 #11
0
        // ------------------------------------------------------------------------------------------------
        //  CheckImages
        //  Used as the AJAX server side to check that images are present in specified directory
        // -----------------------
        public JsonResult CheckImages(string imagepath, string options = "")
        {
            string strAtWork = "False";

            if (SessionSingleton.Current.UsageLocation == WalkingConstants.AT_WORK)
            {
                strAtWork = "True";
            }

            imagepath = imagepath.Replace("\\", "/");
            int iLoc;

            try {
                iLoc = imagepath.LastIndexOf("/", StringComparison.Ordinal);
            }
            catch (Exception) {
                iLoc = 0;
            }

            string strPath = imagepath.Substring(0, iLoc);


            string strRootPath = Server.MapPath("~/Content/images/").Replace("\\", "/");

            // -----Check that the path specified is valid------------------------
            if (!WalkingStick.DetermineIfDirectoryExists(strRootPath + strPath))
            {
                ViewData["checkresults"] = "{\"Error\" | \"Directory Not Found.\"}";
                return(Json(new { Error = "Directory [" + strRootPath + strPath + "] Not Found." }, JsonRequestBehavior.AllowGet));
            }


            // ----Now check that images are found in this directory------------------
            var oResults = WalkingStick.CheckFilesInDirectory(VirtualPathUtility.ToAbsolute("~/"), strPath, imagepath.Substring((iLoc + 1), ((imagepath.Length - iLoc)
                                                                                                                                             - 1)), ref strRootPath, bool.Parse(strAtWork));

            return(Json(oResults, JsonRequestBehavior.AllowGet));
        }