void INodeCreator.CreateShops() { double radius = 5; using (UndeadEarthDataContext dataContext = new UndeadEarthDataContext(_connectionString)) { List<StoreDto> storeDtos = new List<StoreDto>(); foreach (HotZoneDto hotZoneDto in dataContext.HotZoneDtos) { UndeadEarth.Contract.Tuple<double, double> north = _distanceCalculator.GetNorthernPoint((double)hotZoneDto.Latitude, (double)hotZoneDto.Longitude, radius); UndeadEarth.Contract.Tuple<double, double> south = _distanceCalculator.GetSouthernPoint((double)hotZoneDto.Latitude, (double)hotZoneDto.Longitude, radius); UndeadEarth.Contract.Tuple<double, double> east = _distanceCalculator.GetEasternPoint((double)hotZoneDto.Latitude, (double)hotZoneDto.Longitude, radius); UndeadEarth.Contract.Tuple<double, double> west = _distanceCalculator.GetWesternPoint((double)hotZoneDto.Latitude, (double)hotZoneDto.Longitude, radius); UndeadEarth.Contract.Tuple<double, double> points = GetRandomPoint(north, south, east, west); var shop = new StoreDto(); shop.Id = Guid.NewGuid(); shop.HotZoneId = hotZoneDto.Id; shop.Name = string.Format("Shop at {0}", hotZoneDto.Name); shop.Latitude = (decimal)points.Item1; shop.Longitude = (decimal)points.Item2; storeDtos.Add(shop); } dataContext.StoreDtos.InsertAllOnSubmit(storeDtos); dataContext.SubmitChanges(); storeDtos.Clear(); } }
partial void DeleteStoreDto(StoreDto instance);
partial void UpdateStoreDto(StoreDto instance);
partial void InsertStoreDto(StoreDto instance);