public static void Main(string[] args) { AddressData[] addresses = new AddressData[] { new AddressData // Belgium { Address = "Rue du Cornet 6", City = "VERVIERS", State = null, Country = "Belgium", Zip = "B-4800" }, new AddressData { Address = "1600 Pennsylvania ave", City = "Washington", State = "DC" } }; var gls = new GoogleLocationService(); foreach (var address in addresses) { var latlong = gls.GetLatLongFromAddress(address); var Latitude = latlong.Latitude; var Longitude = latlong.Longitude; System.Console.WriteLine("Address ({0}) is at {1},{2}", address, Latitude, Longitude); } System.Console.ReadLine(); }
public EditProducerViewModel() { Address = new AddressData(); Contact = new ContactData(); Business = new ProducerBusinessTypeViewModel(); }
public ImporterData() { Address = new AddressData(); Contact = new ContactData(); Business = new BusinessInfoData(); }
public EditCarrierViewModel() { Address = new AddressData(); Contact = new ContactData(); Business = new BusinessTypeViewModel(); }
public ImporterViewModel() { Address = new AddressData(); Contact = new ContactData(); Business = new BusinessTypeViewModel(); }
public EditFacilityViewModel() { Address = new AddressData(); Contact = new ContactData(); Business = new BusinessTypeViewModel(); }
public static Address CreateAddress(AddressData address, string countryName) { return new Address(address.StreetOrSuburb, address.Address2, address.TownOrCity, address.Region, address.PostalCode, address.CountryName ?? countryName); }
public ExporterViewModel() { Address = new AddressData(); Contact = new ContactData(); Business = new BusinessTypeViewModel(); Business.DisplayAdditionalNumber = true; Business.DisplayCompaniesHouseHint = true; }
public static Address CreateAddress(AddressData address, Country country) { return new Address(address.Address1, address.Address2, address.TownOrCity, address.CountyOrRegion, address.Postcode, country, address.Telephone, address.Email); }
/// <summary> /// Calls the listed endpoint on this controller. /// </summary> public static AddressData AddAddressBadData(SessionAuthUser authUser, AddressData template) { string originalName = template.Name; template.Name = String.Empty; AddressController controller = GetController<AddressController>(authUser, template, AddressController.AddAddressAction); ActionResult result = controller.AddAddress(template); Assert.IsNotNull(result); ViewResult viewResult = result as ViewResult; AddressData model = AssertModel<AddressData>(viewResult); model.Name = originalName; return model; }
public static void Main(string[] args) { AddressData[] addresses = new AddressData[] { new AddressData // Belgium { Address = "Rue du Cornet 6", City = "VERVIERS", State = null, Country = "Belgium", Zip = "B-4800" }, new AddressData { Address = "1600 Pennsylvania ave", City = "Washington", State = "DC" }, new AddressData { Address = "407 N Maple Dr. #1", City = "Beverly Hills", State = "CA" } }; var gls = new GoogleLocationService(); foreach (var address in addresses) { try { var latlong = gls.GetLatLongFromAddress(address); var latitude = latlong.Latitude; var longitude = latlong.Longitude; System.Console.WriteLine("Address ({0}) is at {1},{2}", address, latitude, longitude); var reversedAddress = gls.GetAddressFromLatLang(latitude, longitude); System.Console.WriteLine("Reversed Address from ({1},{2}) is {0}", reversedAddress, latitude, longitude); System.Console.WriteLine("======================================="); } catch(System.Net.WebException ex) { System.Console.WriteLine("Google Maps API Error {0}", ex.Message); } } System.Console.ReadLine(); }
public static string buildCustomerAddressMcKession(AddressData customerAddress) { var result = ""; result = result + (string.IsNullOrEmpty(customerAddress.City) ? "" : customerAddress.City + (string.IsNullOrEmpty(customerAddress.StateProvince) ? "" : ", " + customerAddress.StateProvince) + (string.IsNullOrEmpty(customerAddress.ZipPostalCode) ? "" : ", " + customerAddress.ZipPostalCode) + Environment.NewLine); result = result + (string.IsNullOrEmpty(customerAddress.Street) ? "" : customerAddress.Street + Environment.NewLine); return(result); }
private static void UpdateAddressData(MachineTask task) { switch (task.TargetType) { case "ADDRESS": AddressData addressData = new AddressData(); //addressData.AddressesChangeFirstRowInfo(task.TargetAddress, false, task.EndTime); break; case "BUFFER": BuffersData buffersData = new BuffersData(); buffersData.ChangeBufferLoadInfo(task.TargetAddress, false, task.LoadInfo); break; default: break; } }
/// <summary> /// Получатель перевода (на карту или счёт) /// </summary> public CardBeneficiary( string accountNumber, NameWithHieroglyph name1, NameWithHieroglyph name2, NameWithHieroglyph name3, NameWithHieroglyph name4, AddressData address ) : base ( name1, name2, name3, name4, address ) { this.AccountNumber = accountNumber; }
public static void Main(string[] args) { AddressData[] addresses = new AddressData[] { new AddressData // Belgium { Address = "Rue du Cornet 6", City = "VERVIERS", State = null, Country = "Belgium", Zip = "B-4800" }, new AddressData { Address = "1600 Pennsylvania ave", City = "Washington", State = "DC" }, new AddressData { Address = "407 N Maple Dr. #1", City = "Beverly Hills", State = "CA" } }; var gls = new GoogleLocationService(); foreach (var address in addresses) { try { var latlong = gls.GetLatLongFromAddress(address); var Latitude = latlong.Latitude; var Longitude = latlong.Longitude; System.Console.WriteLine("Address ({0}) is at {1},{2}", address, Latitude, Longitude); } catch (System.Net.WebException ex) { System.Console.WriteLine("Google Maps API Error {0}", ex.Message); } } System.Console.ReadLine(); }
public void AddressModelTest1() { var data = new AddressData { AddressKey = 1, AddressTypeKey = 1, EntityKey = 1, EntityTypeKey = 3, AddressLine1 = "TEST", AddressLine2 = "TEST", AddressLine3 = "TEST", AddressLine4 = "TEST", AddressCity = "TEST", AddressStateProv = "TEST", AddressCounty = "TEST", AddressCountry = "TEST", AddressPostalCode = "TEST", AddressNotes = "TEST", AddressDefaultFlg = 1, AddressActiveFlg = 1, AuditAddUserId = "TEST", AuditAddDatetime = new System.DateTime(2018, 1, 1), AuditUpdateUserId = "TEST", AuditUpdateDatetime = new System.DateTime(2018, 1, 1), }; var sut = new Address(data); Assert.True(sut.AddressKey == 1); Assert.True(sut.AddressType == QIQOAccountAddressType.Mailing); Assert.True(sut.EntityKey == 1); Assert.True(sut.EntityType == QIQOAccountEntityType.Account); Assert.True(sut.AddressLine1 == "TEST"); Assert.True(sut.AddressLine2 == "TEST"); Assert.True(sut.AddressLine3 == "TEST"); Assert.True(sut.AddressLine4 == "TEST"); Assert.True(sut.AddressCity == "TEST"); Assert.True(sut.AddressState == "TEST"); Assert.True(sut.AddressCounty == "TEST"); Assert.True(sut.AddressCountry == "TEST"); Assert.True(sut.AddressPostalCode == "TEST"); Assert.True(sut.AddressNotes == "TEST"); Assert.True(sut.AddressDefaultFlag == true); Assert.True(sut.AddressActiveFlag == true); }
private void btnEdit_Click(object sender, EventArgs e) { AddressDialog dlgAddress = new AddressDialog(); dlgAddress.FillInCombo(); int AddressId = (int)(dgvAddressBook.SelectedRows[0].Cells[0].Value); dlgAddress.StateName = (dgvAddressBook.SelectedRows[0].Cells[2].Value).ToString(); dlgAddress.UserName = (dgvAddressBook.SelectedRows[0].Cells[4].Value).ToString(); dlgAddress.FirstName = (dgvAddressBook.SelectedRows[0].Cells[5].Value).ToString(); dlgAddress.LastName = (dgvAddressBook.SelectedRows[0].Cells[6].Value).ToString(); dlgAddress.EmailId = (dgvAddressBook.SelectedRows[0].Cells[7].Value).ToString(); dlgAddress.PhoneNo = (dgvAddressBook.SelectedRows[0].Cells[8].Value).ToString(); dlgAddress.Address1 = (dgvAddressBook.SelectedRows[0].Cells[9].Value).ToString(); dlgAddress.Address2 = (dgvAddressBook.SelectedRows[0].Cells[10].Value).ToString(); dlgAddress.Street = (dgvAddressBook.SelectedRows[0].Cells[11].Value).ToString(); dlgAddress.City = (dgvAddressBook.SelectedRows[0].Cells[12].Value).ToString(); dlgAddress.ZipCode = (long)(dgvAddressBook.SelectedRows[0].Cells[13].Value); dlgAddress.IsActive = (bool)(dgvAddressBook.SelectedRows[0].Cells[14].Value); AddressData objAddressdata = new AddressData(); if (dlgAddress.ShowDialog() == DialogResult.OK) { objAddressdata.PKAddressId = AddressId; objAddressdata.FKStateId = (int)(dgvAddressBook.SelectedRows[0].Cells[1].Value); objAddressdata.FKUserId = (int)(dgvAddressBook.SelectedRows[0].Cells[3].Value); objAddressdata.FirstName = dlgAddress.FirstName; objAddressdata.LastName = dlgAddress.LastName; objAddressdata.EmailId = dlgAddress.EmailId; objAddressdata.PhoneNo = dlgAddress.PhoneNo; objAddressdata.Address1 = dlgAddress.Address1; objAddressdata.Address2 = dlgAddress.Address2; objAddressdata.Street = dlgAddress.Street; objAddressdata.City = dlgAddress.City; objAddressdata.ZipCode = dlgAddress.ZipCode; objAddressdata.IsActive = dlgAddress.IsActive; AddressBO.UpdateInAddress(objAddressdata); } else { MessageBox.Show("please check the Details again"); } dgvAddressBook.DataSource = AddressBO.GetAddress(); }
internal static void ImportAddress(string address, DateTime timestamp, out string uuid) { uuid = null; if (address == null) { return; } AddressData addressData = new AddressData() { AddressText = address, Timestamp = timestamp }; adresseStub.Importer(addressData); uuid = addressData.Uuid; }
public override UniversalSearchItem GetSearchItem(Order order) { AddressData billingAddress = order.BillingAddress; var data = " - " + "No Name"; if (billingAddress != null) { data = " - " + billingAddress.Name; } return(new UniversalSearchItem { DisplayName = "#" + order.Id + data, Id = order.Id, PrimarySearchTerms = new[] { billingAddress.GetDescription(), order.ShippingAddress.GetDescription() }, SecondarySearchTerms = new[] { order.Id.ToString() }, SystemType = order.GetType().FullName, ActionUrl = string.Format("/admin/apps/ecommerce/order/edit/{0}", order.Id), }); }
public void TestUsCityStateZipCtorStateAndCityOnly() { var addrData = new AddressData { RegionAbbrev = "NC", Locality = "CHARLOTTE" }; var testResult = new UsCityStateZip(addrData); testResult.GetXmlData(); Assert.AreNotEqual("New York City", testResult.City); Assert.IsNotNull(testResult.Msa); Console.WriteLine(testResult.City); addrData = new AddressData { RegionAbbrev = "CA", Locality = "Westhaven-Moonstone" }; testResult = new UsCityStateZip(addrData); testResult.GetXmlData(); Assert.IsNotNull(testResult.Msa); }
public bool RemoveAddress(Address address) { AddressData data = new AddressData(); try { data.DeleteAddress(address); } catch (Exception ex) { log.Write(ex.Message, "RemoveAddress"); throw (ex); } finally { data = null; } return(true); }
public int AddAddress(Address address) { AddressData data = new AddressData(); try { data.AddAddress(address); } catch (Exception ex) { log.Write(ex.Message, "AddAddress"); throw (ex); } finally { data = null; } return(address.AddressID); }
public bool Update(AddressData model) { bool _result = false; try { _connection.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = _connection; cmd.CommandText = "UpdateAddress"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Id", model.UserId); cmd.Parameters.AddWithValue("@UserId", model.UserId); cmd.Parameters.AddWithValue("@Type", (int)model.Type); cmd.Parameters.AddWithValue("@ZipCode", model.ZipCode); cmd.Parameters.AddWithValue("@Address", model.Address); cmd.Parameters.AddWithValue("@District", model.District); cmd.Parameters.AddWithValue("@City", model.City); cmd.Parameters.AddWithValue("@State", model.State); cmd.Parameters.AddWithValue("@Country", model.Country); cmd.Parameters.AddWithValue("@PhoneNumber", model.PhoneNumber); cmd.Parameters.AddWithValue("@Cellphone", model.Cellphone); _result = cmd.ExecuteNonQuery() > 0; } } catch (Exception ex) { throw new ArgumentException(ex.Message, ex); } finally { if (_connection.State == ConnectionState.Open) { _connection.Close(); } } return(_result); }
public async Task <ActionResult <AddressDataDTO> > CreateAddressData(AddressDataDTO addressDataDTO) { var addressData = new AddressData { Postcode = addressDataDTO.Postcode, Street = addressDataDTO.Street, House_Number = addressDataDTO.House_Number, City = addressDataDTO.City, Country = addressDataDTO.Country }; _context.ADDRESS_DATA.Add(addressData); await _context.SaveChangesAsync(); return(CreatedAtAction( nameof(GetAddressDataByPostcode), new { Postcode = addressData.Postcode }, AddressDataToDTO(addressData))); }
public async Task <IActionResult> ModifyAddress(int id, AddressData AddData) { var addressToPass = new Address { Country = AddData.Country, State = AddData.State, ZipCode = AddData.ZipCode, City = AddData.City, Street = AddData.Street, AptNum = AddData.AptNum }; if (await _repo.ModifyAddress(id, addressToPass)) { return(StatusCode(201)); } return(BadRequest("Could not find Address")); }
/// <summary> /// Register a nurse to a baby. /// </summary> /// <param name="babyId">The baby monitor identifier.</param> /// <param name="addressData">The nurse's address info.</param> public void DeregisterNurseFromBaby(string babyId, AddressData addressData) { ModifyData((data) => { List <BabyData> existingEntries = data.Where(baby => baby.babyId == babyId).ToList(); if (existingEntries.Count >= 1) { int entryIndex = data.FindIndex(baby => baby.babyId == babyId); if (data[entryIndex].assignedNurse.identity == addressData.identity) { data[entryIndex].assignedNurse = new AddressData(); } } return(data); }); }
public AddressCollection GetAddressCollection(string whereExpression, string orderByExpression) { AddressData data = new AddressData(); AddressCollection col = new AddressCollection(); try { col = data.GetAddressesDynamicCollection(whereExpression, orderByExpression); } catch (Exception ex) { log.Write(ex.Message, "GetAddressCollection"); throw(ex); } finally { data = null; } return(col); }
public DataSet GetAddressDataSet(string whereExpression, string orderByExpression) { AddressData data = new AddressData(); DataSet ds = new DataSet(); try { ds = data.GetAddressesDynamicDataSet(whereExpression, orderByExpression); } catch (Exception ex) { log.Write(ex.Message, "GetAddressDataSet"); throw(ex); } finally { data = null; } return(ds); }
public AddressCollection GetAllAddresssCollection() { AddressCollection cols = new AddressCollection(); AddressData data = new AddressData(); try { cols = data.GetAllAddressesCollection(); } catch (Exception ex) { log.Write(ex.Message, "GetAllAddresss()"); throw (ex); } finally { data = null; } return(cols); }
public DataSet GetAllAddresssDataSet() { DataSet ds = new DataSet(); AddressData data = new AddressData(); try { ds = data.GetAllAddressesDataSet(); } catch (Exception ex) { log.Write(ex.Message, "GetAllAddresss()"); throw (ex); } finally { data = null; } return(ds); }
public Address GetAddresss(int addressID) { Address address = new Address(); AddressData data = new AddressData(); try { address = data.GetAddress(addressID); } catch (Exception ex) { log.Write(ex.Message, "GetAddresssCollection"); throw (ex); } finally { data = null; } return(address); }
/// <summary> /// Attach a caretaker to the baby monitor. /// </summary> /// <param name="caretaker">The caretaker identity and their address.</param> public void AttachCaretaker(AddressData caretaker) { if (!HasNurseAssigned()) { throw new NullReferenceException("Cannot execute function without a nurse assigned."); } // Handle communication _nurseCommunicator.ConnectToCaretaker(caretaker); _nurseCommunicator.AttachBabyMonitorToCaretaker(BabyId); // Start listening on communication line if (Caretakers.Count == 0) { _ = Task.Run(() => ListenUnsubscribe()); } // Add caretaker to monitor list Caretakers.Add(new Caretaker(caretaker.identity, caretaker.address)); }
/// <summary> /// Calls the listed endpoint on this controller. /// </summary> public static Address AddAddress(SessionAuthUser authUser, AddressData template) { MultiTenantDataContext context = PublicLogicManager.DataContextFactory.Invoke(authUser); List<int> ids = BaseCallController.GetIdList<Address>(context); AddressController controller = GetController<AddressController>(authUser, template, AddressController.AddAddressAction); ActionResult result = controller.AddAddress(template); AssertRedirect(result, ClientController.ViewSubscriptionAction, ClientController.Controller); Address foundItem = BaseCallController.FindNewItem<Address>(context, ids); Assert.AreEqual(template.Name, foundItem.Name); Assert.AreEqual(template.AddressLine1, foundItem.AddressLine1); Assert.AreEqual(template.AddressLine2, foundItem.AddressLine2); Assert.AreEqual(template.City, foundItem.City); Assert.AreEqual(template.ZipCode, foundItem.ZipCode); Assert.AreEqual(RecordVisibility.Active, foundItem.Visibility); return foundItem; }
public void TestGetCity() { var addrData = new AddressData(); var ln = "EL CAMPO, TX"; UsCityStateZip.GetState(ln, addrData); UsCityStateZip.GetCity(ln, addrData); Assert.IsNotNull(addrData.Locality); Assert.AreEqual("TX", addrData.RegionAbbrev); Assert.AreEqual("El Campo", addrData.Locality); Console.WriteLine($"{addrData.Locality} {addrData.RegionAbbrev}"); ln = "Washington DC 20006"; UsCityStateZip.GetZipCode(ln, addrData); UsCityStateZip.GetState(ln, addrData); UsCityStateZip.GetCity(ln, addrData); Assert.IsNotNull(addrData.Locality); Assert.AreEqual("DC", addrData.RegionAbbrev); Assert.AreEqual("Washington", addrData.Locality); Console.WriteLine($"{addrData.Locality} {addrData.RegionAbbrev}"); }
public override void Execute(object parameter) { if (string.IsNullOrWhiteSpace(queryModel.Address)) { return; } var url = "http://dev.virtualearth.net/REST/v1/Locations?q=" + Uri.EscapeUriString(queryModel.Address) + "&key=Anlj2YMQu676uXmSj1QTSni66f8DjuBGToZ21t5z9E__lL8IHRhFP8LtF7umitL6"; var webRequest = WebRequest.Create(new Uri(url, UriKind.Absolute)); webRequest.GetResponseAsync().ContinueOnSuccessInTheUIThread(doc => { RavenJObject jsonData; using (var stream = doc.GetResponseStream()) using (var reader = new StreamReader(stream)) using (var jsonReader = new JsonTextReader(reader)) jsonData = RavenJObject.Load(jsonReader); var set = jsonData["resourceSets"]; var item = set.Values().First().Values().ToList()[1].Values().ToList(); if (item.Count == 0) { ApplicationModel.Current.AddInfoNotification("Could not calculate the given address"); return; } var result = item.First().SelectToken("point").SelectToken("coordinates").Values().ToList(); if (result != null) { var latitude = double.Parse(result[0].ToString()); var longitude = double.Parse(result[1].ToString()); var addressData = new AddressData { Address = queryModel.Address, Latitude = latitude, Longitude = longitude }; queryModel.UpdateResultsFromCalculate(addressData); } }).Catch(); }
/// <summary> /// Register a nurse to a baby. /// </summary> /// <param name="babyId">The baby monitor identifier.</param> /// <param name="addressData">The nurse' address info.</param> public void RegisterNurseToBaby(string babyId, AddressData addressData) { ModifyData((data) => { List <BabyData> existingEntries = data.Where(baby => baby.babyId == babyId).ToList(); if (existingEntries.Count >= 1) { data[data.FindIndex(baby => baby.babyId == babyId)].assignedNurse = addressData; } else { data.Add(new BabyData(babyId) { assignedNurse = addressData }); } return(data); }); }
public void CopyFrom(AddressData source) { PostalCode = source.postal_code; Region = source.region; City = source.city; if (source.settlement != null) { City += " " + source.settlement_with_type; } LocalityType = LocalityType.city; //FIXME Тут скорей всего нужен более детальный подход. Без примеров не стал разбираться. // CityDistrict = source.; Street = source.street_with_type.Replace(source.street_type, source.street_type_full); //StreetDistrict = source.StreetDistrict; Building = source.house; if (source.block != null) { Building += " " + source.block_type + source.block; } Room = source.flat; RoomType = ParseDaDataRoomType(source.flat_type); }
public override object ConvertDataToSource(PublishedPropertyType propertyType, object data, bool preview) { if (data == null) { return(data); } var address = new AddressData(); var source = data.ToString(); if (source.DetectIsJson()) { try { address = JsonConvert.DeserializeObject <AddressData>(source); } catch { /* Hmm, not JSON after all ... */ } } return(address); }
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)); }
public override object ConvertSourceToIntermediate(IPublishedElement owner, IPublishedPropertyType propertyType, object source, bool preview) { if (source == null) { return(source); } var address = new AddressData(); var ssource = source.ToString(); if (ssource.DetectIsJson()) { try { address = JsonConvert.DeserializeObject <AddressData>(ssource); } catch { /* Hmm, not JSON after all ... */ } } return(address); }
internal static void ImportAddress(Address address, DateTime timestamp, out string uuid) { uuid = null; if (address == null) { return; } AddressData addressData = new AddressData() { AddressText = address.Value, Timestamp = timestamp, ShortKey = address.ShortKey, Uuid = address.Uuid }; adresseStub.Importer(addressData); uuid = addressData.Uuid; }
} // firstPartOfPostCode public static string firstPartOfPostCode(AddressData address) { var postCode = address.PostCode; if (postCode == null) { return("Not given"); } postCode = postCode.Replace(" ", string.Empty); var regex = new Regex(@"^([A-Z]{1,2}[1-9][0-9]?)([0-9])([A-Z]{2})?$"); var match = regex.Match(postCode); if (!match.Success) { return("Not given"); } var r = match.Groups[1].Value + " " + match.Groups[2].Value; return(r); } // firstPartOfPostCode
public async Task GetRegisteredOfficeAddress_ApiReturnsOrganisationData_ReturnsViewWithModel() { // Arrange AddressData addressData = new AddressData(); addressData.Address1 = "Address Line 1"; OrganisationData organisationData = new OrganisationData(); organisationData.Id = new Guid("1B7329B9-DC7F-4621-8E97-FD97CDDDBA10"); organisationData.OrganisationType = OrganisationType.RegisteredCompany; organisationData.HasBusinessAddress = true; organisationData.BusinessAddress = addressData; IWeeeClient weeeClient = A.Fake<IWeeeClient>(); A.CallTo(() => weeeClient.SendAsync(A<string>._, A<GetOrganisationInfo>._)) .Returns(organisationData); ISearcher<OrganisationSearchResult> organisationSearcher = A.Dummy<ISearcher<OrganisationSearchResult>>(); OrganisationRegistrationController controller = new OrganisationRegistrationController( () => weeeClient, organisationSearcher); // Act ActionResult result = await controller.RegisteredOfficeAddress(new Guid("1B7329B9-DC7F-4621-8E97-FD97CDDDBA10")); // Assert ViewResult viewResult = result as ViewResult; Assert.NotNull(viewResult); AddressViewModel viewModel = viewResult.Model as AddressViewModel; Assert.NotNull(viewModel); Assert.Equal(new Guid("1B7329B9-DC7F-4621-8E97-FD97CDDDBA10"), viewModel.OrganisationId); Assert.Equal(OrganisationType.RegisteredCompany, viewModel.OrganisationType); Assert.Equal("Address Line 1", viewModel.Address.Address1); }
private Address DecodeAddress(AddressData origin) { return new Address(origin.Protocol, origin.System, origin.Hostname, (int)origin.Port); }
public AddressViewModel() { Address = new AddressData(); }
/// <summary> /// Returns list of rates base dupon the supplied information. /// </summary> /// <param name="expectedOptions">Shipping Options for which to receive rates.</param> /// <param name="origin">from address.</param> /// <param name="destination">destination address</param> /// <param name="weight">Weight of package</param> /// <param name="dimensions">Diemnsions of Package</param> /// <returns></returns> public override List<ShippingOptionData> GetRates(IEnumerable<ShippingMethodData> expectedOptions, AddressData origin, AddressData destination, Weight weight, Dimensions dimensions) { List<ShippingOptionData> availableOptions = new List<ShippingOptionData>(); try { foreach (ShippingMethodData expectedOption in expectedOptions) { Log.WriteInfo("MSD Shipping Provider. ExpectedOption:" + expectedOption.Name); decimal cartTotal = 0M; Ektron.Cms.Commerce.BasketApi bapi = new BasketApi(); Basket myBasket = bapi.GetDefaultBasket(); cartTotal = myBasket.Subtotal; switch (expectedOption.ProviderService.ToLower()) { case "msd_ground": ShippingOptionData groundShipOption = new ShippingOptionData(); groundShipOption.Id = expectedOption.Id; groundShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { groundShipOption.ShippingFee = 10.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { groundShipOption.ShippingFee = 15.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { groundShipOption.ShippingFee = 20.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { groundShipOption.ShippingFee = 25.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { groundShipOption.ShippingFee = 100.00M; } else if (cartTotal > 10000.00M) { groundShipOption.ShippingFee = 300.00M; } groundShipOption.ProviderService = "MSD_Ground"; availableOptions.Add(groundShipOption); break; case "msd_3_day": ShippingOptionData ThreeDayShipOption = new ShippingOptionData(); ThreeDayShipOption.Id = expectedOption.Id; ThreeDayShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { ThreeDayShipOption.ShippingFee = 15.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { ThreeDayShipOption.ShippingFee = 20.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { ThreeDayShipOption.ShippingFee = 30.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { ThreeDayShipOption.ShippingFee = 35.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { ThreeDayShipOption.ShippingFee = 125.00M; } else if (cartTotal > 10000.00M) { ThreeDayShipOption.ShippingFee = 350.00M; } ThreeDayShipOption.ProviderService = "MSD_3_Day"; availableOptions.Add(ThreeDayShipOption); break; case "msd_2_day": ShippingOptionData TwoDayShipOption = new ShippingOptionData(); TwoDayShipOption.Id = expectedOption.Id; TwoDayShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { TwoDayShipOption.ShippingFee = 20.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { TwoDayShipOption.ShippingFee = 25.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { TwoDayShipOption.ShippingFee = 40.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { TwoDayShipOption.ShippingFee = 45.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { TwoDayShipOption.ShippingFee = 150.00M; } else if (cartTotal > 10000.00M) { TwoDayShipOption.ShippingFee = 400.00M; } TwoDayShipOption.ProviderService = "MSD_2_Day"; availableOptions.Add(TwoDayShipOption); break; case "msd_1_day": ShippingOptionData OneDayShipOption = new ShippingOptionData(); OneDayShipOption.Id = expectedOption.Id; OneDayShipOption.Name = expectedOption.Name; if (cartTotal <= 99.00M) { OneDayShipOption.ShippingFee = 25.00M; } else if (cartTotal > 99.00M && cartTotal <= 299.00M) { OneDayShipOption.ShippingFee = 30.00M; } else if (cartTotal > 299.00M && cartTotal <= 799.00M) { OneDayShipOption.ShippingFee = 50.00M; } else if (cartTotal > 799.00M && cartTotal <= 999.00M) { OneDayShipOption.ShippingFee = 55.00M; } else if (cartTotal > 999.00M && cartTotal <= 10000.00M) { OneDayShipOption.ShippingFee = 175.00M; } else if (cartTotal > 10000.00M) { OneDayShipOption.ShippingFee = 450.00M; } OneDayShipOption.ProviderService = "MSD_1_Day"; availableOptions.Add(OneDayShipOption); break; case "msd_free_shipping": ShippingOptionData FreeShipOption = new ShippingOptionData(); FreeShipOption.Id = expectedOption.Id; FreeShipOption.Name = expectedOption.Name; FreeShipOption.ShippingFee = 0.00M; FreeShipOption.ProviderService = "MSD_Free_Shipping"; availableOptions.Add(FreeShipOption); break; } } } catch (Exception e) { Log.WriteError("MSD Shipping Provider: Error retrieving shipping rates." + e.Message); throw; } return availableOptions; }
/// <summary> /// Calls the listed endpoint on this controller. /// </summary> public static Address EditAddress(SessionAuthUser authUser, AddressData template) { MultiTenantDataContext context = PublicLogicManager.DataContextFactory.Invoke(authUser); AddressController controller = GetController<AddressController>(authUser, template, AddressController.EditAddressAction); ActionResult result = controller.EditAddress(template); AssertRedirect(result, ClientController.ViewSubscriptionAction, ClientController.Controller); Address foundItem = context.FindClientItem<Address>(template.ID); if (template.Visibility == RecordVisibility.Deleted) { Assert.IsNull(foundItem); } else { Assert.AreEqual(template.Name, foundItem.Name); Assert.AreEqual(template.AddressLine1, foundItem.AddressLine1); Assert.AreEqual(template.AddressLine2, foundItem.AddressLine2); Assert.AreEqual(template.City, foundItem.City); Assert.AreEqual(template.ZipCode, foundItem.ZipCode); Assert.AreEqual(template.Visibility, foundItem.Visibility); } return foundItem; }
public async Task HandleAsync_WithOrganisationAddressAndContactDetailsUnchanged_SendNotificationTrue_DoesNotSendChangeEmail() { // Arrange var authorization = A.Dummy<IWeeeAuthorization>(); var dataAccess = A.Fake<IOrganisationDetailsDataAccess>(); var weeeEmailService = A.Dummy<IWeeeEmailService>(); var handler = new UpdateOrganisationContactDetailsHandler(authorization, dataAccess, weeeEmailService); var contact = new Contact("FirstName", "LastName", "Position"); var countryId = Guid.NewGuid(); var country = new Country(countryId, "Country"); var organisationAddress = new Address("Address1", "Address2", "TownOrCity", "CountyOrRegion", "Postcode", country, "Telephone", "Email"); var organisation = A.Fake<Organisation>(); A.CallTo(() => organisation.Contact) .Returns(contact); A.CallTo(() => organisation.OrganisationAddress) .Returns(organisationAddress); A.CallTo(() => dataAccess.FetchOrganisationAsync(A<Guid>._)) .Returns(organisation); A.CallTo(() => dataAccess.FetchCountryAsync(countryId)) .Returns(country); var newContactDetails = new ContactData { FirstName = "FirstName", LastName = "LastName", Position = "Position" }; var newOrganisationAddress = new AddressData { Address1 = "Address1", Address2 = "Address2", CountryId = countryId, CountyOrRegion = "CountyOrRegion", Email = "Email", Postcode = "Postcode", Telephone = "Telephone", TownOrCity = "TownOrCity" }; var organisationData = new OrganisationData { Contact = newContactDetails, OrganisationAddress = newOrganisationAddress }; var request = new UpdateOrganisationContactDetails(organisationData, true); // Act await handler.HandleAsync(request); // Assert A.CallTo(() => weeeEmailService.SendOrganisationContactDetailsChanged(A<string>._, A<string>._)) .MustNotHaveHappened(); }
public ActualAccountData(Account account, AccountData data, AddressData address) { m_Account = account; m_Data = data; m_Address = address; }
public void Test_Evaluate() { VelocityContext c = new VelocityContext(); c.Put("key", "value"); c.Put("firstName", "Cort"); c.Put("lastName", "Schaefer"); Hashtable h = new Hashtable(); h.Add("foo", "bar"); c.Put("hashtable", h); AddressData address = new AddressData(); address.Address1 = "9339 Grand Teton Drive"; address.Address2 = "Office in the back"; c.Put("address", address); ContactData contact = new ContactData(); contact.Name = "Cort"; contact.Address = address; c.Put("contact", contact); // test simple objects (no nesting) StringWriter sw = new StringWriter(); bool ok = Velocity.Evaluate(c, sw, string.Empty, "$firstName is my first name, my last name is $lastName"); Assert.IsTrue(ok, "Evaluation returned failure"); String s = sw.ToString(); Assert.AreEqual("Cort is my first name, my last name is Schaefer", s, "test simple objects (no nesting)"); // test nested object sw = new StringWriter(); String template = "These are the individual properties:\naddr1=9339 Grand Teton Drive\naddr2=Office in the back"; ok = Velocity.Evaluate(c, sw, string.Empty, template); Assert.IsTrue(ok, "Evaluation returned failure"); s = sw.ToString(); Assert.IsFalse(String.Empty.Equals(s), "test nested object"); // test hashtable sw = new StringWriter(); template = "Hashtable lookup: foo=$hashtable.foo"; ok = Velocity.Evaluate(c, sw, string.Empty, template); Assert.IsTrue(ok, "Evaluation returned failure"); s = sw.ToString(); Assert.AreEqual("Hashtable lookup: foo=bar", s, "Evaluation did not evaluate right"); // test nested properties // sw = new StringWriter(); // template = "These are the nested properties:\naddr1=$contact.Address.Address1\naddr2=$contact.Address.Address2"; // ok = Velocity.Evaluate(c, sw, string.Empty, template); // Assert("Evaluation returned failure", ok); // s = sw.ToString(); // Assert("test nested properties", s.Equals("These are the nested properties:\naddr1=9339 Grand Teton Drive\naddr2=Office in the back")); // test key not found in context sw = new StringWriter(); template = "$!NOT_IN_CONTEXT"; ok = Velocity.Evaluate(c, sw, string.Empty, template); Assert.IsTrue(ok, "Evaluation returned failure"); s = sw.ToString(); Assert.AreEqual(String.Empty, s, "test key not found in context"); // test nested properties where property not found // sw = new StringWriter(); // template = "These are the non-existent nested properties:\naddr1=$contact.Address.Address1.Foo\naddr2=$contact.Bar.Address.Address2"; // ok = Velocity.Evaluate(c, sw, string.Empty, template); // Assert("Evaluation returned failure", ok); // s = sw.ToString(); // Assert("test nested properties where property not found", s.Equals("These are the non-existent nested properties:\naddr1=\naddr2=")); }
public FacilityData() { Address = new AddressData(); Contact = new ContactData(); Business = new BusinessInfoData(); }
public ApplicantRegistrationViewModel() { Address = new AddressData(); }
public async Task HandleAsync_DetailsChanged_SendNotificationTrue_MatchingScheme_SendsChangeEmail() { // Arrange var authorization = A.Dummy<IWeeeAuthorization>(); var dataAccess = A.Fake<IOrganisationDetailsDataAccess>(); var weeeEmailService = A.Dummy<IWeeeEmailService>(); var handler = new UpdateOrganisationContactDetailsHandler(authorization, dataAccess, weeeEmailService); var contact = new Contact("FirstName", "LastName", "Position"); var countryId = Guid.NewGuid(); var country = new Country(countryId, "Country"); var organisationAddress = new Address("Address1", "Address2", "TownOrCity", "CountyOrRegion", "Postcode", country, "Telephone", "Email"); var organisation = A.Fake<Organisation>(); A.CallTo(() => organisation.Contact) .Returns(contact); A.CallTo(() => organisation.OrganisationAddress) .Returns(organisationAddress); A.CallTo(() => dataAccess.FetchOrganisationAsync(A<Guid>._)) .Returns(organisation); A.CallTo(() => dataAccess.FetchCountryAsync(countryId)) .Returns(country); var newContactDetails = new ContactData { FirstName = "FirstName", LastName = "LastName", Position = "Position" }; var newOrganisationAddress = new AddressData { Address1 = "New Address1", Address2 = "New Address2", CountryId = countryId, CountyOrRegion = "CountyOrRegion", Email = "Email", Postcode = "Postcode", Telephone = "Telephone", TownOrCity = "TownOrCity" }; var organisationId = Guid.NewGuid(); var organisationData = new OrganisationData { Id = organisationId, Contact = newContactDetails, OrganisationAddress = newOrganisationAddress }; var request = new UpdateOrganisationContactDetails(organisationData, true); var scheme = A.Fake<Scheme>(); A.CallTo(() => scheme.SchemeName) .Returns("Test Scheme Name"); var competentAuthority = A.Fake<UKCompetentAuthority>(); A.CallTo(() => competentAuthority.Email) .Returns("*****@*****.**"); A.CallTo(() => scheme.CompetentAuthority) .Returns(competentAuthority); A.CallTo(() => dataAccess.FetchSchemeAsync(organisationId)) .Returns(scheme); // Act await handler.HandleAsync(request); // Assert A.CallTo(() => weeeEmailService.SendOrganisationContactDetailsChanged("*****@*****.**", "Test Scheme Name")) .MustHaveHappened(); }
private AddAddressToOrganisation GetMessage(Guid organisationId, AddressType addressType, AddressData data = null) { data = data ?? new AddressData(); var message = new AddAddressToOrganisation( organisationId, addressType, data); return message; }