예제 #1
0
        public async void unit_test_getAddress(string id, bool exp)
        {
            //Arrange

            //Act
            var result = await _uut.GetAddress(id);

            //Assert
            Xunit.Assert.Equal(exp, result != null);
        }
예제 #2
0
        public CustomerDetail(DetailMode mode,
                              Dashboard parent,
                              AddressRepository addressRepo,
                              CustomerRepository custRepo,
                              Customer customerToModify = null)
        {
            CustomerRepo = custRepo;
            AddressRepo  = addressRepo;

            Mode      = mode;
            Dashboard = parent;
            if (customerToModify != null)
            {
                CustomerToModify = customerToModify;
                AddressToModify  = AddressRepo.GetAddress(customerToModify.AddressId);
            }

            Cities = AddressRepo.GetAllCities();

            InitializeComponent();

            lblError.Visible      = false;
            cmbCity.ValueMember   = "Id";
            cmbCity.DisplayMember = "Name";
            cmbCity.DataSource    = Cities;
        }
        public IHttpActionResult GetPerson(int Id)
        {
            PersonCompleteDTO personCompleteDTO = new PersonCompleteDTO();

            personCompleteDTO.Person  = personRepository.GetPerson(Id);
            personCompleteDTO.Address = addressRepository.GetAddress(Id);
            personCompleteDTO.Product = productRepository.GetProduct(Id);

            return(Ok(personCompleteDTO));
        }
예제 #4
0
        public ActionResult Address(int id = 0)
        {
            var userId = User.Identity.GetUserId();

            var address = id == 0 ?
                          _addressRepository.GetNewAddress(userId) :
                          _addressRepository.GetAddress(userId, id);

            var editAddress = PrepareEditAddressVm(address, userId);

            return(View(editAddress));
        }
예제 #5
0
        public ActionResult ConfirmChangesScreen(LocationWizardVM updatedLocationViewModel)
        {
            //Make sure we have minimum data
            if (updatedLocationViewModel.Location == null)
            {
                return(Json(new WizardJSONResponse
                {
                    html = ControllerExtension.RenderPartialViewToString(this, "Error", "No Location Information"),
                    message = "Error",
                    success = false
                }));
            }

            //get LocationId
            int locationId = updatedLocationViewModel.Location.LocationId;

            //Object to store messages for Display
            WizardMessages wizardMessages = new WizardMessages();

            //Editing a Location
            if (locationId > 0)
            {
                //Get Original Information from Databse
                Location originalLocation = new Location();
                originalLocation = locationRepository.GetLocation(locationId);

                AddressRepository addressRepository = new AddressRepository();
                Address           originalAddress   = new Address();
                int addressId = updatedLocationViewModel.Address.AddressId;
                originalAddress = addressRepository.GetAddress(addressId);

                LocationWizardVM originalLocationViewModel = new LocationWizardVM();
                originalLocationViewModel.Location = originalLocation;
                originalLocationViewModel.Address  = originalAddress;

                //Compare Original Information to Submitted Information to Create a List of Messages about changes
                locationWizardRepository.BuildLocationChangeMessages(wizardMessages, originalLocationViewModel, updatedLocationViewModel);
            }
            else
            {
                //Adding an Item - Create a List of Messages about changes
                locationWizardRepository.BuildLocationChangeMessages(wizardMessages, null, updatedLocationViewModel);
            }

            //Return List of Changes to user for Final Confirmation
            return(Json(new WizardJSONResponse
            {
                html = ControllerExtension.RenderPartialViewToString(this, "ConfirmChangesScreen", wizardMessages),
                message = "Success",
                success = true
            }));
        }
예제 #6
0
        private static OrganizationListModel GetOrganizationListModel(IEnumerable <Organization> organizations)
        {
            IAddressRepository addressRepository = new AddressRepository();

            var binder = new OrganizationBasicInfoBinder();
            var basicModelCollection = new List <OrganizationBasicInfoModel>();

            foreach (var item in organizations)
            {
                Address address = null;
                if (item.BusinessAddressId > 0)
                {
                    address = addressRepository.GetAddress(item.BusinessAddressId);
                }

                basicModelCollection.Add(binder.ToModel(item, address));
            }

            return(binder.ToModel(basicModelCollection));
        }
예제 #7
0
        public async Task <IActionResult> GetAddress(int Id)
        {
            Address address;

            address = await _repo.GetAddress(Id);

            var addressToReturn = new AddressData
            {
                Country       = address.Country,
                State         = address.State,
                ZipCode       = address.ZipCode,
                City          = address.City,
                Street        = address.Street,
                AptNum        = address.AptNum,
                AddressCustID = address.AddressCustID
            };

            //var addressToReturn = _mapper.Map<AddressData>(address);

            return(Ok(addressToReturn));
        }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            ClientDetailAddress clientDetailAddress = new ClientDetailAddress();

            clientDetailAddress = clientDetailAddressRepository.GetAddressClientDetail(id);

            //Check Exists
            if (clientDetailAddress == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            int clientDetailId = clientDetailAddress.ClientDetailId;
            ClientDetailClientSubUnitTravelerType clientDetailClientSubUnitTravelerType = new ClientDetailClientSubUnitTravelerType();

            clientDetailClientSubUnitTravelerType = clientDetailClientSubUnitTravelerTypeRepository.GetClientDetailClientSubUnitTravelerType(clientDetailId);

            //Check Exists
            if (clientDetailClientSubUnitTravelerType == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            string csu = clientDetailClientSubUnitTravelerType.ClientSubUnitGuid;
            string tt  = clientDetailClientSubUnitTravelerType.TravelerTypeGuid;


            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);

            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnit(csu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientSubUnitTravelerTypeAddressVM clientSubUnitTravelerTypeAddressVM = new ClientSubUnitTravelerTypeAddressVM();

            clientSubUnitTravelerTypeAddressVM.ClientSubUnit = clientSubUnit;

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);
            clientSubUnitTravelerTypeAddressVM.ClientDetail = clientDetail;

            TravelerType travelerType = new TravelerType();

            travelerType = travelerTypeRepository.GetTravelerType(tt);
            clientSubUnitTravelerTypeAddressVM.TravelerType = travelerType;

            Address address = new Address();

            address = addressRepository.GetAddress(clientDetailAddress.AddressId);
            clientSubUnitTravelerTypeAddressVM.Address = address;

            CountryRepository countryRepository = new CountryRepository();

            clientSubUnitTravelerTypeAddressVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName", address.CountryCode);

            MappingQualityRepository mappingQualityRepository = new MappingQualityRepository();

            clientSubUnitTravelerTypeAddressVM.MappingQualityCodes = new SelectList(mappingQualityRepository.GetAllMappingQualities().ToList(), "MappingQualityCode", "MappingQualityCode", address.MappingQualityCode);

            return(View(clientSubUnitTravelerTypeAddressVM));
        }
예제 #9
0
        public async Task <IActionResult> GetAddressById(int addressId)
        {
            var address = await _repo.GetAddress(addressId);

            return(Ok(address));
        }
예제 #10
0
        public Address GetCustomerAddress(int id)
        {
            var result = _repo.GetAddress(id);

            return(result);
        }
 public static VMAddress GetAddress(string email)
 {
     return(AddressRepository.GetAddress(email));
 }
 public static UserAddressModel GetAddress(int addressId)
 {
     return(AddressRepository.GetAddress(addressId));
 }
        // GET: /Edit
        public ActionResult Edit(int id)
        {
            ClientDetailAddress clientDetailAddress = new ClientDetailAddress();

            clientDetailAddress = clientDetailAddressRepository.GetAddressClientDetail(id);

            //Check Exists
            if (clientDetailAddress == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            int clientDetailId = clientDetailAddress.ClientDetailId;
            ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount();

            clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(clientDetailId);

            //Check Exists
            if (clientDetailClientAccount == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            string can = clientDetailClientAccount.ClientAccountNumber;
            string ssc = clientDetailClientAccount.SourceSystemCode;

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientAccount(can, ssc))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientAccountAddressVM clientAccountAddressVM = new ClientAccountAddressVM();

            clientAccountAddressVM.ClientAccount = clientAccount;

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);
            clientAccountAddressVM.ClientDetail = clientDetail;

            Address address = new Address();

            address = addressRepository.GetAddress(clientDetailAddress.AddressId);
            clientAccountAddressVM.Address = address;

            CountryRepository countryRepository = new CountryRepository();

            clientAccountAddressVM.Countries = new SelectList(countryRepository.GetAllCountries().ToList(), "CountryCode", "CountryName", address.CountryCode);

            MappingQualityRepository mappingQualityRepository = new MappingQualityRepository();

            clientAccountAddressVM.MappingQualityCodes = new SelectList(mappingQualityRepository.GetAllMappingQualities().ToList(), "MappingQualityCode", "MappingQualityCode", address.MappingQualityCode);

            return(View(clientAccountAddressVM));
        }