Пример #1
0
        //*************************************************************
        //*** Returns A List of TTB Permits Within Specified Radius ***
        //*************************************************************
        public static List <TTBWinePermit> GetTTBWinePermits(double latrad, double lngrad, int radius)
        {
            using (WOMOEntities db = new WOMOEntities())
            {
                //List<int> permitListInt = new List<int>();
                List <TTBWinePermit> permitRecordRadiusList = new List <TTBWinePermit>();

                foreach (var permit in db.TTBWinePermits)
                {
                    if ((permit.Lat != null) || (permit.Lng != null))
                    {
                        double lat = (double)permit.Lat;
                        double lng = (double)permit.Lng;

                        var distance = distance2PointsAsCrowFlies(lat, lng, latrad, lngrad);

                        //Needs to be established as a setting from the user
                        //var radius = 30;
                        if (distance < radius)
                        {
                            permitRecordRadiusList.Add(permit);
                        }
                    }
                }
                return(permitRecordRadiusList);
            }
        }
Пример #2
0
 //**************************************************************
 //**************************************************************
 public static IEnumerable <TTBWinePermit> GetTTBWinePermitById(int winePermitId)
 {
     using (WOMOEntities db = new WOMOEntities())
     {
         var permit = db.TTBWinePermits.FirstOrDefault(p => p.WinePermitId == winePermitId);
         return(new[] { permit });
     }
 }