Example #1
0
        public static AddressRepository GetAddressRepository()
        {
            var repository = new AddressRepository();

            repository.UnitOfWork = GetUnitOfWork();
            return(repository);
        }
        public void CanFindStoreAddressIfOneDoesntExist()
        {
            RequestContext c = new RequestContext();

            c.CurrentStore.Id = 100;
            AddressRepository target = AddressRepository.InstantiateForMemory(c);

            int countBefore = target.CountOfAll();

            Assert.AreEqual(0, countBefore, "No Addresses should exist before the request for store address");

            // Target Store Address Should Not Exist
            Address actual;

            actual = target.FindStoreContactAddress();

            // Make sure we received an address
            Assert.IsNotNull(actual, "Actual address should not be null");
            Assert.AreNotEqual(string.Empty, actual.Bvin, "Bvin should be a valid value");

            // Make sure it was saved in the database
            int countAfter = target.CountOfAll();

            Assert.AreEqual(1, countAfter, "Request for store address should have created one if missing.");

            // Make sure we can update it
            actual.City = "My New City";
            Assert.IsTrue(target.Update(actual), "Update should be true");

            Address actual2 = target.FindStoreContactAddress();

            Assert.IsNotNull(actual2, "Second request should return an address");
            Assert.AreEqual(actual.Bvin, actual2.Bvin, "Both request should return the same address");
            Assert.AreEqual("My New City", actual2.City, "City should have been updated.");
        }
Example #3
0
        public void SearchAddressesSuccessTest()
        {
            int      id              = 1;
            string   Address1        = "Test";
            string   Address2        = "Test";
            string   City            = "Test";
            string   ZipCode         = "71000";
            bool     isDeleted       = false;
            int      AddressTypeId   = 1;
            int      CreatedByUserId = 1;
            DateTime DateCreated     = DateTime.Now;
            DateTime DateModified    = DateTime.Now;

            var addressDto = new AddressDto
            {
                AddressId       = id,
                Address1        = Address1,
                Address2        = Address2,
                City            = City,
                ZipCode         = ZipCode,
                AddressTypeId   = AddressTypeId,
                CreatedByUserId = CreatedByUserId,
                IsDeleted       = isDeleted,
                DateCreated     = DateCreated,
                DateModified    = DateModified
            };
            var mockRepo = new Mock <IkarusContext>();

            var addressRepository = new AddressRepository(mockRepo.Object);

            var result = addressRepository.SearchAddreses(addressDto);

            Assert.Null(result);
        }
Example #4
0
        public void SearchAddressesThrowExceptionFailureTest()
        {
            int      id              = 1;
            string   Address1        = "Test";
            string   Address2        = "Test";
            string   City            = "Test";
            string   ZipCode         = "71000";
            bool     isDeleted       = false;
            int      AddressTypeId   = 1;
            int      CreatedByUserId = 1;
            DateTime DateCreated     = DateTime.Now;
            DateTime DateModified    = DateTime.Now;

            AddressDto addressDto = null;
            var        mockRepo   = new Mock <IkarusContext>();

            var addressRepository = new AddressRepository(mockRepo.Object);

            try
            {
                var result = addressRepository.SearchAddreses(addressDto);
            }
            catch (Exception e)
            {
                Assert.IsType <ArgumentNullException>(e);
            }
        }
Example #5
0
 public UnitOfWork(bbuContext context)
 {
     _context             = context;
     Addresses            = new AddressRepository(_context);
     AppUsers             = new AppUserRepository(_context);
     Banks                = new BankRepository(_context);
     BankAccounts         = new BankAccountRepository(_context);
     Cemeteries           = new CemeteryRepository(_context);
     Credentials          = new CredentialsRepository(_context);
     Deceaseds            = new DeceasedRepository(_context);
     Doctors              = new DoctorRepository(_context);
     Employees            = new EmployeeRepository(_context);
     Files                = new FileRepository(_context);
     Funerals             = new FuneralRepository(_context);
     FuneralDocuments     = new FuneralDocumentRepository(_context);
     Genders              = new GenderRepository(_context);
     HomeAffairsOffices   = new HomeAffairsOfficeRepository(_context);
     HomeAffairsOfficers  = new HomeAffairsOfficerRepository(_context);
     Hospitals            = new HospitalRepository(_context);
     Informants           = new InformantRepository(_context);
     Members              = new MemberRepository(_context);
     Months               = new MonthRepository(_context);
     Mortuaries           = new MortuaryRepository(_context);
     NextOfKins           = new NextOfKinRepository(_context);
     NumberConfigurations = new NumberConfigurationRepository(_context);
     Payments             = new PaymentRepository(_context);
     PaymentPeriods       = new PaymentPeriodRepository(_context);
     People               = new PersonRepository(_context);
     PurchaseItems        = new PurchaseItemRepository(_context);
     Settings             = new SettingRepository(_context);
     States               = new StateRepository(_context);
     Suppliers            = new SupplierRepository(_context);
     Tasks                = new TaskRepository(_context);
     Years                = new YearRepository(_context);
 }
Example #6
0
        public static void AddAddress()
        {
            IRepository <Address> repository = new AddressRepository();
            Address address = new Address()
            {
                neighborhood = "İstiklal Mahallesi",
                street       = "Palmiye Caddesi",
                city         = "Manisa",
                district     = "Turgutlu",
                buildnumber  = 25,
                isactive     = 1
            };

            try
            {
                repository.Insert(address);

                Console.WriteLine("Ekleme başarılı");
            }
            catch (Exception e)
            {
                Console.WriteLine("Bir Hata Oluştu: " + e);
            }
            Console.ReadKey();
        }
Example #7
0
        // GET: api/Customer/5
        public HttpResponseMessage Get(string name)
        {
            CustomerRepository repo = new CustomerRepository();

            Data.customer customer = repo.GetbyField(name);
            if (customer != null)
            {
                CustomerBO customerBO = new CustomerBO();
                customerBO.CustomerKey   = customer.custkey;
                customerBO.CustId        = customer.custid;
                customerBO.CustName      = customer.custname;
                customerBO.CustomerGroup = customer.customergroup;
                customerBO.CreditLimit   = customer.creditlimit;
                customerBO.CreditStatus  = customer.creditstatus;
                var address = new AddressRepository().GetbyId(customer.addrkey);
                customerBO.Address = new AddressBO()
                {
                    Address1 = address.address1,
                    Address2 = address.address2,
                    City     = address.city,
                    State    = address.state,
                    Zip      = address.zipcode,
                    Email    = address.email,
                    Phone    = address.phone,
                    Fax      = address.fax
                };

                return(Request.CreateResponse(HttpStatusCode.OK, customerBO, Configuration.Formatters.JsonFormatter));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Not found", Configuration.Formatters.JsonFormatter));
            }
        }
Example #8
0
        public CostExternalServicesTest()
        {
            var mockRepo = new AddressRepository(); // Deberia mockear al ser UT, si fuera integración no.

            this.costRepository      = new CostRepository(mockRepo);
            this.costExternalService = new CostExternalService(this.costRepository);
        }
Example #9
0
        // GET: Users/Edit/5
        public async Task <IActionResult> Edit()
        {
            var user       = GetCurrentUser();
            var regionCode = user.TerritoryCode.Substring(0, 2);
            var repo       = new AddressRepository(_context, regionCode);
            var regions    = repo.GetRegions();
            var cities     = repo.GetLocalities();                                                   //.Where(city=>city.Value!=user.TerritoryCode);
            var streets    = repo.GetStreets(user.TerritoryCode == "0" ? null : user.TerritoryCode); //.Where(str => str.Value != user.StreetCode);
            var buildings  = repo.GetBuildings(user.StreetCode == "0"?null : user.StreetCode);       //.Where(house => house.Value != user.BuildingCode);
            var model      = new UserRegisterViewModel
            {
                Login          = user.Login,
                LastName       = user.LastName,
                FirstName      = user.FirstName,
                MiddleName     = user.MiddleName,
                Regions        = new SelectList(regions, "Value", "Text"),
                SelectedRegion = regionCode,
                Cities         = new SelectList(cities, "Value", "Text"),
                SelectedCity   = user.TerritoryCode,
                Streets        = user.TerritoryCode == "0" ? new SelectList(new[] { new SelectListItem {
                                                                                        Value = "0", Text = "Нет улиц"
                                                                                    } }, "Value", "Text") : new SelectList(streets, "Value", "Text"),
                SelectedStreet = user.StreetCode,
                Buildings      = user.StreetCode == "0" ? new SelectList(new[] { new SelectListItem {
                                                                                     Value = "0", Text = "Нет домов"
                                                                                 } }, "Value", "Text") : new SelectList(buildings, "Value", "Text"),
                SelectedBuilding = user.BuildingCode,
                BuildingName     = user.Building,
                Flat             = user.Flat
            };

            ViewData["Title"]  = "Изменение";
            ViewData["Action"] = "Edit";
            return(View("Edit", model));
        }
        public async Task <IDictionary <string, IList <DTO.AddressOutput> > > GetEntitiesByCityIdAsync(IEnumerable <long> ids)
        {
            var foundAddresses = await AddressRepository.GetEntitiesByCityIdAsync(ids,
                                                                                  includes : Includes);

            return(Mapper.Map <IDictionary <string, IList <DTO.AddressOutput> > >(foundAddresses));
        }
Example #11
0
 public UnitOfWork(ApplicationContext context)
 {
     _context  = context;
     Addresses = new AddressRepository(_context);
     Customers = new CustomerRepository(_context);
     Countries = new CountryRepository(_context);
 }
Example #12
0
        public HttpResponseMessage GetAddressById(string Id)
        {
            AddressRepository repo = new AddressRepository();
            var address            = repo.GetbyId(Guid.Parse(Id));

            return(Request.CreateResponse(HttpStatusCode.OK, address));
        }
Example #13
0
        // GET: /View
        public ActionResult View(int id)
        {
            //Check Exists
            Location location = new Location();

            location = locationRepository.GetLocation(id);
            if (location == null)
            {
                ViewData["ActionMethod"] = "ViewGet";
                return(View("RecordDoesNotExistError"));
            }

            AddressLocationVM addressLocationVM = new AddressLocationVM();

            addressLocationVM.Location = location;
            addressLocationVM.Address  = new Address();

            Address address = locationRepository.GetLocationAddress(id);

            if (address != null)
            {
                AddressRepository addressRepository = new AddressRepository();
                addressRepository.EditForDisplay(address);
                addressLocationVM.Address = address;
            }

            return(View(addressLocationVM));
        }
Example #14
0
        public T GetRepo <T>(CustomerDbContext context)
        {
            dynamic result = null;

            if (typeof(T) == typeof(IAddressRepository))
            {
                result = new AddressRepository(context);
            }
            if (typeof(T) == typeof(IContactRepository))
            {
                result = new ContactRepository(context);
            }
            if (typeof(T) == typeof(ICustomerRepository))
            {
                result = new CustomerRepository(context);
            }
            if (typeof(T) == typeof(IAddressTypeRepository))
            {
                result = new AddressTypeRepository(context);
            }
            if (typeof(T) == typeof(IContactTypeRepository))
            {
                result = new ContactTypeRepository(context);
            }
            if (typeof(T) == typeof(ICustomerAddressRepository))
            {
                result = new CustomerAddressRepository(context);
            }
            if (typeof(T) == typeof(ICustomerContactsRepository))
            {
                result = new CustomerContactsRepository(context);
            }
            return((T)result);
        }
        public async Task <DTO.AddressOutput> UpdateEntityAsync(long id, DTO.AddressInput address, string userName,
                                                                string normalizedUserName)
        {
            try
            {
                await TransactionHandler.BeginTransactionAsync();

                var foundAddress = await CheckAccessRightsAndGetAddressAsync(id, userName, normalizedUserName);

                var(city, country, state) = await InsertOrGetAddressRelationsAsync(address);

                foundAddress.City       = city;
                foundAddress.Country    = country;
                foundAddress.State      = state;
                foundAddress.DoorNumber = address.DoorNumber;
                foundAddress.Street     = address.Street;
                await AddressRepository.UpdateEntityAsync(foundAddress);

                await TransactionHandler.CommitTransactionAsync();

                return(Mapper.Map <DTO.AddressOutput>(foundAddress));
            }
            catch
            {
                await TransactionHandler.RollbackTransactionAsync();

                throw;
            }
            finally
            {
                await TransactionHandler.DisposeTransactionAsync();
            }
        }
Example #16
0
 public EventController(EventRepository eventRepository, AddressRepository addressRepository,
                        TicketRepository ticketRepository)
 {
     EventRepository   = eventRepository;
     AddressRepository = addressRepository;
     TicketRepository  = ticketRepository;
 }
 public void AddressRepositoryConstructorTest()
 {
     Assert.Throws <ArgumentNullException>(() =>
     {
         IAddressRepository newAddressRepository = new AddressRepository(null);
     });
 }
Example #18
0
        // POST api/values
        public HttpResponseMessage Post([FromBody] address add)
        {
            AddressRepository repo = new AddressRepository();
            var value = repo.Add(add);

            return(Request.CreateResponse(HttpStatusCode.OK, value, Configuration.Formatters.JsonFormatter));
        }
Example #19
0
        public HttpResponseMessage GetbyName(string name)
        {
            AddressRepository repo = new AddressRepository();
            var address            = repo.GetbyField(name);

            if (address != null)
            {
                AddressBO bo = new AddressBO()
                {
                    Address1 = address.address1,
                    Address2 = address.address2,
                    City     = address.city,
                    State    = address.state,
                    Zip      = address.zipcode,
                    Email    = address.email,
                    Email2   = address.email2,
                    Fax      = address.fax,
                    Phone    = address.phone,
                    Phone2   = address.phone2,
                    Name     = address.addrname
                };
                return(Request.CreateResponse(HttpStatusCode.OK, bo,
                                              Configuration.Formatters.JsonFormatter));
            }
            return(Request.CreateResponse(HttpStatusCode.NoContent, "Not found"));
        }
 public ConferenceService(ConferenceRepository confRepo, AddressRepository addressRepo, UserRepository userRepo, SlotRepository slotRepo)
 {
     _confRepo    = confRepo;
     _addressRepo = addressRepo;
     _userRepo    = userRepo;
     _slotRepo    = slotRepo;
 }
Example #21
0
        public static AddressRepository GetAddressRepository(IUnitOfWork unitOfWork)
        {
            var repository = new AddressRepository();

            repository.UnitOfWork = unitOfWork;
            return(repository);
        }
        public async Task <DTO.AddressOutput> RemoveEntityByIdAsync(long id, string userName, string normalizedUserName)
        {
            try
            {
                await TransactionHandler.BeginTransactionAsync();

                var foundAddress = await CheckAccessRightsAndGetAddressAsync(id, userName, normalizedUserName);

                var removedAddress = await AddressRepository.RemoveEntityAsync(foundAddress);

                await TransactionHandler.CommitTransactionAsync();

                return(Mapper.Map <DTO.AddressOutput>(removedAddress));
            }
            catch
            {
                await TransactionHandler.RollbackTransactionAsync();

                throw;
            }
            finally
            {
                await TransactionHandler.DisposeTransactionAsync();
            }
        }
Example #23
0
            static void Main(string[] args)
            {
                Console.WriteLine("CRM Example!");
                //create Customer
                Customer c1 = new Customer(1);


                CustomerRepository cr = new CustomerRepository();

                //Add Customer
                cr.Save(c1);

                //Customer Information
                Customer c2 = cr.Retrieve(1);

                Console.WriteLine(c2.CustomerId + " " + c2.EmailAddress + " Fullname:+" + c2.FullName);
                //Address Information
                AddressRepository ad = new AddressRepository();
                var addresslist      = new List <Address>();
                int id = c2.CustomerId;
                //addresslist =  ad.RetrieveByCustomerId(id);


                //Order History

                /* OrderRepository or = new OrderRepository();
                 * OrderDisplay od = or.RetrieveOrderDisplay(10);
                 * Console.WriteLine(od.FirstName + " " + od.LastName);
                 */
                OrderRepository o  = new OrderRepository();
                Order           o1 = o.Retrieve(10);

                Console.WriteLine(o1.OrderDate);
            }
Example #24
0
        public HttpResponseMessage GetDriverByID(string brokerkey)
        {
            Data.broker broker   = repo.GetbyId(Guid.Parse(brokerkey));
            BrokerBO    brokerBO = new BrokerBO();

            if (broker != null)
            {
                brokerBO.BrokerId   = broker.brokerid;
                brokerBO.BrokerName = broker.brokername;
                brokerBO.BrokerKey  = broker.brokerkey;
                var address = new AddressRepository().GetbyId(broker.addrkey);
                brokerBO.Address = new AddressBO()
                {
                    AddrKey  = address.addrkey,
                    Address1 = address.address1,
                    Address2 = address.address2,
                    City     = address.city,
                    State    = address.state,
                    Zip      = address.zipcode,
                    Email    = address.email,
                    Phone    = address.phone,
                    Fax      = address.fax,
                    Country  = address.country,
                    Website  = address.website,
                };
                return(Request.CreateResponse(HttpStatusCode.OK, brokerBO, Configuration.Formatters.JsonFormatter));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, "Not found", Configuration.Formatters.JsonFormatter));
            }
        }
Example #25
0
    /// <summary>
    /// Save changes in address settings.
    /// </summary>
    /// <param name="sender">Object sender : fvAddress.</param>
    /// <param name="e">FormViewUpdateEventArgs e.</param>
    protected void OnAddressItemUpdating(Object sender, FormViewUpdateEventArgs e)
    {
        DropDownList ddlCountry   = fvAddress.FindControl("ddlCountry") as DropDownList;
        DropDownList ddlCity      = fvAddress.FindControl("ddlCity") as DropDownList;
        TextBox      tbxArea      = fvAddress.FindControl("tbxArea") as TextBox;
        TextBox      tbxStreet    = fvAddress.FindControl("tbxStreet") as TextBox;
        TextBox      tbxHome      = fvAddress.FindControl("tbxHome") as TextBox;
        TextBox      tbxApartment = fvAddress.FindControl("tbxApartment") as TextBox;
        Guid         country;
        Guid?        vCountry = null;
        Guid         city;
        Guid?        vCity = null;

        if (Guid.TryParse(ddlCountry.SelectedValue, out country))
        {
            vCountry = country;
        }

        if (Guid.TryParse(ddlCity.SelectedValue, out city))
        {
            vCity = city;
        }

        AddressRepository.ModifyAddress(
            null,
            true,
            this._userID,
            vCountry,
            vCity,
            tbxArea.Text.Trim(),
            tbxStreet.Text.Trim(),
            tbxHome.Text.Trim(),
            tbxApartment.Text.Trim());
    }
Example #26
0
        public UnitOfWork(AddressRepository addressRepository, CandidateRepository candidateRepository, EmployerRepository employerRepository,
                          GorvernmentRepository gorvernmentRepository, JobRepository jobRepository, MicroCredentialRepository microCredentialRepository, MoocProviderRepository moocProviderRepository,
                          RecruitmentAgencyRepository recruitmentAgencyRepository, AccreditationBodyRepository accreditationBodyRepository, CandidateMicroCredentialCourseRepository candidateMicroCredentialCourseRepository,
                          EndorsementBodyRepository endorsementBodyRepository, CandidateJobApplicationRepository candidateJobApplicationRepository, CandidatetMicroCredentialBadgesRepository candidatetMicroCredentialBadgesRepository,
                          StratisAccountRepository stratisAccountRepository)
        {
            _addressRepository = addressRepository;

            _candidateRepository = candidateRepository;

            _employerRepository = employerRepository;

            _gorvernmentRepository = gorvernmentRepository;

            _jobRepository = jobRepository;

            _microCredentialRepository = microCredentialRepository;

            _moocProviderRepository = moocProviderRepository;

            _recruitmentAgencyRepository = recruitmentAgencyRepository;

            _accreditationBodyRepository = accreditationBodyRepository;

            _candidateMicroCredentialCourseRepository = candidateMicroCredentialCourseRepository;

            _endorsementBodyRepository = endorsementBodyRepository;

            _candidateJobApplicationRepository = candidateJobApplicationRepository;

            _candidatetMicroCredentialBadgesRepository = candidatetMicroCredentialBadgesRepository;

            _stratisAccountRepository = stratisAccountRepository;
        }
Example #27
0
        public void TestCreateEntityValid()
        {
            // Arrange
            var mockContext = new Mock <DemographicsDbContext>();

            mockContext
            .Setup(x => x.Set <Address>().Add(It.IsAny <Address>()))
            .Verifiable();

            var repository = new AddressRepository(mockContext.Object);

            var testObject = new Address
            {
                StreetName  = "Test",
                HouseNumber = "Test",
                Town        = "Test",
                State       = "Test",
                ZipCode     = "Test"
            };

            // Act
            var result = repository.Create(testObject);

            // Assert
            Assert.NotNull(result);

            mockContext
            .Verify(x => x.Set <Address>().Add(It.IsAny <Address>()), Times.Once);
        }
Example #28
0
        public async Task TestGetByCompleteAddressAsyncModelInvalid()
        {
            // Arrange
            var patients = GenerateAddressEntityList();

            var mockDbSet = patients.AsQueryable().BuildMockDbSet();

            var mockContext = new Mock <DemographicsDbContext>();

            mockContext
            .Setup(x => x.Set <Address>())
            .Returns(mockDbSet.Object)
            .Verifiable();

            var testModel = new AddressInputModel
            {
                StreetName  = "Test Street",
                HouseNumber = "666",
                Town        = "Test Town",
                State       = "Test State",
                ZipCode     = "12345"
            };

            var repository = new AddressRepository(mockContext.Object);

            // Act
            var result = await repository.GetByCompleteAddressAsync(testModel);

            // Assert
            Assert.Null(result);
        }
Example #29
0
 public AddressController(AddressRepository r)
 {
     //  for tests over real database
     //  does not work...
     //db = new SGMasterBaseEntities("metadata=res://*/Models.SGMasterBase.csdl|res://*/Models.SGMasterBase.ssdl|res://*/Models.SGMasterBase.msl;provider=System.Data.SqlClient;provider connection string=\"Data Source=.\\SQLEXPRESS;Initial Catalog=SGMasterBase;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework\"");
     SetRepository(r, null);
 }
        public void SaveLoadTwiceNoChangesTest()
        {
            //Arrange
            var addressRepository = new AddressRepository();

            var address = new Address()
            {
                StreetLine1 = "Awesome 5 street", City = "Awesome Town", StateOrRegion = "AS", Country = "United Satetes of Awesomeness", Code = "12492", Type = AddressType.Home
            };

            addressRepository.Save(address);
            var loadedAddress = addressRepository.Load(address.Guid);

            //Act
            var saveResult = addressRepository.Save(loadedAddress);
            var result     = addressRepository.Load(loadedAddress.Guid);

            //Assert
            Assert.False(saveResult);
            Assert.NotEqual(address, loadedAddress);
            Assert.NotEqual(loadedAddress, result);
            Assert.NotEqual(address, result);
            Assert.Equal(address.Guid, loadedAddress.Guid);
            Assert.Equal(address.Guid, result.Guid);
            Assert.Equal(address.City, loadedAddress.City);
            Assert.Equal(loadedAddress.City, result.City);
        }
Example #31
0
 public ProductsService()
 {
     _context = new SilberScarvesDbContext();
     _scarfRepo = new ScarfItemRepository(_context);
     _custRepo = new CustomerRepository(_context);
     _orderRepo = new OrderRepository(_context);
     _addrRepo = new AddressRepository(_context);
 }
 private DataProvider()
 {
     Companies = new CompanyRepository();
     Addresses = new AddressRepository();
     Accounts = new AccountRepsitory();
     Employees = new EmployeeRepository();
     Transactions = new TransactionRepository();
 }
Example #33
0
 public DoctorService(DoctorRepository doctorRepository, UserRepository userRepository, AddressRepository addressRepository, ScheduleRepository scheduleRepository, AppointmentRepository appointmentRepository, WaitingRepository waitingRepository)
 {
     _doctorRepository = doctorRepository;
     _userRepository = userRepository;
     _addressRepository = addressRepository;
     _scheduleRepository = scheduleRepository;
     _appointmentRepository = appointmentRepository;
     _waitingRepository = waitingRepository;
 }
        public void SetUp()
        {
            testDataHelper = new TestDataHelper();
            var constituent = ConstituentMother.ConstituentWithName(ConstituentNameMother.JamesFranklin());
            savedConstituent = testDataHelper.CreateConstituent(constituent);
            savedAddress = testDataHelper.CreateAddress(AddressMother.SanFrancisco(savedConstituent));

            addressRepository = new AddressRepository(testDataHelper.session);
        }
 public SearchServiceImpl(ConstituentRepository constituentRepository, EmailRepository emailRepository, PhoneRepository phoneRepository, OccupationRepository occupationRepository, EducationDetailRepository educationDetailRepository, AddressRepository addressRepository)
 {
     this.constituentRepository = constituentRepository;
     this.addressRepository = addressRepository;
     this.educationDetailRepository = educationDetailRepository;
     this.occupationRepository = occupationRepository;
     this.phoneRepository = phoneRepository;
     this.emailRepository = emailRepository;
 }
 public void Fourteenth_Avenue_Abbreviation()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("44 14th Avenue"), out hits);
     ExplainResult(results);
     Assert.AreEqual("44 Fourteenth Avenue, Tauranga South, Tauranga 3112", results.First().Format.AddressOneLine);
 }
 public void One_Term()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("Poto"), out hits);
     ExplainResult(results);
     Assert.AreEqual(25, results.Count());
 }
Example #38
0
 public void _87B_Park_Road_Katikat_Test()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("87B park road kati"), out hits);
     ExplainResult(results);
     Assert.AreEqual("87B Park Road, Katikati 3129", results.First().Format.AddressOneLine);
 }
 public void box_hill()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("box hill"), out hits);
     ExplainResult(results);
     Assert.AreEqual("5/33 Box Hill, Khandallah, Wellington 6035", results.First().Format.AddressOneLine);
 }
 public void Blakey_Ave_Abbreviation()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("25 Blakey Ave Karori Wellington 6012"), out hits);
     ExplainResult(results);
     Assert.AreEqual("25 Blakey Avenue, Karori, Wellington 6012", results.First().Format.AddressOneLine);
 }
 public void Full_StreetName_PostCode()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("8 St Elizabeth Heights 5010"), out hits);
     ExplainResult(results);
     Assert.AreEqual(25, results.Count());
     Assert.AreEqual(1000, hits);
     Assert.AreEqual("St Elizabeth Heights", results.First().StreetName);
     Assert.AreEqual("8", results.First().StreetNumber);
 }
Example #42
0
        protected override IController GetControllerInstance(System.Web.Routing.RequestContext requestContext, Type controllerType)
        {
            //var customerRepository = new CustomerRepository(@"C:\hola.txt");
            //var customerService = new CustomerService(customerRepository);

            //return controllerType == typeof(HomeController) ?
            //new HomeController(customerService) : base.GetControllerInstance(requestContext, controllerType);
            var txtaddressRespository = new AddressRepository(@"C:\hola.txt");
            var sqladdressRespository = new sqlAddressRepository(@"C:\hola.txt");
            var addressService = new AddressService(sqladdressRespository);
            return controllerType == typeof(HomeController) ?
            new HomeController(addressService) : base.GetControllerInstance(requestContext, controllerType);
        }
Example #43
0
 public ContactService(RequestContext c,
                       AddressRepository addresses,
                       PriceGroupRepository pricegroups,
                       MailingListRepository mailingLists,
                       VendorRepository vendors,
                       ManufacturerRepository manufacturers,
                       AffiliateRepository affiliates,
                       AffiliateReferralRepository affiliateReferrals)
 {
     context = c;
     Addresses = addresses;
     PriceGroups = pricegroups;
     this.MailingLists = mailingLists;
     this.Vendors = vendors;
     this.Manufacturers = manufacturers;
     this.Affiliates = affiliates;
     this.AffiliateReferrals = affiliateReferrals;
 }
        public ContactManager(AddressRepository addressRepository,
                              AddressTypeRepository addressTypeRepository,
                              PhoneRepository phoneRepository,
                              PhoneTypeRepository phoneTypeRepository,
                              ProfileAddressRepository profileAddressRepository,
                              ProfilePhoneRepository profilePhoneRepository,
                              ProfileRepository profileRepository)
        {
            if (addressRepository == null)
                throw new ArgumentNullException("addressRepository");

            if (addressTypeRepository == null)
                throw new ArgumentNullException("addressTypeRepository");

            if (phoneRepository == null)
                throw new ArgumentNullException("phoneRepository");

            if (phoneTypeRepository == null)
                throw new ArgumentNullException("phoneTypeRepository");

            if (profileAddressRepository == null)
                throw new ArgumentNullException("profileAddressRepository");

            if (profilePhoneRepository == null)
                throw new ArgumentNullException("profilePhoneRepository");

            if (profileRepository == null)
                throw new ArgumentNullException("profileRepository");

            _addressRepository = addressRepository;
            _addressTypeRepository = addressTypeRepository;
            _phoneRepository = phoneRepository;
            _phoneTypeRepository = phoneTypeRepository;
            _profileAddressRepository = profileAddressRepository;
            _profilePhoneRepository = profilePhoneRepository;
            _profileRepository = profileRepository;
        }
 public void Road_22_Stafford_Street_Moun()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("22 Stafford Street Moun"), out hits);
     ExplainResult(results);
     Assert.AreEqual("22 Stafford Street, Mount Victoria, Wellington 6011", results.First().Format.AddressOneLine);
 }
 public void Road_4_29Waiapu_Road_Kelburn()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("4/29 Waiapu Road, Kelburn, Wellington 6012"), out hits);
     ExplainResult(results);
     Assert.AreEqual("4/29 Waiapu Road, Kelburn, Wellington 6012", results.First().Format.AddressOneLine);
 }
 public void Road_8_st_eliz()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("8 st Elizabeth heigh"), out hits);
     ExplainResult(results);
     Assert.AreEqual("8 St Elizabeth Heights, Normandale, Lower Hutt 5010", results.First().Format.AddressOneLine);
 }
 public void Suite_Floor_Street_70Hobson()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("Suite 3 Floor 6, 70 Hobson Street, Thorndon, Wellington 6011"), out hits);
     ExplainResult(results);
     Assert.AreEqual("Suite 6 Floor 3, 70 Hobson Street, Thorndon, Wellington 6011", results.First().Format.AddressOneLine);
 }
 public void PO_Box_2()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("PO Box 2"), out hits);
     ExplainResult(results);
     Assert.AreEqual("PO BOX 2, Mapua, 7048", results.First().Format.AddressOneLine);
 }
Example #50
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AddressController" /> class.
 /// </summary>
 public AddressController()
 {
     this.addressRepository = new AddressRepository();
 }
Example #51
0
 public static AddressRepository GetAddressRepository(IUnitOfWork unitOfWork)
 {
     var repository = new AddressRepository();
     repository.UnitOfWork = unitOfWork;
     return repository;
 }
 public void Road_15_vol()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("15 vol"), out hits);
     ExplainResult(results);
     Assert.AreEqual("15 Voltaire Court, Botany Downs, Auckland 2010", results.First().Format.AddressOneLine);
 }
 public void Road_15_volg()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("15 volg"), out hits);
     ExplainResult(results);
     Assert.AreEqual("15 Volga Street, Island Bay, Wellington 6023", results.First().Format.AddressOneLine);
 }
 public void Road_15_voss()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("15 voss"), out hits);
     ExplainResult(results);
     Assert.AreEqual("15 Voss Street, Shirley, Christchurch 8013", results.First().Format.AddressOneLine);
 }
 public void PO_Box()
 {
     AddressRepository repo = new AddressRepository();
     repo.GetExplanations = true;
     int hits = 0;
     var results = repo.Read(new AddressSearchQuery("PO Box"), out hits);
     ExplainResult(results);
     Assert.AreEqual("PO BOX 24001, Wellington, 6142", results.First().Format.AddressOneLine);
 }
 public AddressController()
 {
     repo = new AddressRepository();
 }
 public AddressManagementService(AddressRepository addressRepository)
 {
     _addressRepostory = addressRepository;
 }