public FrmCatalogoUnidades() { InitializeComponent(); this.cLista = new AutoRepository(); //DgbCatalogoUnidades.AutoGenerateColumns = false; //prueba numero 1 }
public void TestUpdateAuto() { //Adding using (var repo = new AutoRepository(new AutosBackendContext(_options))) { repo.Insert(new Auto() { Kenteken = "AA-11-BB" }); } //Updating using (var repo = new AutoRepository(new AutosBackendContext(_options))) { repo.Update(new Auto() { Id = 1, Kenteken = "AA-11-CC" }); } //Checking using (var repo = new AutoRepository(new AutosBackendContext(_options))) { var result = repo.Find(1); Assert.AreEqual(1, repo.Count()); Assert.AreEqual("AA-11-CC", result.Kenteken); } }
public void WhenAutoExists_AutoExists_ItShouldReturnTrue() { Automobil testAuto = CreateTestAutoEntity(); AutoRepository testAutoRepository = CreateAutoRepository(); testAutoRepository.AutoExists(testAuto).Should().BeTrue(); }
public AddNewCar() { InitializeComponent(); autoRepository = new AutoRepository(); clientRepository = new ClientRepository(); sasiuRepository = new SasiuRepository(); }
private static void initializeEventDispatcher() { string sqlConnectionString = "server=db;userid=jomaya;password=jomaya;database=jomaya-frontend;"; var optionsBuilder = new DbContextOptionsBuilder <FrontEndContext>(); optionsBuilder.UseMySQL(sqlConnectionString); _context = new FrontEndContext(optionsBuilder.Options); _klantRepo = new KlantRepository(_context); _autoRepo = new AutoRepository(_context); _onderhoudsRepo = new OnderhoudRepository(_context); var config = new EventBusConfig() { Host = "rabbitmq", Port = 5672, QueueName = "jomaya.frontend.auto.dispatcher" }; var publisher = new EventPublisher(config); _autoDispatcher = new AutoDispatcher(config, _autoRepo, _onderhoudsRepo); config = new EventBusConfig() { Host = "rabbitmq", Port = 5672, QueueName = "jomaya.frontend.klant.dispatcher" }; _klantDispatcher = new KlantDispatcher(config, _klantRepo); }
public void WhenAutoAdded_AddAuto_ItShouldAddSuccessfully() { Automobil testAuto = CreateTestAutoEntity(); AutoRepository testAutoRepository = CreateAutoRepository(); testAutoRepository.AddAuto(testAuto); CreateTestEntities().Automobils.Count().Should().BeGreaterOrEqualTo(0); }
protected override void Initialize(RequestContext requestContext) { base.Initialize(requestContext); var pathToJson = Server.MapPath("~/App_Data/database.json"); _repository = new AutoRepository(pathToJson); }
public static void Demo() { var autoRepository = new AutoRepository(); var automobile = autoRepository.Find("mini cooper"); automobile.Start(); automobile.Stop(); }
public CreateComandaForm(Auto auto) { InitializeComponent(); this.auto = auto; comandaRepository = new ComandaRepository(); autoRepository = new AutoRepository(); detaliuComandaRepository = new DetaliuComandaRepository(); numarAutoLabel.Text = auto.NumarAuto; }
public void WhenAutoExists_DeleteAuto_ItShouldReturnSuccessfully() { Entities applicationContext = CreateTestEntities(); AutoRepository testAutoRepository = new AutoRepository(applicationContext); int testAutoId = 1; Automobil testAuto = applicationContext.Automobils.FirstOrDefault(a => a.AutoId == testAutoId); testAutoRepository.DeleteAuto(testAutoId); applicationContext.Automobils.FirstOrDefault(a => a.AutoId == testAutoId).Should().BeNull(); }
public void WhenAutoExists_UpdateAuto_ItShouldUpdateSuccessfully() { Entities applicationContext = CreateTestEntities(); AutoRepository testAutoRepository = new AutoRepository(applicationContext); int testAutoId = 2; Automobil testAuto = applicationContext.Automobils.FirstOrDefault(a => a.AutoId == testAutoId); testAuto.NumarAuto = "Upd"; testAutoRepository.UpdateAuto(testAuto); applicationContext.Automobils.FirstOrDefault(a => a.AutoId == testAutoId)?.NumarAuto.Should().Be("Upd"); }
public static void FirstDemo() { var autoRepository = new AutoRepository(); var automobile = autoRepository.Find("BmwM3"); automobile.Start(); automobile.Stop(); var another = autoRepository.Find("LexusLs"); another.Start(); another.Stop(); }
public void TestAdd() { using (var repo = new AutoRepository(new FrontEndContext(_options))) { repo.Insert(new Auto() { Kenteken = "AA - 11 - BB" }); } using (var repo = new AutoRepository(new FrontEndContext(_options))) { Assert.AreEqual(1, repo.Count()); } }
public void TestDelete() { using (var repo = new AutoRepository(new FrontEndContext(_options))) { var auto = new Auto() { Kenteken = "AA - 11 - BB" }; repo.Insert(auto); repo.Delete(1); } using (var repo = new AutoRepository(new FrontEndContext(_options))) { Assert.AreEqual(0, repo.Count()); } }
public void TestFindAuto() { using (var repo = new AutoRepository(new AutosBackendContext(_options))) { repo.Insert(new Auto() { Kenteken = "AA-11-BB" }); } using (var repo = new AutoRepository(new AutosBackendContext(_options))) { var result = repo.Find(1); Assert.AreEqual(1, result.Id); Assert.AreEqual("AA-11-BB", result.Kenteken); } }
public void TestFindAllAuto() { using (var repo = new AutoRepository(new AutosBackendContext(_options))) { var auto = new Auto() { Kenteken = "AA-11-BB" }; repo.Insert(auto); auto = new Auto() { Kenteken = "AA-12-BB" }; repo.Insert(auto); } using (var repo = new AutoRepository(new AutosBackendContext(_options))) { Assert.AreEqual(2, repo.Count()); } }
public static void Main(string[] args) { var host = new WebHostBuilder() .UseKestrel() .UseContentRoot(Directory.GetCurrentDirectory()) .UseIISIntegration() .UseStartup <Startup>() .Build(); string sqlConnectionString = "server=db;userid=jomaya;password=jomaya;database=jomaya-autoservice;"; _publisher = new EventPublisher( new EventBusConfig() { Host = "rabbitmq", Port = 5672, } ); var optionsBuilder = new DbContextOptionsBuilder <AutosBackendContext>(); optionsBuilder.UseMySQL(sqlConnectionString); _context = new AutosBackendContext(optionsBuilder.Options); _autoRepo = new AutoRepository(_context); _onderhoudRepo = new OnderhoudRepository(_context); var config = new EventBusConfig() { Host = "rabbitmq", Port = 5672, QueueName = "jomaya.autoservice.auto.dispatcher" }; var publisher = new EventPublisher(config); _autoDispatcher = new AutoDispatcher(config, new Services.AutoService(_autoRepo, _onderhoudRepo, _publisher)); host.Run(); }
public AutosController(AutoRepository autoRepo) { db = autoRepo; }
static void Main(string[] args) { SasiuRepository sasiuRepository = new SasiuRepository(); AutoRepository autoRepository = new AutoRepository(); ClientRepository clientRepository = new ClientRepository(); Sasiu sasiu = new Sasiu(); sasiu.SasiuId = 1; sasiu.CodSasiu = "12"; sasiu.Denumire = "dsfsdfsdf"; //sasiuRepository.Add(sasiu); //sasiuRepository.Update(sasiu); Client client = new Client(); client.Nume = "TestName"; client.Prenume = "TestPrenume"; client.Adresa = "TestAdresa"; client.Localitate = "TestLocali"; client.Judet = "TestJudet"; client.Telefon = "0746653884"; client.Email = "TestEmail"; ////List<Sasiu> sasiuri = sasiuApi.GetSasiuri(); ////foreach (Sasiu sas in sasiuri) ////{ //// Console.WriteLine(sas.Denumire); ////Console.Read(); ////sasiuRepository.UpdateSasiu(2, sasiu); ////sasiuRepository.Delete(2); Auto auto = new Auto(); auto.NumarAuto = "TestNrAuto"; auto.SerieSasiu = "TestSerie"; auto.Sasiu = sasiu; Comanda comanda = new Comanda(); comanda.StareComanda = "TestStareComanda"; comanda.DataSystem = DateTime.Now; comanda.DataProgramare = DateTime.Now; comanda.DataFinalizare = DateTime.Now; comanda.KmBord = 100; comanda.Descriere = "Test Descriere"; comanda.ValoarePiese = 100; Imagine imagine = new Imagine(); imagine.Titlu = "TitluTest"; imagine.Descriere = "TestDescriere"; imagine.Data = DateTime.Now; DetaliuComanda detaliuComanda = new DetaliuComanda(); detaliuComanda.Imagines.Add(imagine); comanda.DetaliuComanda = detaliuComanda; auto.Comandas.Add(comanda); //client.Autoes.Add(auto); client.Autoes.Add(auto); clientRepository.Add(client); //// clientRepository.Delete(1); }
private static void Main(string[] args) { Console.WriteLine("Test Model Designer First"); var context = new CarServiceModelContainer(); var autoRepository = new AutoRepository(context); var clientRepository = new ClientRepository(context); var comandaRepository = new ComandaRepository(context); var detaliuComandaRepository = new DetaliuComandaRepository(context); var imagineRepository = new ImagineRepository(context); var materialRepository = new MaterialRepository(context); var mecanicRepository = new MecanicRepository(context); var operatieRepository = new OperatieRepository(context); var sasiuRepository = new SasiuRepository(context); ICarService carService = new CarService.Service.impl.CarService(autoRepository, clientRepository, comandaRepository, detaliuComandaRepository, imagineRepository, materialRepository, mecanicRepository, operatieRepository, sasiuRepository); var client = new Client() { Adresa = "Str. Palat", Email = "*****@*****.**", Nume = "Birsan", Prenume = "Ioana", Judet = "Iasi", Localitate = "Iasi", Telefon = "0040784043489" }; // var clientId = carService.AddClient(client); var clientToUpdate = carService.FindClientByEmail("*****@*****.**"); clientToUpdate.Judet = "Suceava"; // carService.UpdateClient(clientToUpdate); var sasiu = new Sasiu() { CodSasiu = "4F", Denumire = "Sasiu Audi" }; var sasiuId = carService.AddSasiu(sasiu); var auto = new Auto() { NumarAuto = "SV120COR", SerieSasiu = " WAUZZZ4FZ6A111222", }; // var autoId = carService.AddAuto(auto, clientToUpdate.Id, sasiuId); var autoToUpdate = carService.FindAutoByNumarAuto("SV120COR"); var detaliuComanda = new DetaliuComanda(); var comanda = new Comanda() { DataProgramare = DateTime.Now, DataFinalizare = DateTime.Today, DataSystem = DateTime.UtcNow, Descriere = "Schimbare placute frana fata", KmBord = 10, ValoarePiese = 100m, DetaliuComanda = detaliuComanda }; // var comandaId = carService.AddComanda(comanda, clientToUpdate.Id); carService.DeleteClient(clientToUpdate.Id); // carService.DeleteAuto(autoToUpdate.Id); var clients = carService.GetAllClients(); foreach (var c in clients) { Console.WriteLine(c.Nume + " " + c.Prenume); } }
public FrmRepVentas() { InitializeComponent(); this.VLista = new AutoRepository(); }
static void Main(string[] args) { var autoContext = new AutoContext(); var autoRepository = new AutoRepository <Auto>(autoContext); var clientRepository = new AutoRepository <Client>(autoContext); var sasiuRepository = new AutoRepository <Sasiu>(autoContext); var comandaRepository = new AutoRepository <Comanda>(autoContext); var autoService = new AutoService(autoRepository); var client = new Client { Adresa = "adresa de adresa", Nume = "Gorgan", Prenume = "Daniel-Mihai", Email = "*****@*****.**", Judet = "Iasi", Localitate = "Iasi" }; //clientRepository.Add(client); // Find & Update var ClientFind = clientRepository.FindById(1); //ClientFind.Nume = "Gorganus"; // Delete //clientRepository.Delete(2); //clientRepository.Save(); var Sasiu = new Sasiu { Denumire = "sasiu de sasiu", CodSasiu = "RO" }; //sasiuRepository.Add(Sasiu); //sasiuRepository.Save(); var SasiuFind = sasiuRepository.FindById(2); //var Comanda = new Comanda //{ // Descriere = "comanda noua" //}; //comandaRepository.Add(Comanda); //comandaRepository.Save(); var auto = new Auto { NumarAuto = "IS PUP 23", Client_Id = ClientFind.Id, Sasius_Id = SasiuFind.Id, SerieSasiu = "123" }; //autoRepository.Add(auto); //autoRepository.Save(); }