public void Update(Organisation organisation, OrganisationModel organisationModel) { organisation.Name = organisationModel.Name; organisation.Description = organisationModel.Description; organisation.FaxNumber = organisationModel.FaxNumber; organisation.ContactNumber = organisationModel.ContactNumber; organisation.EmailAddress = organisationModel.EmailAddress; organisation.LogoFilename = organisationModel.LogoFileName; if (organisation.PostalAddressId == null) { organisation.PostalAddress = addressBuilder.Build(organisationModel.PostalAddress); } else { addressAdapter.Update(organisation.PostalAddress, organisationModel.PostalAddress); } if (organisation.PhysicalAddress == null) { organisation.PhysicalAddress = addressBuilder.Build(organisationModel.PhysicalAddress); } else { addressAdapter.Update(organisation.PhysicalAddress, organisationModel.PhysicalAddress); } }
public static Address WithCountyOrRegion(string countyOrRegion) { var builder = new AddressBuilder(); builder.CountyOrRegion = countyOrRegion; return(builder.Build()); }
public static Address WithPostcode(string postcode) { var builder = new AddressBuilder(); builder.Postcode = postcode; return(builder.Build()); }
public static Address WithTelephone(string telephone) { var builder = new AddressBuilder(); builder.Telephone = telephone; return(builder.Build()); }
public static Address WithEmail(string email) { var builder = new AddressBuilder(); builder.Email = email; return(builder.Build()); }
public static Address WithCountry(Country country) { var builder = new AddressBuilder(); builder.Country = country; return(builder.Build()); }
public static Address WithTownOrCity(string townOrCity) { var builder = new AddressBuilder(); builder.TownOrCity = townOrCity; return(builder.Build()); }
public static Address WithAddress2(string address2) { var builder = new AddressBuilder(); builder.Address2 = address2; return(builder.Build()); }
public void TestBuildDesigner() { var build = new AddressBuilder(); build.SetCity("广州"); build.SetCode("510000"); build.SetStreet("广州"); var addr = build.Build(); }
public void btn_submit_Clicked() { // NEED TO DO VERIFICATION ON FORM. TRY CATCH ON REQUIRED EMPTY VARIABLES? if (string.IsNullOrEmpty(view.getMiddleName())) { personBuilder .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName()); if (string.IsNullOrEmpty(view.getEmergency())) { personBuilder .WithPrimaryContactOnly(view.getPhone()); if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else if (string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else { addressBuilder .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode()); } } else { personBuilder .WithAllContacts(view.getPhone(), view.getEmergency()); } } else { personBuilder .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName()); } gp = personBuilder.Build(); address = addressBuilder.Build(); GP practice = new GP(); practice.GPPractice = view.getPracticeName(); MemberDB.InsertGP(gp); AddressDB.InsertAddress(address); GPDB.InsertGP(practice); ConfirmationForm cForm = new ConfirmationForm(); ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm); cForm.Show(); }
public void UpdateAddressDetails(Employee employee, EmployeeAddressModel addressModel) { if (employee.PostalAddressId == null) { employee.PostalAddress = addressBuilder.Build(addressModel.PostalAddress); } else { addressAdapter.Update(employee.PostalAddress, addressModel.PostalAddress); } if (employee.PhysicalAddress == null) { employee.PhysicalAddress = addressBuilder.Build(addressModel.PhysicalAddress); } else { addressAdapter.Update(employee.PhysicalAddress, addressModel.PhysicalAddress); } }
public void UpdateAddressDetails(Company company, CompanyAddressModel addressModel) { if (company.PostalAddressId == null) { company.PostalAddress = addressBuilder.Build(addressModel.PostalAddress); } else { addressAdapter.Update(company.PostalAddress, addressModel.PostalAddress); } if (company.PhysicalAddress == null) { company.PhysicalAddress = addressBuilder.Build(addressModel.PhysicalAddress); } else { addressAdapter.Update(company.PhysicalAddress, addressModel.PhysicalAddress); } }
public void When_add_two_times_on_the_same_item_then_the_total_of_order_should_be_the_sum_of_the_two_items() { // Arrange var address = AddressBuilder.Build(); // Act var order = new OrderBuilder(address) .AddOne(1, "cup", 10.0m, 0, string.Empty) .AddOne(1, "cup", 10.0m, 0, string.Empty) .Build(); // Assert Assert.Equal(20.0m, order.GetTotal()); }
public async Task ChargeWithShippingAndBillingTest() { var address = _addressBuilder.Build(); var customerRequest = _customerRequestBuilder.Build(); var customer = await _gateway.CreateCustomer(customerRequest); var cardRequest = _cardRequestBuilder.WithCustomerId(customer.Id).Build(); var card = await _gateway.CreateCard(cardRequest); var chargeRequest = _chargeRequestBuilder.WithCustomerId(customer.Id) .WithCard(_cardRequestBuilder.WithId(card.Id)) .WithShipping() .WithBilling() .Build(); var charge = await _gateway.CreateCharge(chargeRequest); Assert.AreEqual(chargeRequest.Shipping.Name, charge.Shipping.Name); Assert.AreEqual(chargeRequest.Billing.Name, charge.Billing.Name); }
public RecipientBuilder WithAddress(AddressBuilder addressBuilder) { address = addressBuilder.Build(); return(this); }
public OrderData() { AddressBuilder addressBuilder = new AddressBuilder() .WithCountry("Belgium") .WithHouseNumber("16A") .WithPostalCode("3000") .WithStreetName("Jantjesstraat"); Email.EmailBuilder emailBuilder = new Email.EmailBuilder() .WithLocalPart("niels") .WithDomain("mymail.be") .WithComplete("*****@*****.**"); PhoneNumber.PhoneNumberBuilder phoneNumberBuilder = new PhoneNumber.PhoneNumberBuilder() .WithNumber("484554433") .WithCountryCallingCode("+32"); Customer.CustomerBuilder custBuild = new Customer.CustomerBuilder() .WithId(Guid.NewGuid()) .WithFirstname("Tom") .WithLastname("Thompson") .WithAddress(addressBuilder.Build()) .WithEmail(emailBuilder.Build()) .WithPhoneNumber(phoneNumberBuilder.Build()); Customer1 = new Customer(custBuild); Item.ItemBuilder item1 = new Item.ItemBuilder() .WithId(Guid.NewGuid()) .WithAmountOfStock(50) .WithDescription("Just a simple headphone") .WithName("Headphone") .WithPrice(Price.Create(new decimal(49.95))); Item.ItemBuilder item2 = new Item.ItemBuilder() .WithId(Guid.NewGuid()) .WithAmountOfStock(50) .WithDescription("Just a simple micro") .WithName("Micro") .WithPrice(Price.Create(new decimal(22.95))); Order1 = new Order(new Order.OrderBuilder() .WithId(Guid.NewGuid())); OrderItem.OrderItemBuilder orderItem1 = new OrderItem.OrderItemBuilder() .WithOrderId(Order1.Id) .WithItemId(item1.Id) .WithItemPrice(item1.Price) .WithOrderedAmount(5); OrderItem.OrderItemBuilder orderItem2 = new OrderItem.OrderItemBuilder() .WithOrderId(Order1.Id) .WithItemId(item2.Id) .WithItemPrice(item2.Price) .WithOrderedAmount(5); Order1 = new Order(new Order.OrderBuilder() .WithId(Guid.NewGuid()) .WithCustomerId(Customer1.Id) .WithOrderItems(new List <OrderItem> { orderItem1.Build(), orderItem2.Build() }) ); ItemList = new List <Item>() { item1.Build(), item2.Build() }; }
public override Address Build() { return(_addressBuilder.Build()); }
public void btn_submit_Clicked() { personBuilder .setMember((Member)Enum.Parse(typeof(Member), view.getMember())) .setGender((Gender)Enum.Parse(typeof(Gender), view.getGender())) .setDOB(view.getDOB()); if (string.IsNullOrEmpty(view.getMiddleName())) { personBuilder .WithNoMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getLastName()); if (string.IsNullOrEmpty(view.getEmergency())) { personBuilder .WithPrimaryContactOnly(view.getPhone()); if (string.IsNullOrEmpty(view.getSecondLine()) && string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .OneLineAddress(view.getFirstLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else if (string.IsNullOrEmpty(view.getThirdLine())) { addressBuilder .TwoLineAddress(view.getFirstLine(), view.getSecondLine(), view.getCity(), view.getCounty(), view.getPostcode()); } else { addressBuilder .ThreeLineAddress(view.getFirstLine(), view.getSecondLine(), view.getThirdLine(), view.getCity(), view.getCounty(), view.getPostcode()); } } else { personBuilder .WithAllContacts(view.getPhone(), view.getEmergency()); } } else { personBuilder .WithMiddleName((Prefix)Enum.Parse(typeof(Prefix), view.getTitle()), view.getFirstName(), view.getMiddleName(), view.getLastName()); } member = personBuilder.Build(); MemberDB.InsertMember(member); address = addressBuilder.Build(); AddressDB.InsertAddress(address); if (view.getMember() == "Patient") { GPInformationForm gpForm = new GPInformationForm(); GPInformationPresenter gpPresenter = new GPInformationPresenter(gpForm); gpForm.Show(); } else { ConfirmationForm cForm = new ConfirmationForm(); ConfirmationPresenter cPresenter = new ConfirmationPresenter(cForm); cForm.Show(); } }