Exemplo n.º 1
0
 public IEnumerable <TopoTrailInfo> ListTrailsSorted()
 {
     if (String.IsNullOrWhiteSpace(SelectedSort))
     {
         SelectedSort = "Newest";
     }
     if (IsSortSelected("Region"))
     {
         return(Trails.OrderBy(x => (x.Region == null ? "" : x.Region.RegionName)).ThenBy(x => x.Name).ThenByDescending(x => x.StartLocal));
     }
     else if (IsSortSelected("Name"))
     {
         return(Trails.OrderBy(x => x.Name).ThenByDescending(x => x.StartLocal));
     }
     else if (IsSortSelected("Newest"))
     {
         return(Trails.OrderByDescending(x => x.StartLocal).ThenBy(x => x.Name));
     }
     else if (IsSortSelected("Oldest"))
     {
         return(Trails.OrderBy(x => x.StartLocal).ThenBy(x => x.Name));
     }
     else
     {
         return(Trails);
     }
 }
Exemplo n.º 2
0
 // add new trail
 public void Addnewtrail(Trails trail)
 {
     using (IDbConnection dbConnection = Connection){
         string query = "INSERT INTO trails (name, description, miles, elevation, longitude, latitude, created_at, update_at) VALUES (@Name, @Discription, @Miles, @Elevation, @Longitude, @Latitude, NOW(), NOW())";
         dbConnection.Open();
         dbConnection.Execute(query, trail);
     }
 }
        public Trails GetTrails()
        {
            var result = new Trails();

            result.Allocate();
            GetTrailDataInternal(ref result);
            return(result);
        }
Exemplo n.º 4
0
 public AimState(MissileStateController missileStateController, FireMissile fireMissile) : base(missileStateController, fireMissile)
 {
     mIsScanTrue      = false;
     mSelfRotateSpeed = 90f;
     mRelocateRange   = 2000f;
     Trails.SetActive(false);
     Debug.Log("Aim");
 }
Exemplo n.º 5
0
    public static void GenerateTrailBlack(Transform origin, Transform target, float height, float time)
    {
        Trails trail = GameObject.Instantiate(Resources.Load <GameObject>("Effects/BlackTrails"), origin.position, Quaternion.identity).GetComponent <Trails>();

        trail.start  = origin;
        trail.end    = target;
        trail.height = height;
        trail.time   = time;
    }
Exemplo n.º 6
0
        private static void UpdateTrailsComments(Trails trail, ObjectId newId, IMongoCollection <Trails> trails)
        {
            trail.Comments_Ids.Add(newId);
            var filter = Builders <Trails> .Filter.Eq("_id", trail._id);

            var update = Builders <Trails> .Update.Set("Comments_Ids", trail.Comments_Ids);

            trails.UpdateOneAsync(filter, update);
        }
        public IActionResult TrailsDetail(int Id)
        {
            Trails         x = TrailDAL.GetTrailById(Id);
            List <Forcast> f = TrailDAL.OpenWeatherGetForcast(x.Location);

            ViewBag.Forcast = f;
            ViewBag.Water   = x.Length % 6;
            return(View(x));
        }
        public Trails GetTrails()
        {
            var result = new Trails()
            {
                positions = new List <Vector4>(), frontPositions = new List <int>(), backPositions = new List <int>(), positionCounts = new List <int>()
            };

            GetTrailDataInternal(ref result);
            return(result);
        }
Exemplo n.º 9
0
        private static Options UpdateOptions(string value, Trails trail)
        {
            var option = trail.Option;

            dynamic update = JObject.Parse(value);

            var distance = update.Distance.Value ?? "";

            if (!string.IsNullOrEmpty(distance.ToString()))
            {
                option.Distance = Convert.ToDouble(update.Distance.Value);
            }

            var peak = update.Peak.Value ?? "";

            if (!string.IsNullOrEmpty(peak.ToString()))
            {
                option.Peak = Convert.ToInt32(update.Peak.Value);
            }

            var elevation = update.Elevation.Value ?? "";

            if (!string.IsNullOrEmpty(elevation.ToString()))
            {
                option.Elevation = Convert.ToDouble(update.Elevation.Value);
            }


            if (!string.IsNullOrEmpty(update.SeasonStart.Value.ToString()))
            {
                option.SeasonStart_Id = DbMongoHelpers.TryParseObjectId(update.SeasonStart.Id.Value);
            }

            if (!string.IsNullOrEmpty(update.SeasonEnd.Value.ToString()))
            {
                option.SeasonEnd_Id = DbMongoHelpers.TryParseObjectId(update.SeasonEnd.Id.Value);
            }


            if (!string.IsNullOrEmpty(update.Type.Value.ToString()))
            {
                option.TrailType_Id = DbMongoHelpers.TryParseObjectId(update.Type.Id.Value);
            }

            if (!string.IsNullOrEmpty(update.DurationType.Value.ToString()))
            {
                option.TrailDurationType_Id = DbMongoHelpers.TryParseObjectId(update.DurationType.Id.Value);
            }

            option.GoodForKids = update.GoodForKids.Value;
            option.DogAllowed  = update.DogAllowed.Value;

            return(option);
        }
Exemplo n.º 10
0
        private StackLayout GenerateStackContainer(Trails trail)
        {
            StackLayout stackContainer = new StackLayout
            {
                Orientation     = StackOrientation.Vertical,
                BackgroundColor = Color.White,
                //Padding = new Thickness(10, 10)
            };

            Label mainLabel = GenericsContent.GenerateMainLabel();

            stackContainer.Children.Add(mainLabel);

            Label rateLabel = new Label
            {
                Text      = $"Rate {trail.Rate.ToString("N1")}",
                FontSize  = pageDefaultFontSize,
                TextColor = pageDefaultFontColor
            };

            stackContainer.Children.Add(rateLabel);

            Label trailName = new Label
            {
                Text           = trail.Name,
                FontSize       = 22,
                FontAttributes = FontAttributes.Bold,
                TextColor      = pageDefaultFontColor
            };

            stackContainer.Children.Add(trailName);

            Label locationLabel = new Label
            {
                Text      = $"{trail.Region} {trail.Country}",
                FontSize  = pageDefaultFontSize,
                TextColor = pageDefaultFontColor
            };

            stackContainer.Children.Add(locationLabel);

            //var map = new Map(
            //MapSpan.FromCenterAndRadius(
            //        new Position(37, -122), Distance.FromMiles(0.3)))
            //{
            //    IsShowingUser = true,
            //    HeightRequest = 100,
            //    WidthRequest = 960,
            //    VerticalOptions = LayoutOptions.FillAndExpand
            //};
            //stackContainer.Children.Add(map);

            return(stackContainer);
        }
Exemplo n.º 11
0
 public IActionResult Create(Trails trail)
 {
     if (ModelState.IsValid)
     {
         trailfactory.Addnewtrail(trail);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View("AddTrail"));
     }
 }
Exemplo n.º 12
0
 public IActionResult CreateRecord(Trails trail)
 {
     if (ModelState.IsValid)
     {
         trailsFactory.Add(trail);
         return(RedirectToAction("AddPage"));
     }
     else
     {
         return(View("AddPage", trail));
     }
 }
Exemplo n.º 13
0
 public TransposeState(MissileStateController missileStateController, FireMissile fireMissile) : base(missileStateController, fireMissile)
 {
     mIsTransposeDone      = false;
     mIsAdjustmentDone     = false;
     mScanTime             = 0;
     mAdjustmentForce      = 250f;
     mCounterForece        = 500f;
     mMaxSpeed             = 100;
     mTransposeSpeed       = 1f;
     mMinAccelerationAngle = 2.5f;
     Trails.SetActive(true);
     Debug.Log("Transpose");
 }
Exemplo n.º 14
0
        private StackLayout GenerateStackContainer(Trails trail)
        {
            StackLayout stackContainer = new StackLayout
            {
                Orientation = StackOrientation.Vertical,
                BackgroundColor = Color.White,
                //Padding = new Thickness(10, 10)
            };

            Label mainLabel = GenericsContent.GenerateMainLabel();
            stackContainer.Children.Add(mainLabel);

            Label rateLabel = new Label
            {
                Text = $"Rate {trail.Rate.ToString("N1")}",
                FontSize = pageDefaultFontSize,
                TextColor = pageDefaultFontColor
            };
            stackContainer.Children.Add(rateLabel);

            Label trailName = new Label
            {
                Text = trail.Name,
                FontSize = 22,
                FontAttributes = FontAttributes.Bold,
                TextColor = pageDefaultFontColor
            };
            stackContainer.Children.Add(trailName);

            Label locationLabel = new Label
            {
                Text = $"{trail.Region} {trail.Country}",
                FontSize = pageDefaultFontSize,
                TextColor = pageDefaultFontColor
            };
            stackContainer.Children.Add(locationLabel);

            //var map = new Map(
            //MapSpan.FromCenterAndRadius(
            //        new Position(37, -122), Distance.FromMiles(0.3)))
            //{
            //    IsShowingUser = true,
            //    HeightRequest = 100,
            //    WidthRequest = 960,
            //    VerticalOptions = LayoutOptions.FillAndExpand
            //};
            //stackContainer.Children.Add(map);

            return stackContainer;
        }
Exemplo n.º 15
0
 public CaracteristicasDeImpactoComSalto(
     NoImpacto noImpacto,
     Trails trail,
     ToqueAoChao toque,
     PreparaSalto prepara,
     ImpactoAereoFinal final,
     bool parentearNoOsso = true
     )
 {
     this.noImpacto       = noImpacto;
     this.trail           = trail;
     this.toque           = toque;
     this.prepara         = prepara;
     this.final           = final;
     this.parentearNoOsso = parentearNoOsso;
 }
Exemplo n.º 16
0
        public MasterViewModel(int selection)
        {
            LoadDataAsync(selection);

            ItemTappedCommand = new Command((obj) =>
            {
                TrailViewModel trail = obj as TrailViewModel;

                var trailViews = Trails
                                 .Where(d => d.TrailID == trail.TrailID)
                                 .Select(d => d)
                                 .Single();
                var mainPage  = App.Current.MainPage;
                var navgation = mainPage.Navigation;
                navgation.PushAsync(new Views.TrailPage(trailViews));
            });
        }
Exemplo n.º 17
0
        public static double getAllCommentsForThisTrail(Trails trail, double rate, List <CommentsModel> comments)
        {
            foreach (var comment in trail.Comments_Ids.Select(commentId => DBComments.GetById(commentId)))
            {
                rate += comment.Rate;
                comments.Add(
                    new CommentsModel
                {
                    Rate    = comment.Rate,
                    Comment = comment.Comment,
                    Name    = comment.User.GetById(comment.User_Id).Name
                }
                    );
            }

            return(rate);
        }
Exemplo n.º 18
0
        public IActionResult Index()
        {
            Trails test = new Trails();

            test.Trail_Name       = "another trail";
            test.Description      = "Yadad   jashadadada";
            test.Trail_Length     = 1234256;
            test.Elevation_Change = 223423;
            test.Latitude         = 87585;
            test.Longitude        = 2353535;
            // trailsFactory.Add(test);
            // List<Dictionary<Trails, object>> AllTrails = trailsFactory.FindAll();
            // // IEnumerable<Trails> AllTrails = trailsFactory.FindAll();
            var AllTrails = trailsFactory.FindAll();

            ViewBag.Trails = AllTrails;
            return(View());
        }
Exemplo n.º 19
0
 public List <CommentsModel> InitCommentsModelList(Trails trail, List <Comments> comments)
 {
     try
     {
         return(comments
                .Where(i => i.TrailId == trail.Id)
                .Select(i => new CommentsModel
         {
             Name = i.UserName,
             Comment = i.Comment,
             Rate = i.Rate
         }).ToList());
     }
     catch (ArgumentNullException)
     {
         throw new NotFoundException("Not found data for comments model");
     }
 }
Exemplo n.º 20
0
 public List <CommentsModel> InitCommentsModelList(Trails trail, List <Comments> commentses)
 {
     try
     {
         return(trail.Comments_Ids
                .Select(commentId => commentses.FirstOrDefault(i => i._id == commentId))
                .Select(comment => new CommentsModel
         {
             Comment = comment.Comment,
             Name = comment.User.UserName,
             Rate = comment.Rate
         }).ToList());
     }
     catch (ArgumentNullException)
     {
         throw new NotFoundException("Not found data for comments model");
     }
 }
Exemplo n.º 21
0
        public FullTrailModel InitFullTrailModel(
            Trails trail,
            List <CommentsModel> comments,
            List <SimpleModel> photos,
            List <SimpleModel> references)
        {
            var rate = 0.0;

            rate = comments.Count > 0 ? comments.Sum(i => i.Rate) / comments.Count : rate;

            try
            {
                return
                    (new FullTrailModel
                {
                    Id = trail.Id.ToString(),
                    Comments = comments,
                    Country = trail.Locations.Countries.Name,
                    Description = trail.Description,
                    Difficult = trail.Difficults.Value,
                    Distance = trail.Options.Distance,
                    DogAllowed = trail.Options.DogAllowed,
                    DurationType = trail.Options.TrailsDurationTypes.DurationType,
                    CoverPhoto = trail.CoverPhoto,
                    Elevation = trail.Options.Elevation,
                    FullDescription = trail.FullDescription,
                    GoodForKids = trail.Options.GoodForKids,
                    Name = trail.Name,
                    Region = trail.Locations.Regions.Region,
                    Peak = trail.Options.Peak,
                    Photos = photos.Select(i => i.Value).ToList(),
                    References = references.Select(i => i.Value).ToList(),
                    Rate = Math.Round(rate, 2),
                    SeasonEnd = trail.Options.SeasonEnd.Season,
                    SeasonStart = trail.Options.SeasonStart.Season,
                    Type = trail.Options.TrailsTypes.Type,
                    WhyGo = trail.WhyGo
                });
            }
            catch (ArgumentNullException)
            {
                throw new NotFoundException("Not found data for fulltrail model");
            }
        }
Exemplo n.º 22
0
        public string Check()
        {
            if (username == "")
            {
                return(Announ("emptyfield", "username"));
            }
            if (name == "")
            {
                return(Announ("emptyfield", "email"));
            }
            if (password == "")
            {
                return(Announ("emptyfield", "password"));
            }
            //if (password.CompareTo(cPassword) != 0) return Announ("PasswordNotConfirmed", "none");
            Trails tObject = new Trails();

            return(Announ("success", "sc"));
        }
Exemplo n.º 23
0
        public IActionResult AddToBucketList(string name, string location, string summary, string image, decimal length, string date)
        {
            if (User.Identity.IsAuthenticated)
            {
                string status = "https://www.trzcacak.rs/myfile/detail/51-515377_x-mark-transparent-background-png-x.png";
                string id     = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                var    input  = new Trails {
                    UserId = id, Location = location, Name = name, Summary = summary, ImgSmallMed = image, Length = length, Date = date, CompleteMark = status
                };


                _db.Add(input);
                _db.SaveChanges();
                int count = _db.Trails.Count();
                ViewBag.Count = count;
                return(RedirectToAction(nameof(Confirm)));
            }
            else
            {
                return(RedirectToAction("./Identity/Account/Login"));
            }
        }
Exemplo n.º 24
0
 /// <summary>
 /// 停止自转,冲刺,上升,预加速,
 /// </summary>
 private void Dash()
 {
     mX = Mathf.SmoothDamp(mX, -90, ref mRef, mSmootTime, 30, 1f); //弹头朝上
     GameObject.transform.rotation = Quaternion.Euler(mX, 0, 0);
     if (mRigidbody.velocity.magnitude < mDashMaxSpeed ||
         Vector3.Distance(GameObject.transform.position, mAimTankPos) <= mDashMaxDistance ||
         Vector3.Angle(GameObject.transform.forward.normalized, new Vector3(0, 1, 0)) > mMinAccelerationAngle)    // 速度,高度,角度,任意条件都满足才进行瞄准
     {
         mRigidbody.AddForce(0, Mathf.Abs(Mathf.Sin(mX)) * mDashForce, 0, ForceMode.Force);
     }
     else //到达后冲刺结束,计算得到需要朝向的方向
     {
         mIsDashComplete         = true;
         mMissileTargetDirection = (mAimTankPos - GameObject.transform.position).normalized;
         Debug.DrawLine(GameObject.transform.position, mAimTankPos, Color.blue, 100f);
     }
     ///拖尾效果
     if (!Trails.activeSelf)
     {
         Trails.SetActive(true);
     }
 }
Exemplo n.º 25
0
 public FullTrailModel InitFullTrailModel(
     Trails trail,
     List <CommentsModel> comments)
 {
     try
     {
         return(new FullTrailModel
         {
             Id = trail._id.ToString(),
             Comments = comments,
             Country = trail.Location.Country.Name,
             Description = trail.Description,
             Difficult = trail.Difficult.Value,
             Distance = trail.Option.Distance,
             DogAllowed = trail.Option.DogAllowed,
             DurationType = trail.Option.TrailDurationType.DurationType,
             CoverPhoto = trail.CoverPhoto,
             Elevation = trail.Option.Elevation,
             FullDescription = trail.FullDescription,
             GoodForKids = trail.Option.GoodForKids,
             Name = trail.Name,
             Region = trail.Location.Region.Region,
             Peak = trail.Option.Peak,
             Photos = trail.Photos,
             //Rate = trail.Comments.I
             References = trail.References,
             SeasonEnd = trail.Option.SeasonEnd.Season,
             SeasonStart = trail.Option.SeasonStart.Season,
             Type = trail.Option.TrailType.Type,
             WhyGo = trail.WhyGo
         });
     }
     catch (ArgumentNullException)
     {
         throw new NotFoundException("Not found data for full trail model");
     }
 }
 extern public void SetTrails(Trails trailData);
 extern private void GetTrailDataInternal(ref Trails trailData);
 public int GetTrails(ref Trails trailData)
 {
     trailData.Allocate();
     GetTrailDataInternal(ref trailData);
     return(trailData.positions.Count);
 }
Exemplo n.º 29
0
 public int GetTrailCount(int year, int month)
 {
     return(Trails.Count(x => x.StartLocal.Year == year && x.StartLocal.Month == month));
 }
Exemplo n.º 30
0
 // ==================================================
 // Helpers
 public int GetTrailCount(GeoCountryInfo country)
 {
     return(Trails.Count(x => x.Country.CountryID == country.CountryID));
 }
 public CaracteristicasDeImpacto(Trails trail, NoImpacto noImpacto, bool parentearOsso)
 {
     nomeTrail            = trail.ToString();
     this.noImpacto       = noImpacto.ToString();
     this.parentearNoOsso = parentearOsso;
 }