public ActionResult Edit(int recurringOrderId) { var customer = HttpContext.GetCustomer(); var billingAddress = AddressViewModelConverter.ConvertToAddressViewModel( customer.PrimaryBillingAddress, customer); var address = new AddressDetailViewModel( address: billingAddress, residenceTypeOptions: AddressSelectListBuilder.BuildResidenceTypeSelectList(billingAddress.ResidenceType.ToString()), stateOptions: AddressSelectListBuilder.BuildStateSelectList(billingAddress.Country, billingAddress.State), countryOptions: AddressSelectListBuilder.BuildCountrySelectList(billingAddress.Country), showCompanyField: ShowCompanyField, showNickName: ShowNickName, showResidenceTypeField: true, showPostalCodeLookup: PostalCodeLookupProvider.IsEnabled(billingAddress.Country), returnUrl: string.Empty, header: AddressHeaderProvider.GetHeaderText(billingAddress.Id, AddressTypes.Billing)); return(View(ControllerHelper.BuildRecurringOrderEditViewModel( recurringOrderId: recurringOrderId, address: address, creditCard: new CreditCardViewModel(), customer: customer))); }
public ActionResult ChangeCountry(RecurringOrderPostViewModel model) { var customer = HttpContext.GetCustomer(); if ((model.Address.Id.HasValue && !Customer.OwnsThisAddress(customer.CustomerID, (int)model.Address.Id)) || !customer.Owns.RecurringOrder(model.RecurringOrderId)) { throw new HttpException(403, "Forbidden"); } var address = new AddressDetailViewModel( address: model.Address, residenceTypeOptions: AddressSelectListBuilder.BuildResidenceTypeSelectList(model.Address.ResidenceType.ToString()), stateOptions: AddressSelectListBuilder.BuildStateSelectList(model.Address.Country, model.Address.State), countryOptions: AddressSelectListBuilder.BuildCountrySelectList(model.Address.Country), showCompanyField: ShowCompanyField, showNickName: ShowNickName, showResidenceTypeField: true, showPostalCodeLookup: PostalCodeLookupProvider.IsEnabled(model.Address.Country), returnUrl: string.Empty, header: AddressHeaderProvider.GetHeaderText(model.Address.Id, AddressTypes.Billing)); return(View(ActionNames.Edit, ControllerHelper.BuildRecurringOrderEditViewModel( recurringOrderId: model.RecurringOrderId, address: address, creditCard: new CreditCardViewModel(), customer: customer))); }
protected override AddressViewModel ResolveCore(IList<IAddressVO> source) { AddressViewModel addressModel = new AddressViewModel(); if (source != null && source.Count > 0) { foreach (IAddressVO address in source) { AddressDetailViewModel addressDetailModel = Mapper.Map<AddressDetailViewModel>(address); if (address.AddressType == Constants.GetEnumDescription(AddressType.Home)) { addressModel.HomeAddress = addressDetailModel; } else if (address.AddressType == Constants.GetEnumDescription(AddressType.Business)) { addressModel.RegisteredAddress = addressDetailModel; } else if (address.AddressType == Constants.GetEnumDescription(AddressType.Mailing)) { addressModel.MailingAddress = addressDetailModel; } } } return addressModel; }
public void TestAddressDetailViewModel() { AddressDTO dto = new AddressDTO() { Id = 1, AddressLine1 = "FakeStreet", PostalCode = "FakePostalCode", City = "FakeCity", Phone = "FakePhone", Email = "FakeEmail", Version = 0 }; AddressDetailViewModel viewModel = new AddressDetailViewModel(dto, false); Assert.AreEqual(dto, viewModel.Model); Assert.AreEqual(Strings.AddressDetailViewModel_DisplayName, viewModel.DisplayName); }
protected override void New() { AddressDTO newAddress = new AddressDTO(); AddressDetailViewModel detailModelView = new AddressDetailViewModel(newAddress, true); if (NavigationService.NavigateTo("Detail", detailModelView) == NavigationResult.Ok) { ParentObject.MarkChildForInsertion(newAddress); Items.Add(newAddress); SelectedItem = newAddress; } }
protected override void Edit() { AddressDTO editAddress = SelectedItem.Clone(); AddressDetailViewModel detailModelView = new AddressDetailViewModel(editAddress, false); if (NavigationService.NavigateTo("Detail", detailModelView) == NavigationResult.Ok) { int index = Items.IndexOf(SelectedItem); Items.Remove(SelectedItem); Items.Insert(index, editAddress); SelectedItem = editAddress; ParentObject.MarkChildForUpdate(editAddress); } }
public ActionResult UpdateAdressDetail(AddressDetailViewModel model) { bool status = addmissionService.UpdateAddressDetail(model); LogActivityViewModel log = new LogActivityViewModel(); log.EnteredBy = Convert.ToInt32(Session["UserId"]); log.EnteredDate = DateTime.Now; log.ActioName = "UpdateAdressDetail"; log.ModuleName = "Admission"; log.ControllerName = "Addmission"; log.Activity = "Update Address Detail"; log.ActivityMessage = "Admission address detail of registraion no " + model.RegNo + " updated."; log.RegistrationNo = Convert.ToInt32(model.RegNo); logActivityService.CreateLogActivity(log); return(Json(status, JsonRequestBehavior.AllowGet)); }
public RecurringOrderEditViewModel BuildRecurringOrderEditViewModel(int recurringOrderId, AddressDetailViewModel address, CreditCardViewModel creditCard, Customer customer) { var originalOrder = new Order(recurringOrderId); if (customer.MasterShouldWeStoreCreditCardInfo && customer.PrimaryBillingAddress != null) { creditCard.Name = customer.PrimaryBillingAddress.CardName; creditCard.Number = customer.PrimaryBillingAddress.CardNumber; creditCard.CardType = customer.PrimaryBillingAddress.CardType; creditCard.ExpirationMonth = int.Parse(customer.PrimaryBillingAddress.CardExpirationMonth); creditCard.ExpirationYear = int.Parse(customer.PrimaryBillingAddress.CardExpirationYear); creditCard.CardStartMonth = !string.IsNullOrEmpty(customer.PrimaryBillingAddress.CardStartDate) ? int.Parse(customer.PrimaryBillingAddress.CardStartDate.Substring(0, 2)) : 0; creditCard.CardStartYear = !string.IsNullOrEmpty(customer.PrimaryBillingAddress.CardStartDate) ? int.Parse(customer.PrimaryBillingAddress.CardStartDate.Substring(2, 4)) : 0; creditCard.CardIssueNumber = customer.PrimaryBillingAddress.CardIssueNumber; } return(new RecurringOrderEditViewModel( recurringOrderId: recurringOrderId, requiresCreditCardForm: originalOrder.PaymentMethod == AppLogic.ro_PMCreditCard, address: address, creditCard: creditCard, cardTypeOptions: CreditCardSelectListBuilder.BuildCreditCardTypeSelectList(), expirationMonthOptions: CreditCardSelectListBuilder.BuildExpirationMonthSelectList(), expirationYearOptions: CreditCardSelectListBuilder.BuildExpirationYearSelectList())); }
public void TestAddressDetailViewModel() { AddressDTO dto = new AddressDTO() {Id = 1, AddressLine1 = "FakeStreet", PostalCode = "FakePostalCode", City = "FakeCity", Phone = "FakePhone", Email = "FakeEmail", Version = 0}; AddressDetailViewModel viewModel = new AddressDetailViewModel(dto, false); Assert.AreEqual(dto, viewModel.Model); Assert.AreEqual(Strings.AddressDetailViewModel_DisplayName, viewModel.DisplayName); }
public AddressDetailPage() { InitializeComponent(); BindingContext = _viewModel = App.Current.Services.GetService <AddressDetailViewModel>(); }