Example #1
0
        public void CanGetLocationByTrainingCenterInDatabase()
        {
            // Arrange Everything We Need For Our Unit Tests
            options = new DbContextOptionsBuilder <ApplicationDBContext>()
                      .UseInMemoryDatabase(databaseName: "TestRevatureHousingData")
                      .Options;
            testContext            = new ApplicationDBContext(options);
            dummyLocationsData     = new LocationDummyData();
            dummyLocations         = dummyLocationsData.LocationsList;
            testLocationRepository = new LocationRepository(testContext);
            testLocationController = new LocationsController(testLocationRepository);
            dummyConstantLocation  = new Location()
            {
                LocationID = 3
            };
            //Arrange
            Populate();
            //Act
            var GetLocationWithProviderResult = testLocationController.GetLocationByTrainingCenter(14.ToString()).Result.Value.ToList()[0];

            //Assert
            Assert.IsInstanceOfType(GetLocationWithProviderResult, typeof(Location));
            //Clearing Changes
            ClearAllChanges();
        }
Example #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Location location = LocationRepository.GetSingle(id);

            try
            {
                LocationRepository.Delete(location);
                LocationRepository.Save();

                if (IsSuperAdmin)
                {
                    return(RedirectToAction("Index", new { storeId = location.StoreId }));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex, "Unable to delete:" + ex.StackTrace, location);
                //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists see your system administrator.");
            }
            return(View(location));
        }
        public async void CreateAsync_GivenValidInformation_CheckIfProjectWasCreatedThenDelete()
        {
            var loc = new LocationCreateDTO()
            {
                City    = "Copenhagen",
                Country = "Denmark"
            };

            using (var repo = new LocationRepository(context))
            {
                var id = await repo.CreateAsync(loc);

                var location = await repo.FindAsync(id);

                var project = new CreateProjectDTO
                {
                    Title       = "Super hot flaming bicycle",
                    Description = "This project is about creating the coolest bike ever.",
                    Location    = location
                };

                using (var repo1 = new ProjectRepository(context))
                {
                    var idproj = await repo1.CreateAsync(project, creator.Id);

                    Assert.NotNull(await context.Projects.FindAsync(idproj));
                    Assert.True(await repo1.DeleteAsync(idproj));
                }
            }
        }
        public void LocationReplository_ShouldImplimentILocationReplository()
        {
            var context = new Mock <EggProductionDbContext>().Object;
            var repo    = new LocationRepository(context);

            repo.Should().BeAssignableTo <ILocationRepository>();
        }
Example #5
0
        public void CantGetLocationByTrainingCenterNotInDatabase()
        {
            // Arrange Everything We Need For Our Unit Tests
            options = new DbContextOptionsBuilder <ApplicationDBContext>()
                      .UseInMemoryDatabase(databaseName: "TestRevatureHousingData")
                      .Options;
            testContext            = new ApplicationDBContext(options);
            dummyLocationsData     = new LocationDummyData();
            dummyLocations         = dummyLocationsData.LocationsList;
            testLocationRepository = new LocationRepository(testContext);
            testLocationController = new LocationsController(testLocationRepository);
            dummyConstantLocation  = new Location()
            {
                LocationID = 3
            };
            //Arrange
            Populate();
            string inValidTrainingCenter = "InValidTrainingCenter";
            //Act
            var GetLocationWithProviderResult = testLocationController.GetLocationByTrainingCenter(inValidTrainingCenter).Result.Value.ToList();

            //Assert
            Assert.AreEqual(GetLocationWithProviderResult.Count(), 0);
            ClearAllChanges();
        }
        public void Initialize()
        {
            var seattle = new Location
            {
                LocationId       = 1,
                Country          = "UnitedStates",
                City             = "Seattle",
                CountryCode      = "US",
                LocationTimeZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")
            };

            var paris = new Location
            {
                LocationId       = 2,
                Country          = "France",
                City             = "Paris",
                CountryCode      = "FR",
                LocationTimeZone = TimeZoneInfo.FindSystemTimeZoneById("W. Europe Standard Time")
            };

            _locations = new List <Location> {
                seattle, paris
            };

            var repository = new LocationRepository
            {
                GetAll = () => _locations.AsQueryable()
            };

            //Create an instance of controller with a fake repository that retrieve data from list instead of db
            _controller = new LocationsController(repository);
        }
        public JsonResult IsValidLocation(string locationName)
        {
            LocationRepository locationRepository = new LocationRepository();
            var result = policyLocationRepository.GetPolicyLocationLocationByName(locationName);

            return(Json(result));
        }
        public LocationRepositoryTests()
        {
            _mockReader = new Mock<IManagedDataReader>();
            _mockLocationGroupBuilder = new Mock<ILocationGroupBuilder>();
            _mockLocationFormatter = new Mock<IConditionalFormatter<string, string>>();

            _mockConnectionManager = new Mock<IConnectionManager>();
            _mockConnectionManager.Setup(c => c.GetReader(It.IsAny<string>(), It.IsAny<StatementParamaters>()))
                .Returns(_mockReader.Object);

            _mockLocationFormatter.Setup(c => c.DetermineConditionsAndFormat(It.IsAny<string>(), It.IsAny<string>()))
                .Returns((string value, string type) => value);

            _sut = new LocationRepository(_mockConnectionManager.Object, _mockLocationGroupBuilder.Object, _mockLocationFormatter.Object);
            _mockDataReader = new Mock<IDataReader>();
            _mockDataReader.Setup(r => r["UPRN"]).Returns("1");
            _mockDataReader.Setup(r => r["ADMINISTRATIVE_AREA"]).Returns("");
            _mockDataReader.Setup(r => r["BUILDING_NAME"]).Returns("");
            _mockDataReader.Setup(r => r["BLPU_ORGANISATION"]).Returns("");
            _mockDataReader.Setup(r => r["STREET_DESCRIPTION"]).Returns("");
            _mockDataReader.Setup(r => r["PAO_START_NUMBER"]).Returns("");
            _mockDataReader.Setup(r => r["LOCALITY"]).Returns("");
            _mockDataReader.Setup(r => r["TOWN_NAME"]).Returns("");
            _mockDataReader.Setup(r => r["POST_TOWN"]).Returns("");
            _mockDataReader.Setup(r => r["POSTCODE"]).Returns("");
            _mockDataReader.Setup(r => r["X_COORDINATE"]).Returns("1.0");
            _mockDataReader.Setup(r => r["Y_COORDINATE"]).Returns("2.0");
            _mockDataReader.Setup(r => r["POSTCODE_LOCATOR"]).Returns("");

            _mockReader.Setup(r => r.DataReader).Returns(_mockDataReader.Object);
        }
Example #9
0
 private void InitOrders(OrderRepository orderRepo, CarRepository carsRepo, LocationRepository locRepo)
 {
     var date = DateTime.Now;
     orderRepo.Add(new Order { CarID = 2, DateStart = date.AddDays(2), DateEnd = date.AddDays(5), PointStartID = 1, PointEndID = 2 });
     orderRepo.Add(new Order { CarID = 3, DateStart = date.AddDays(3), DateEnd = date.AddDays(5), PointStartID = 2, PointEndID = 2 });
     orderRepo.Add(new Order { CarID = 4, DateStart = date.AddDays(4), DateEnd = date.AddDays(5), PointStartID = 2, PointEndID = 2 });
 }
        public HttpResponseMessage GetItemsByLocation(int location)
        {
            var zoneCode = LocationRepository.GetZoneByLocation(location.ToString());
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, zoneCode);

            return(response);
        }
Example #11
0
        void LocationCode_EditValueChanging(object sender, ChangingEventArgs e)
        {
            if (this.DesignMode)
            {
                return;
            }

            LocationCode.EditValueChanging -= LocationCode_EditValueChanging;
            var mod = LocationRepository.GetLocation(this.DbContext, LocationCode.Text);

            if (mod == null)
            {
                this._LocationID           = 0;
                this.btnLocation.EditValue = 0;
            }
            else
            {
                this._LocationID                 = mod.LocationID;
                this.btnLocation.EditValue       = mod.LocationID;
                this.LocationCode.Text           = mod.LocationCode;
                this.LocationCode.SelectionStart = this.LocationCode.Text.Length;
            }
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(this.GetName(p => p.LocationID)));
            }
            LocationCode.EditValueChanging += LocationCode_EditValueChanging;
        }
Example #12
0
        // Link: http://geowebservice.azurewebsites.net/Api/Geo
        //private string HARDCODEDDATA = "$GPGGA,110730.000,5049.4781,N,00314.9857,E,1,10,0.9,44.9,M,47.2,M,,0000*6F\r\n$GPGSA,A,3,07,30,15,20,09,05,28,21,13,10,,,1.5,0.9,1.2*38\r\n$GPGSV,3,1,12,30,70,079,34,05,67,250,21,13,47,281,20,07,39,057,45*73\r\n$GPGSV,3,2,12,20,39,170,21,28,29,141,20,10,28,157,24,15,12,281,32*72\r\n$GPGSV,3,3,12,02,08,219,,09,08,097,23,21,08,330,22,27,04,026,30*79\r\n$GPRMC,110730.000,A,5049.4781,N,00314.9857,E,0.61,161.13,260315,,*00\r\n$GPVTG,161.13,T,,M,0.61,N,1.1,K*63\r\n$GPGGA,110731.000,5049.4777,N,00314.9859,E,1,10,0.9,44.1,M,47.2,M,,0000*61\r\n$GPGSA,A,3,07,30,15,20,09,05,28,21,13,10,,,1.5,0.9,1.2*38\r\n$GPRMC,110731.000,A,5049.4777,N,00314.9859,E,0.24,107.31,260315,,*07\r\n$GPVTG,107.31,T,,M,0.24,N,0.4,K*66\r\n$GPGGA,110732.000,5049.4776,N,00314.9861,E,1,10,0.9,43.7,M,47.2,M,,0000*69\r\n$GPGSA,A,3,07,30,15,20,09,05,28,21,13,10,,,1.5,0.9,1.2*38\r\n$GPRMC,110732.000,A,5049.4776,N,00314.9861,E,0.32,86.57,260315,,*31\r\n$GPVTG,86.57,T,,M,0.32,N,0.6,K*5B\r\n";
        // text


        public void Get(int id)
        {
            LocationRepository LocRepo = new LocationRepository();

            LocRepo.ClearDb();

            while (1 > 0)
            {
                System.Threading.Thread.Sleep(5000);

                SerialPortHelpers SerialPort = new SerialPortHelpers();
                Location          Location   = new Location();
                SerialPort.Init();
                SerialPort.Open();
                System.Threading.Thread.Sleep(5000);
                string data = SerialPort.ReadExisting();
                Location           = SerialPort.GetLocation(data);
                Location.TimeStamp = DateTime.Now;

                if (Location.Altitude != null && Location.Latitude != null && Location.Longitude != null)
                {
                    if (Location.Altitude.Value != "" && Location.Latitude.Value != "" && Location.Longitude.Value != "")
                    {
                        LocRepo.AddLocation(Location);
                    }
                }

                if (LocRepo.GetAmmountOfLocations() > 100)
                {
                    LocRepo.ClearDb();
                }
                Console.WriteLine("Location Updated:" + "Latitude: " + Location.Latitude + ", Longtitude : " + Location.Longitude + ", Altitude : " + Location.Longitude + ".");
                SerialPort.Close();
            }
        }
Example #13
0
        public Location GetLocation()
        {
            LocationRepository LocRepo  = new LocationRepository();
            Location           Location = LocRepo.GetLastLocation();

            return(Location);
        }
Example #14
0
        public virtual IActionResult LunchGet(string channel_name = null, string text = null)
        {
            var lr         = new LocationRepository();
            var parameters = Parameter.ParseParameters(text);

            if (parameters.Count > 0)
            {
                switch (parameters[0].Name.ToLower())
                {
                case "add":
                    return(LunchAdd(parameters));

                    break;

                case "where":
                    return(RandomLunch());

                    break;

                case "list":
                    return(LunchList());

                    break;

                case "vote":
                    return(Vote(lr, parameters));
                }
            }
            return(Json(new SlackResult()
            {
                text = Help
            }));
        }
        public void A_ChangedLocation_modifies_Existing_Location_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new LocationRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //3.- Change the aggregate
            aggr.PostalCode = StringExtension.RandomString(10);
            aggr.CountryId = Guid.NewGuid();

            //4.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(ChangedLocation).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            //5.- Load the saved country
            var location = repository.Get(aggr.Id);
            //6.- Check equality
            Assert.True(ObjectExtension.AreEqual(aggr, location));
        }
Example #16
0
        public async void DeleteAsync_GivenCategoryExistsAndInNoProjects_ReturnsSuccess()
        {
            var locationToDelete = new Location
            {
                Id      = 1,
                City    = "Sydney",
                Country = "Australia"
            };

            locationRepository = new LocationRepository(setupContextForIntegrationTests());

            context.Locations.Add(locationToDelete);
            context.SaveChanges();

            //Sanity Check
            Assert.NotNull(context.Locations.Find(locationToDelete.Id));
            Assert.Empty(await context.Projects.ToArrayAsync());

            using (var logic = new LocationLogic(locationRepository, userRepositoryMock.Object, projectRepositoryMock.Object))
            {
                var response = await logic.DeleteAsync(locationToDelete.Id);

                Assert.Equal(ResponseLogic.SUCCESS, response);
            }
        }
Example #17
0
        public LocationController()
        {
            if (LocationRepository.LocationList.Count == 0)
            {
                Location location = new Location()
                {
                    Title   = "Lane Community College",
                    Address = "4000 E 30th Ave, Eugene, OR 97405",
                    About   = "This is the gathering place of the current community."
                };
                LocationRepository.AddLocation(location);

                Location newLocation1 = new Location()
                {
                    Title   = "Tiger's Den",
                    Address = "6552 W Someplace Ave, Eugene, OR 97401",
                    About   = "This is an imaginary bar for our favorite community members."
                };
                LocationRepository.AddLocation(newLocation1);

                Location newLocation2 = new Location()
                {
                    Title   = "Wandering Goat",
                    Address = "3717 E Somewhere Ave, Eugene, OR 97405",
                    About   = "This is the urban watering hole."
                };
                LocationRepository.AddLocation(newLocation2);
            }
        }
Example #18
0
 public RuleDbService(BatteryRepository br, LocationRepository lr, ApiiRepository ar, AmbientRepository ambRep)
 {
     this.brcontext     = br;
     this.lrcontext     = lr;
     this.arcontext     = ar;
     this.ambRepcontext = ambRep;
 }
        public IHttpActionResult GetListLocation2(string parentId)
        {
            LocationRepository locationRepository = new LocationRepository(new ErpDbContext());
            List <Location>    locationList       = locationRepository.GetList(parentId).ToList();

            return(Ok(locationList));
        }
Example #20
0
 public LandmarksController()
 {
     _dbContext          = new ApplicationDbContext();
     _landmarkGenerator  = new LandmarkGenerator();
     _landmarkRepository = new LandmarkRepository(_dbContext);
     _locationRepository = new LocationRepository(_dbContext);
 }
        /// <summary>Busca vuelo especifico en la DB</summary>
        /// <param name="id">Id del vuelo a busac</param>
        /// <returns>Entity con el resultado de la query</returns>
        public static Entity Find(int id)
        {
            try
            {
                var    table  = PgConnection.Instance.ExecuteFunction(FIND_FLIGHT, id);
                Flight flight = null;

                if (table.Rows.Count > 0)
                {
                    flight               = new Flight(Convert.ToInt32(table.Rows[0][0]));
                    flight.Id            = Convert.ToInt32(table.Rows[0][0]);
                    flight.price         = Convert.ToDouble(table.Rows[0][1]);
                    flight.departure     = table.Rows[0][2].ToString();
                    flight.arrival       = table.Rows[0][3].ToString();
                    flight.loc_departure = LocationRepository.GetLocationById(Convert.ToInt32(table.Rows[0][4]));
                    flight.loc_arrival   = LocationRepository.GetLocationById(Convert.ToInt32(table.Rows[0][5]));
                    flight.plane         = (Airplane)AirplanesRepository.Find(Convert.ToInt32(table.Rows[0][6]));
                }

                return(flight);
            }
            catch (DatabaseException ex)
            {
                Console.WriteLine(ex.ToString());
                throw new DbErrorException("¡Ups! Hubo un error con la Base de Datos", ex);
            }
            catch (System.Exception)
            {
                throw;
            }
            finally
            {
            }
        }
        public HttpResponseMessage Get()
        {
            var zoneCode = LocationRepository.GetAllLocation();
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK, zoneCode);

            return(response);
        }
Example #23
0
        public void CanGetAllLocationsInDatabase()
        {
            // Arrange Everything We Need For Our Unit Tests
            options = new DbContextOptionsBuilder <ApplicationDBContext>()
                      .UseInMemoryDatabase(databaseName: "TestRevatureHousingData")
                      .Options;
            testContext            = new ApplicationDBContext(options);
            dummyLocationsData     = new LocationDummyData();
            dummyLocations         = dummyLocationsData.LocationsList;
            testLocationRepository = new LocationRepository(testContext);
            testLocationController = new LocationsController(testLocationRepository);
            dummyConstantLocation  = new Location()
            {
                LocationID = 3
            };
            //Arrange
            Populate();
            //Act
            var allLocations      = testLocationController.GetLocation().Result.ToList();
            var allDummyLocations = dummyLocations.Count;

            Assert.AreEqual(allLocations.Count, allDummyLocations);
            //Clearing Changes
            ClearAllChanges();
        }
Example #24
0
        public IActionResult Favorites()
        {
            var fvm = new FavViewModel()
            {
                Locations = LocationRepository.GetLocations()
            };

            var reports = new List <CurrentReport>();

            for (int i = 0; i < fvm.Locations.Count; i++)
            {
                var result = Helpers.GetWeatherByZip(fvm.Locations[i].Zip);
                var code   = Convert.ToInt32(Helpers.Parse(result, "cod"));
                if (code == 200)
                {
                    var r = Helpers.GenerateCurrentReport(result);
                    reports.Add(r);
                }
                // Need to handle unsuccessful queries
            }

            fvm.Reports = reports;

            return(View(fvm));
        }
Example #25
0
        public void CannotUpdateLocationWithWrongSignature()
        {
            // Arrange Everything We Need For Our Unit Tests
            options = new DbContextOptionsBuilder <ApplicationDBContext>()
                      .UseInMemoryDatabase(databaseName: "TestRevatureHousingData")
                      .Options;
            testContext            = new ApplicationDBContext(options);
            dummyLocationsData     = new LocationDummyData();
            dummyLocations         = dummyLocationsData.LocationsList;
            testLocationRepository = new LocationRepository(testContext);
            testLocationController = new LocationsController(testLocationRepository);
            dummyConstantLocation  = new Location()
            {
                LocationID = 3
            };
            //Arrange
            Location locale = new Location()
            {
                LocationID = 5
            };
            var postResponse = testLocationController.PostLocation(locale);
            //Act
            var putResponse = testLocationController.PutLocation(128923, locale).Result;

            //Assert
            Assert.IsInstanceOfType(putResponse, typeof(BadRequestObjectResult));
            // Clearing Changes
            ClearAllChanges();
        }
Example #26
0
        public void Remove(decimal longitude, decimal latitude)
        {
            var repo   = new LocationRepository(_settings);
            var userId = new Guid("C49200FC-C271-4CC3-8905-086A2CE9AB4E");

            repo.DeleteLocationsByUserId(userId, longitude, latitude);
        }
 public DatenLoggerHierarchieModelView()
 {
     _locationlist      = new List <ILocation>();
     CmdCancel          = new DelegateCommand(OnCmdCancel);
     CmdLocation        = new DelegateCommand(OnCmdLocation);
     LocationRepository = new LocationRepository();
 }
Example #28
0
        public void CannotDeleteLocationNotInDatabase()
        {
            // Arrange Everything We Need For Our Unit Tests
            options = new DbContextOptionsBuilder <ApplicationDBContext>()
                      .UseInMemoryDatabase(databaseName: "TestRevatureHousingData")
                      .Options;
            testContext            = new ApplicationDBContext(options);
            dummyLocationsData     = new LocationDummyData();
            dummyLocations         = dummyLocationsData.LocationsList;
            testLocationRepository = new LocationRepository(testContext);
            testLocationController = new LocationsController(testLocationRepository);
            dummyConstantLocation  = new Location()
            {
                LocationID = 3
            };
            //Arrange
            Populate();
            //Act
            var deleteResult     = testLocationController.DeleteLocation(12728).Result.Result;
            var deleteStatusCode = (deleteResult as StatusCodeResult);

            //Assert
            Assert.IsInstanceOfType(deleteResult, typeof(NotFoundResult));
            Assert.AreEqual(deleteStatusCode.StatusCode, 404);
            // Clearing Changes
            ClearAllChanges();
        }
Example #29
0
        public void CannotAddSameLocationTwiceInDatabase()
        {
            // Arrange Everything We Need For Our Unit Tests
            options = new DbContextOptionsBuilder <ApplicationDBContext>()
                      .UseInMemoryDatabase(databaseName: "TestRevatureHousingData")
                      .Options;
            testContext            = new ApplicationDBContext(options);
            dummyLocationsData     = new LocationDummyData();
            dummyLocations         = dummyLocationsData.LocationsList;
            testLocationRepository = new LocationRepository(testContext);
            testLocationController = new LocationsController(testLocationRepository);
            dummyConstantLocation  = new Location()
            {
                LocationID = 3
            };
            //Arrange
            Location dummyLocation = dummyConstantLocation;
            var      postResponse  = testLocationController.PostLocation(dummyLocation);
            //Act
            var secondPostResult = testLocationController.PostLocation(dummyLocation);
            var postStatusCode   = (secondPostResult as StatusCodeResult);

            //Assert
            Assert.IsInstanceOfType(secondPostResult, typeof(StatusCodeResult));
            Assert.AreEqual(postStatusCode.StatusCode, 409);
            //Clearing Changes
            ClearAllChanges();
        }
Example #30
0
        public async Task GetNearbyEntriesUsageWithoutItself()
        {
            // Arrange
            IDataFileService   dataFileService = ServiceMocks.GetMockDataFileService();
            LocationRepository repository      = new LocationRepository(dataFileService, _appSettings);

            Location startLocation = new Location
            {
                ID        = -1,
                ZipCode   = "31600",
                Village   = "Uchte",
                Latitude  = 52.5192716743236,
                Longitude = 8.87567370960235
            };

            // Act
            Location[] response = (await repository.GetNearbyEntries(startLocation, 2, false));

            // Assert
            Assert.IsNotNull(response);
            Assert.AreEqual(2, response.Length);

            Assert.AreEqual(7073, response[0].ID);
            Assert.AreEqual("31582", response[0].ZipCode);
            Assert.AreEqual("Nienburg (Weser)", response[0].Village?.Trim());
            Assert.AreEqual(52.6407898946597, response[0].Latitude);
            Assert.AreEqual(9.23150063371375, response[0].Longitude);

            Assert.AreEqual(10672, response[1].ID);
            Assert.AreEqual("80796", response[1].ZipCode);
            Assert.AreEqual("München", response[1].Village?.Trim());
            Assert.AreEqual(48.1646490940644, response[1].Latitude);
            Assert.AreEqual(11.5694707183568, response[1].Longitude);
        }
Example #31
0
        public void Test_AddSameLocationTwice()
        {
            LocationRepository repository = LocationRepository.GetInstance();

            repository.AddLocation(location1);
            repository.AddLocation(location1);
        }
        public GetController(
            MeritDbContext dbContext,
            InvoiceReportService invoiceReportService,
            AppSettings appSettings,
            InvoiceRepository invoiceRepository,
            InvoiceService invoiceService,
            LocationRepository locationRepository,
            WorkOrderRepository workOrderRepository,
            UnloadingWorkOrderQueries unloadingWorkOrderQueries,
            DlsWorkOrderQueries dlsWorkOrderQueries,
            BOLQueries bolQueries,
            ServiceWorkOrderQueries serviceWorkOrderQueries)
        {
            this.dbContext = dbContext;
            this.invoiceGenerationSettings = new InvoiceGenerationSettings();
            this.appSettings = appSettings;

            this.invoiceRepository   = invoiceRepository;
            this.locationRepository  = locationRepository;
            this.workOrderRepository = workOrderRepository;

            this.invoiceReportService = invoiceReportService;
            this.krogerExcelGenerator = new KrogerExcelGenerator(invoiceGenerationSettings.KrogerInvoiceTemplatePath);
            this.pdfGenerator         = new PdfGenerator();

            this.unloadingWorkOrderQueries = unloadingWorkOrderQueries;
            this.dlsWorkOrderQueries       = dlsWorkOrderQueries;
            this.invoiceService            = invoiceService;
            this.bolQueries = bolQueries;
            this.serviceWorkOrderQueries = serviceWorkOrderQueries;
        }
 public LocationController(LocationRepository locationRepository, UserRepository userRepository,
                           AccessTokenService accessTokenService)
 {
     _locationRepository = locationRepository;
     _userRepository     = userRepository;
     _accessTokenService = accessTokenService;
 }
 public HandlingEventFactory(CargoRepository cargoRepository,
                             VoyageRepository voyageRepository,
                             LocationRepository locationRepository)
 {
     this.cargoRepository = cargoRepository;
     this.voyageRepository = voyageRepository;
     this.locationRepository = locationRepository;
 }
Example #35
0
 public LoadService(IpGeoBaseContext dataContext)
 {
     DataContext = dataContext;
     AreaRepository = new AreaRepository(dataContext);
     RegionRepository = new RegionRepository(dataContext);
     LocationRepository = new LocationRepository(dataContext);
     RangeRepository = new RangeRepository(dataContext);
 }
 public ExternalRoutingService(GraphTraversalService graphTraversalService,
                               LocationRepository locationRepository,
                               VoyageRepository voyageRepository)
 {
     this.graphTraversalService = graphTraversalService;
     this.locationRepository = locationRepository;
     this.voyageRepository = voyageRepository;
 }
 public BookingServiceFacadeImpl(BookingService bookingService, LocationRepository locationRepository,
                                 CargoRepository cargoRepository, VoyageRepository voyageRepository)
 {
     this.bookingService = bookingService;
     this.locationRepository = locationRepository;
     this.cargoRepository = cargoRepository;
     this.voyageRepository = voyageRepository;
 }
 public void setUp()
 {
     cargoRepository = MockRepository.GenerateMock<CargoRepository>();
     locationRepository = MockRepository.GenerateMock<LocationRepository>();
     routingService = MockRepository.GenerateMock<RoutingService>();
     trackingIdFactory = MockRepository.GenerateMock<TrackingIdFactory>();
     bookingService = new BookingServiceImpl(routingService, trackingIdFactory, cargoRepository, locationRepository);
 }
 public BookingServiceImpl(RoutingService routingService,
                       TrackingIdFactory trackingIdFactory,
                       CargoRepository cargoRepository,
                       LocationRepository locationRepository)
 {
     _routingService = routingService;
     _trackingIdFactory = trackingIdFactory;
     _cargoRepository = cargoRepository;
     _locationRepository = locationRepository;
 }
        protected void setUp()
        {
            cargoRepository = MockRepository.GenerateMock<CargoRepository>();
            voyageRepository = new VoyageRepositoryInMem();
            locationRepository = new LocationRepositoryInMem();
            factory = new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);

            trackingId = new TrackingId("ABC");
            RouteSpecification routeSpecification = new RouteSpecification(L.TOKYO, L.HELSINKI, DateTime.Now);
            cargo = new Cargo(trackingId, routeSpecification);
        }
 public void setUp()
 {
     systemEvents = MockRepository.GenerateMock<SystemEvents>();
     cargoRepository = new CargoRepositoryInMem();
     handlingEventRepository = new HandlingEventRepositoryInMem();
     locationRepository = new LocationRepositoryInMem();
     voyageRepository = new VoyageRepositoryInMem();
     trackingIdFactory = new TrackingIdFactoryInMem();
     handlingEventFactory = new HandlingEventFactory(cargoRepository, voyageRepository, locationRepository);
     cargoUpdater = new CargoUpdater(systemEvents, cargoRepository, handlingEventRepository);
 }
Example #42
0
 public TargetService(IpGeoBaseContext dataContext)
 {
     DataContext = dataContext;
     TargetRepository = new TargetRepository(dataContext);
     CountryRuleRepository = new CountryRuleRepository(dataContext);
     AreaRuleRepository = new AreaRuleRepository(dataContext);
     AreaRepository = new AreaRepository(dataContext);
     RegionRuleRepository = new RegionRuleRepository(dataContext);
     RegionRepository = new RegionRepository(dataContext);
     LocationRuleRepository = new LocationRuleRepository(dataContext);
     LocationRepository = new LocationRepository(dataContext);
 }
        protected void setUp()
        {
            cargoRepository = MockRepository.GenerateMock<CargoRepository>();
            voyageRepository = MockRepository.GenerateMock<VoyageRepository>();
            handlingEventRepository = MockRepository.GenerateMock<HandlingEventRepository>();
            locationRepository = MockRepository.GenerateMock<LocationRepository>();
            systemEvents = MockRepository.GenerateMock<SystemEvents>();

            HandlingEventFactory handlingEventFactory = new HandlingEventFactory(cargoRepository,
                voyageRepository,
                locationRepository);
            service = new HandlingEventServiceImpl(handlingEventRepository, systemEvents, handlingEventFactory);
        }
        protected override void LoadTestData()
        {
            _locationRepository = new LocationRepository();

            var location1 = new Location {LocationType = LocationType.Source};
            var location2 = new Location {LocationType = LocationType.Destination};
            var location3 = new Location {LocationType = LocationType.Source};

            _locationRepository.SaveOrUpdate(location1);
            _locationRepository.SaveOrUpdate(location2);
            _locationRepository.SaveOrUpdate(location3);

            FlushAndClearSession();
        }
Example #45
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);

            var carsRepo = new CarRepository();
            var locRepo = new LocationRepository();
            var orderRepo = new OrderRepository();

            //            InitOrders(orderRepo, carsRepo, locRepo);
            //            orderRepo.SaveChanges();
        }
Example #46
0
 internal static Itinerary fromDTO(RouteCandidateDTO routeCandidateDTO,
                          VoyageRepository voyageRepository,
                          LocationRepository locationRepository)
 {
     var legs = new List<Leg>(routeCandidateDTO.getLegs().Count());
     foreach(LegDTO legDTO in routeCandidateDTO.getLegs())
     {
         var voyageNumber = new VoyageNumber(legDTO.getVoyageNumber());
         var voyage = voyageRepository.find(voyageNumber);
         var from = locationRepository.find(new UnLocode(legDTO.getFrom()));
         var to = locationRepository.find(new UnLocode(legDTO.getTo()));
         legs.Add(Leg.DeriveLeg(voyage, from, to));
     }
     return new Itinerary(legs);
 }
 public void A_RegisteredLocation_creates_a_new_Location_in_the_database()
 {
     var bootStrapper = new BootStrapper();
     bootStrapper.StartServices();
     var serviceEvents = bootStrapper.GetService<IServiceEvents>();
     //1.- Create message
     var aggr = GenerateRandomAggregate();
     var message = GenerateMessage(aggr);
     //2.- Emit message
     serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });
     //3.- Load the saved country
     var repository = new LocationRepository(_configuration.TestServer);
     var location = repository.Get(aggr.Id);
     //4.- Check equality
     Assert.True(ObjectExtension.AreEqual(aggr, location));
 }
Example #48
0
        public ActionResult AddLocation(long timestamp, float x, float y, string name, bool waypoint = false)
        {
            var location = new Location
            {
                Name = name,
                Timestamp = timestamp,
                X = x,
                Y = y,
                Waypoint = waypoint
            };

            var locationRepository = new LocationRepository(new PpDbContext());
            locationRepository.CreateLocation(location);

            return Json(location.Id != 0, JsonRequestBehavior.AllowGet);
        }
Example #49
0
        public ActionResult Create(HttpPostedFileBase file_upload, FormCollection collection)
        {
            ImagePaths photoPaths = null;
            ImageDimensions imgDims = null;
            ImagePaths thumbNailPaths = null;

            try
            {
                photoPaths = SaveUploadedFile(file_upload);
                imgDims = ImageHandler.GetImageDimensions(photoPaths.FilePath);

                //Save file
                var photo = new Photo();
                photo.PhotoUrl = photoPaths.SqlAddress;
                if (imgDims != null)
                {
                    photo.Width = imgDims.Width;
                    photo.Height = imgDims.Height;
                }
                var photoRepo = new PhotoRepository();
                photoRepo.Save(photo);

                var team = new Team {TeamName = collection.Get("TeamName")};

                //Save Location
                var locationRepo = new LocationRepository();
                var location = new Location();
                location.City = collection.Get("City");
                location.StateId = Convert.ToInt32(collection.Get("StateId"));
                locationRepo.Add(location);

                team.LocationId = location.LocationId;
                team.PhotoId = photo.PhotoId;

                this.repo.Add(team);

                return RedirectToAction("Index");
            }
            catch
            {
                ViewBag.States = this.GetStates();
                return View();
            }
        }
        public void A_UnregisteredLocation_modifies_Existing_country_in_the_database()
        {
            var bootStrapper = new BootStrapper();
            bootStrapper.StartServices();
            var serviceEvents = bootStrapper.GetService<IServiceEvents>();
            //1.- Create message
            var aggr = GenerateRandomAggregate();

            //2.- Create the tuple in the database
            var repository = new LocationRepository(_configuration.TestServer);
            repository.Insert(aggr);

            //2.- Emit message
            var message = GenerateMessage(aggr);
            message.MessageType = typeof(UnregisteredLocation).Name;
            serviceEvents.AddIncommingEvent(new IncommingEvent { @event = message });

            var location = repository.Get(aggr.Id);
            Assert.Null(location);
            
        }
Example #51
0
 public MainRepository(AppContext context)
 {
     _context = context;
     Calls = new CallRepository(_context);
     Users = new UserRepository(_context);
     Locations = new LocationRepository(_context);
     Groups = new GroupRepository(_context);
     Operations = new OperationRepository(_context);
     Roles = new RoleRepository(_context);
     Debits = new DebitRepository(_context);
     PenaltyTypes = new PenaltyTypeRepository(_context);
     Employees = new EmployeeRepository(_context);
     Extras = new ExtraRepository(_context);
     PayRolls = new PayRollRepository(_context);
     Salaries = new SalaryRepository(_context);
     DebitTypes = new DebitTypeRepository(_context);
     Penalties = new PenaltyRepository(_context);
     DebitPayments = new DebitPaymentRepository(_context);
     Administrators = new AdministratorRepository(_context);
     Savings = new SavingRepository(_context);
     Vacations = new VacationRepository(_context);
     RoleOperations = new RoleOperationRepository(_context);
 }
Example #52
0
        public ActionResult Edit(int id, FormCollection collection)
        {
            try
            {
                var team = this.repo.GetById(Convert.ToInt32("TeamId"));
                team.TeamName = collection.Get("TeamName");

                var locationRepo = new LocationRepository();

                var city = collection.Get("City");
                var stateId = Convert.ToInt32(collection.Get("StateId"));

                var location = locationRepo.GetByCityStateId(city, stateId);

                if (null == location)
                {
                    location = new Location();
                    location.City = city;
                    location.StateId = stateId;
                }
                locationRepo.Save(location);

                team.LocationId = location.LocationId;

                this.repo.Add(team);

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
Example #53
0
        private IEnumerable<SelectListItem> GetLocations()
        {
            var locations = new LocationRepository().GetAll()
                .Select(l => new SelectListItem
                {
                    Value = l.ID.ToString(),
                    Text = l.Name
                });

            return new SelectList(locations, "Value", "Text");
        }
 public LocationService()
 {
     _locationRepository = new LocationRepository(new EmpleadoContext());
 }
 public JobOpportunityController()
 {
     _jobRepository = new JobOpportunityRepository(_database);
     _locationRepository = new LocationRepository(_database);
 }
Example #56
0
		public static LocationRepository GetLocationRepository()
		{
			var repository = new LocationRepository();
			repository.UnitOfWork = GetUnitOfWork();
			return repository;
		}
Example #57
0
		public static LocationRepository GetLocationRepository(IUnitOfWork unitOfWork)
		{
			var repository = new LocationRepository();
			repository.UnitOfWork = unitOfWork;
			return repository;
		}		
Example #58
0
 public LocationService(LocationRepository locationRepo, ProjectRepository projectRepo)
 {
     _locationRepo = locationRepo;
     _projectRepo = projectRepo;
 }
Example #59
0
        public ActionResult Index()
        {
            var locationRepository = new LocationRepository(new PpDbContext());
            var locations = locationRepository.GetLocationQueryable().Where(x => true).OrderBy(x => x.Name).ToList();

            return View(locations);
        }
Example #60
0
        public ActionResult DownloadKml(string name)
        {
            var locationRepository = new LocationRepository(new PpDbContext());
            if(locationRepository.GetLocationQueryable().Count(x => x.Name == name) == 0)
                return Json("Can't find run with specified name", JsonRequestBehavior.AllowGet);

            var locations = locationRepository.GetLocationQueryable().Where(x => x.Name == name).ToList();

            HttpContext.Response.Clear();
            HttpContext.Response.ContentType = "application/vnd.google-earth.kml+xm";
            Response.AddHeader("Content-Disposition", "attachment;filename=" + name + ".kml");

            XmlTextWriter kml = new XmlTextWriter(HttpContext.Response.OutputStream, Encoding.UTF8);

            kml.Formatting = Formatting.Indented;
            kml.Indentation = 3;

            kml.WriteStartDocument();

            kml.WriteStartElement("kml", "http://www.opengis.net/kml/2.2");
            kml.WriteStartElement("Document");

            for (int i = 0; i < locations.Count; i++)
            {
                long logicTime = 0;
                double distanceToPreviously = 0;

                var posixTime = DateTime.SpecifyKind(new DateTime(1970, 1, 1), DateTimeKind.Utc);
                var time = posixTime.AddMilliseconds(locations[i].Timestamp);

                if (i != 0)
                {
                    var difference = locations[i].Timestamp - locations[i - 1].Timestamp;
                    logicTime = difference;

                    var p1 = new GeoCoordinate(locations[i].X, locations[i].Y);
                    var p2 = new GeoCoordinate(locations[i - 1].X, locations[i - 1].Y);

                    distanceToPreviously = p1.GetDistanceTo(p2);
                }

                kml.WriteStartElement("Placemark");

                kml.WriteStartElement("Style");
                kml.WriteStartElement("IconStyle");
                kml.WriteStartElement("Icon");

                if (locations[i].Waypoint)
                    kml.WriteElementString("href", "http://www.google.com/intl/en_us/mapfiles/ms/icons/green-dot.png");
                else
                    kml.WriteElementString("href", "http://www.google.com/intl/en_us/mapfiles/ms/icons/red-dot.png");

                kml.WriteEndElement(); // <Icon>
                kml.WriteEndElement(); // <IconStyle>
                kml.WriteEndElement(); // <Style>

                kml.WriteElementString("name", "GPS Point");
                kml.WriteElementString("description", "Timestamp: " + time.ToString("dd-MM-yy - HH:mm:ss") + "<br />" +
                    "Logic Time: " + logicTime + " ms." + "<br />" +
                    "Distance to previous: " + distanceToPreviously + " m.");

                kml.WriteStartElement("Point");

                kml.WriteElementString("coordinates", locations[i].Y.ToString(CultureInfo.InvariantCulture) + "," + locations[i].X.ToString(CultureInfo.InvariantCulture) + ",0");

                kml.WriteEndElement(); // <Point>
                kml.WriteEndElement(); // <Placemark>
            }

            kml.WriteEndElement(); // <Document>
            kml.WriteEndDocument(); // <kml>
            kml.Flush();
            kml.Close();

            HttpContext.Response.End();

            return Json(true, JsonRequestBehavior.AllowGet);
        }