public IHttpActionResult GetBalance([FromUri] Models.Address address) { List<Models.MosaicBalanceModel> balance = new List<Models.MosaicBalanceModel>(); var connection = new Connection(); connection.SetTestnet(); try { // To get mosaic information of the account from the address. var mosaicClient = new NamespaceMosaicClient(connection); var mosaicResult = mosaicClient.BeginGetMosaicsOwned(address.MosaicAddress); var mosaicResponse = mosaicClient.EndGetMosaicsOwned(mosaicResult); foreach (var data in mosaicResponse.Data) { if (data.MosaicId.Name == "tfc") { balance.Add(new Models.MosaicBalanceModel { Name = data.MosaicId.Name, Amount = data.Quantity / 10000 }); } } } catch (Exception e) { } if (balance.Count == 0) { return NotFound(); } return Ok(balance); }
public async Task <double[]> GetCoords(Models.Address addressToCode) { //Create a request. var request = new GeocodeRequest() { Address = new SimpleAddress() { AddressLine = addressToCode.Street, Locality = addressToCode.City, AdminDistrict = addressToCode.State, PostalCode = addressToCode.Zip }, BingMapsKey = API_Keys.Bing }; // I Want to check the response, but it appears to be skipping over the steps below. //Process the request by using the ServiceManager. double[] coords = new double[2]; var response = await ServiceManager.GetResponseAsync(request); if (response != null && response.ResourceSets != null && response.ResourceSets.Length > 0 && response.ResourceSets[0].Resources != null && response.ResourceSets[0].Resources.Length > 0) { var result = response.ResourceSets[0].Resources[0] as BingMapsRESTToolkit.Location; coords[0] = result.Point.Coordinates[0]; coords[1] = result.Point.Coordinates[1]; } return(coords); }
public async Task <IHttpActionResult> PostBIM() { // string[] buildings = resultString.Split(new string[] { "BuildingStoreys" }, StringSplitOptions.None); SpacesHandler SH = new SpacesHandler(db); StoreysHandler STH = new StoreysHandler(db); BuildingsHandler BH = new BuildingsHandler(db); AddressesHandler AH = new AddressesHandler(db); Building building = JsonConvert.DeserializeObject <Building>(Request.Content.ReadAsStringAsync().Result); Models.Building b = new Models.Building(building.ID, building.Name); BH.PostBuilding(b); double?longitude = building.Address.Longitude; double?latitude = building.Address.Latitude; Models.Address address = new Models.Address(building.Address.Street, building.Address.Number, building.Address.Town, building.Address.PostalCode, building.Address.Region, building.Address.Country, longitude, latitude, b); AH.PostAddress(address); List <BuildingStorey> storeys = building.BuildingStoreys; foreach (BuildingStorey storey in storeys) { Models.Storey st = new Models.Storey(storey.ID, storey.Name, b); STH.PostStorey(st); foreach (Space space in storey.Spaces) { Models.Space s = new Models.Space(space.ID, space.Name, st); SH.PostSpace(s); } } List <Space> spaces = storeys[0].Spaces; return(Ok(building)); }
public ActionResult Create(FormCollection collection) { try { int id = int.Parse(Session["user_id"].ToString()); Models.Profile theProfile = database.Profiles.SingleOrDefault(p => p.user_id == id); // TODO: Add insert logic here Models.Address newAddress = new Models.Address() { city = collection["city"], country_code = collection["country_code"], description = collection["description"], profile_id = theProfile.profile_id, province_state = collection["province_state"], street = collection["street"], zip_postal = collection["zip_postal"] }; database.Addresses.Add(newAddress); database.SaveChanges(); return(RedirectToAction("Index", new { id = newAddress.profile_id })); } catch { return(View()); } }
public async Task <double> GetTravelTime(Models.Address fromAddress, Models.Address toAddress) { var request = new RouteRequest() { Waypoints = new List <SimpleWaypoint>() { new SimpleWaypoint(fromAddress.Lat, fromAddress.Lon), new SimpleWaypoint(toAddress.Lat, toAddress.Lon) }, BingMapsKey = Constants.API_Keys.Bing }; double travelTime = 0; var response = await ServiceManager.GetResponseAsync(request); if (response != null && response.ResourceSets != null && response.ResourceSets.Length > 0 && response.ResourceSets[0].Resources != null && response.ResourceSets[0].Resources.Length > 0) { var result = response.ResourceSets[0].Resources[0] as BingMapsRESTToolkit.Route; //Do something with the result. travelTime = Convert.ToDouble(result.TravelDuration); } return(travelTime); }
/// <summary> /// Initializes a new instance of the <see cref="CreateCustomerRequest"/> class. /// </summary> /// <param name="idempotencyKey">idempotency_key.</param> /// <param name="givenName">given_name.</param> /// <param name="familyName">family_name.</param> /// <param name="companyName">company_name.</param> /// <param name="nickname">nickname.</param> /// <param name="emailAddress">email_address.</param> /// <param name="address">address.</param> /// <param name="phoneNumber">phone_number.</param> /// <param name="referenceId">reference_id.</param> /// <param name="note">note.</param> /// <param name="birthday">birthday.</param> public CreateCustomerRequest( string idempotencyKey = null, string givenName = null, string familyName = null, string companyName = null, string nickname = null, string emailAddress = null, Models.Address address = null, string phoneNumber = null, string referenceId = null, string note = null, string birthday = null) { this.IdempotencyKey = idempotencyKey; this.GivenName = givenName; this.FamilyName = familyName; this.CompanyName = companyName; this.Nickname = nickname; this.EmailAddress = emailAddress; this.Address = address; this.PhoneNumber = phoneNumber; this.ReferenceId = referenceId; this.Note = note; this.Birthday = birthday; }
public Payment(string id = null, string createdAt = null, string updatedAt = null, Models.Money amountMoney = null, Models.Money tipMoney = null, Models.Money totalMoney = null, Models.Money appFeeMoney = null, IList <Models.ProcessingFee> processingFee = null, Models.Money refundedMoney = null, string status = null, string delayDuration = null, string delayAction = null, string delayedUntil = null, string sourceType = null, Models.CardPaymentDetails cardDetails = null, string locationId = null, string orderId = null, string referenceId = null, string customerId = null, string employeeId = null, IList <string> refundIds = null, Models.RiskEvaluation riskEvaluation = null, string buyerEmailAddress = null, Models.Address billingAddress = null, Models.Address shippingAddress = null, string note = null, string statementDescriptionIdentifier = null, string receiptNumber = null, string receiptUrl = null) { Id = id; CreatedAt = createdAt; UpdatedAt = updatedAt; AmountMoney = amountMoney; TipMoney = tipMoney; TotalMoney = totalMoney; AppFeeMoney = appFeeMoney; ProcessingFee = processingFee; RefundedMoney = refundedMoney; Status = status; DelayDuration = delayDuration; DelayAction = delayAction; DelayedUntil = delayedUntil; SourceType = sourceType; CardDetails = cardDetails; LocationId = locationId; OrderId = orderId; ReferenceId = referenceId; CustomerId = customerId; EmployeeId = employeeId; RefundIds = refundIds; RiskEvaluation = riskEvaluation; BuyerEmailAddress = buyerEmailAddress; BillingAddress = billingAddress; ShippingAddress = shippingAddress; Note = note; StatementDescriptionIdentifier = statementDescriptionIdentifier; ReceiptNumber = receiptNumber; ReceiptUrl = receiptUrl; }
public IActionResult Delete([FromBody] Models.Address value) { try { bool dt = Address.DeleteAddress(value); var resval = dt ? StatusCode(StatusCodes.Status200OK) : StatusCode(StatusCodes.Status204NoContent); return(resval); } catch (Helper.RepositoryException ex) { switch (ex.Type) { case UpdateResultType.SQLERROR: return(StatusCode(StatusCodes.Status500InternalServerError, "Internal Server Error")); case UpdateResultType.INVALIDEARGUMENT: return(StatusCode(StatusCodes.Status409Conflict, "Conflict")); case UpdateResultType.ERROR: return(StatusCode(StatusCodes.Status400BadRequest, "Bad Request")); default: return(StatusCode(StatusCodes.Status406NotAcceptable, "Not Acceptable")); } } }
public async Task <IActionResult> PostCreate(Models.Address model) { model.ClientWebId = int.Parse(HttpContext.Request.Form["ClientWebId"]); try { if (ModelState.IsValid) { model.ClientWebId = int.Parse(HttpContext.Request.Form["ClientWebId"]); _context.Add(model); await _context.SaveChangesAsync(); HttpContext.Session.SetString("messageAction", "La operación se realizó de manera exitosa"); } else { HttpContext.Session.SetString("messageAction", "Ha ocurrido un error"); } return(Redirect("/client/client/list/")); } catch { HttpContext.Session.SetString("messageAction", "Ocurrio un error al intentar la operación"); return(Redirect("/client/client/list/")); } }
public V1Merchant(string id = null, string name = null, string email = null, string accountType = null, IList <string> accountCapabilities = null, string countryCode = null, string languageCode = null, string currencyCode = null, string businessName = null, Models.Address businessAddress = null, Models.V1PhoneNumber businessPhone = null, string businessType = null, Models.Address shippingAddress = null, Models.V1MerchantLocationDetails locationDetails = null, string marketUrl = null) { Id = id; Name = name; Email = email; AccountType = accountType; AccountCapabilities = accountCapabilities; CountryCode = countryCode; LanguageCode = languageCode; CurrencyCode = currencyCode; BusinessName = businessName; BusinessAddress = businessAddress; BusinessPhone = businessPhone; BusinessType = businessType; ShippingAddress = shippingAddress; LocationDetails = locationDetails; MarketUrl = marketUrl; }
public static async Task SendPostMessageAsync(Models.Address address, string reqUrl) { var tokenProvider = TokenProvider.CreateSharedAccessSignatureTokenProvider(KeyName, AccessKey); var messagingFactory = MessagingFactory.Create(BaseAddress, tokenProvider); var sender = messagingFactory.CreateMessageSender(QueueName); var messageModel = new MessageModel() { TitleMessage = "New Address record {" + address.AddressId + "} added for {" + address.CustomerId + "} at " + DateTime.UtcNow, CustomerGuid = address.CustomerId, LastModifiedDate = address.LastModifiedDate, URL = reqUrl + "/" + address.AddressId, IsNewCustomer = false, TouchpointId = address.LastModifiedTouchpointId }; var msg = new BrokeredMessage(new MemoryStream(Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(messageModel)))) { ContentType = "application/json", MessageId = address.CustomerId + " " + DateTime.UtcNow }; //msg.ForcePersistence = true; Required when we save message to cosmos await sender.SendAsync(msg); }
public ActionResult Create(int id, FormCollection collection) { try { // TODO: Add insert logic here Models.Address newAddress = new Models.Address() { city = collection["city"], country_code = collection["country_code"], description = collection["description"], person_id = id, prov_state = collection["prov_state"], // stat_prov street = collection["street"], // street zip_postal = collection["zip_postal"] // zip_postal }; db.Addresses.Add(newAddress); db.SaveChanges(); return(RedirectToAction("Index", new { id = newAddress.person_id })); } catch { return(View()); } }
public async Task <IActionResult> OnGetAsync(int?id) { string userId = _userManager.GetUserId(User); if (id == null) { return(NotFound()); } var testAdress = await _context.Address .Where(addres => addres.Id == id && addres.UserId == userId) .FirstOrDefaultAsync(); if (testAdress == null) { return(NotFound()); } Address = await _context.Address .Where(a => a.UserId == userId && a.Id == id) .FirstOrDefaultAsync(); if (Address == null) { return(NotFound()); } return(Page()); }
public ChargeRequest(string idempotencyKey, Models.Money amountMoney, string cardNonce = null, string customerCardId = null, bool?delayCapture = null, string referenceId = null, string note = null, string customerId = null, Models.Address billingAddress = null, Models.Address shippingAddress = null, string buyerEmailAddress = null, string orderId = null, IList <Models.ChargeRequestAdditionalRecipient> additionalRecipients = null, string verificationToken = null) { IdempotencyKey = idempotencyKey; AmountMoney = amountMoney; CardNonce = cardNonce; CustomerCardId = customerCardId; DelayCapture = delayCapture; ReferenceId = referenceId; Note = note; CustomerId = customerId; BillingAddress = billingAddress; ShippingAddress = shippingAddress; BuyerEmailAddress = buyerEmailAddress; OrderId = orderId; AdditionalRecipients = additionalRecipients; VerificationToken = verificationToken; }
// TODO - GenerateCreditCardPayment(). public object GenerateCreditCardPayment( Models.Customer loggedInCustomer, ShippingInformation shippingInfo, Models.Address customerAddress, List <CartItem> cartItems, CreditCard creditCart) { try { SetKeys(); decimal totalPrice = CalculateTotalPrice(cartItems, shippingInfo); Transaction transaction = new Transaction() { Amount = PriceConverter.ConvertDecimalPriceToPriceInCents(totalPrice), Billing = BillingFactory(loggedInCustomer, customerAddress), Card = CardFactory(creditCart), Customer = CustomerFactory(loggedInCustomer), Item = ItemArrayFactory(cartItems), Shipping = ShippingFactory(loggedInCustomer, shippingInfo, customerAddress) }; transaction.Save(); return(new { TransactionId = transaction.Id }); } catch (Exception e) { return(new { Error = e.Message }); } }
/// <summary> /// Initializes a new instance of the <see cref="Card"/> class. /// </summary> /// <param name="id">id.</param> /// <param name="cardBrand">card_brand.</param> /// <param name="last4">last_4.</param> /// <param name="expMonth">exp_month.</param> /// <param name="expYear">exp_year.</param> /// <param name="cardholderName">cardholder_name.</param> /// <param name="billingAddress">billing_address.</param> /// <param name="fingerprint">fingerprint.</param> /// <param name="customerId">customer_id.</param> /// <param name="referenceId">reference_id.</param> /// <param name="enabled">enabled.</param> /// <param name="cardType">card_type.</param> /// <param name="prepaidType">prepaid_type.</param> /// <param name="bin">bin.</param> /// <param name="version">version.</param> public Card( string id = null, string cardBrand = null, string last4 = null, long?expMonth = null, long?expYear = null, string cardholderName = null, Models.Address billingAddress = null, string fingerprint = null, string customerId = null, string referenceId = null, bool?enabled = null, string cardType = null, string prepaidType = null, string bin = null, long?version = null) { this.Id = id; this.CardBrand = cardBrand; this.Last4 = last4; this.ExpMonth = expMonth; this.ExpYear = expYear; this.CardholderName = cardholderName; this.BillingAddress = billingAddress; this.Fingerprint = fingerprint; this.CustomerId = customerId; this.ReferenceId = referenceId; this.Enabled = enabled; this.CardType = cardType; this.PrepaidType = prepaidType; this.Bin = bin; this.Version = version; }
public IActionResult Get(int id) { Models.Address dt = Address.Read(id); var reval = dt != null?StatusCode(StatusCodes.Status200OK, dt) : (IActionResult)StatusCode(StatusCodes.Status204NoContent); return(reval); }
public ActionResult Create(int id, FormCollection collection) { string countryName = collection["country_name"]; try { // TODO: Add insert logic here Models.Address newAddress = new Models.Address() { city = collection["city"], description = collection["description"], street = collection["street"], province = collection["province"], postal_code = collection["postal_code"], country_id = (from c in db.Countries where c.country_name.Equals(countryName) select c.country_id).FirstOrDefault(), profile_id = id }; db.Addresses.Add(newAddress); db.SaveChanges(); return(RedirectToAction("Index", new { id = id })); } catch { ViewBag.countries = new SelectList(from c in db.Countries select c.country_name); ViewBag.id = id; return(View()); } }
/// <summary> /// Initializes a new instance of the <see cref="UpdateCustomerRequest"/> class. /// </summary> /// <param name="givenName">given_name.</param> /// <param name="familyName">family_name.</param> /// <param name="companyName">company_name.</param> /// <param name="nickname">nickname.</param> /// <param name="emailAddress">email_address.</param> /// <param name="address">address.</param> /// <param name="phoneNumber">phone_number.</param> /// <param name="referenceId">reference_id.</param> /// <param name="note">note.</param> /// <param name="birthday">birthday.</param> /// <param name="version">version.</param> public UpdateCustomerRequest( string givenName = null, string familyName = null, string companyName = null, string nickname = null, string emailAddress = null, Models.Address address = null, string phoneNumber = null, string referenceId = null, string note = null, string birthday = null, long?version = null) { this.GivenName = givenName; this.FamilyName = familyName; this.CompanyName = companyName; this.Nickname = nickname; this.EmailAddress = emailAddress; this.Address = address; this.PhoneNumber = phoneNumber; this.ReferenceId = referenceId; this.Note = note; this.Birthday = birthday; this.Version = version; }
public static IAddress ToAddress(this SearchResultItem result) { if (result != null) { var Address = new Models.Address(); string FormattedAddress; FormattedAddress = result.FieldItems.TryGetValue("FULL_ADDRESS"); var Index = Math.Max(0, FormattedAddress.IndexOf(result.FieldItems.TryGetValue("STREET") + ",")); Address.Uprn = long.Parse(result.FieldItems.TryGetValue("UPRN") ?? null); //Address.Usrn = long.Parse(result.FieldItems.TryGetValue("USRN") ?? null); //Address.Organisation = result.FieldItems.TryGetValue("ORGANISATION"); Address.Property = (!String.IsNullOrWhiteSpace(FormattedAddress) ? FormattedAddress.Substring(0, Index) : String.Empty).Trim().TrimEnd(','); Address.Street = result.FieldItems.TryGetValue("STREET"); Address.Locality = result.FieldItems.TryGetValue("LOCALITY"); Address.Town = result.FieldItems.TryGetValue("TOWN"); Address.Area = result.FieldItems.TryGetValue("POSTTOWN"); Address.PostCode = result.FieldItems.TryGetValue("POSTCODE"); return(Address); } return(null); }
public ActionResult Create(int id, FormCollection collection) { try { // TODO: Add insert logic here Models.Address address = new Models.Address() { person_id = id, description = collection["description"], street_address = collection["street_address"], city = collection["city"], province_state = collection["province_state"], zip_postal_code = collection["zip_postal_code"], country_id = Int32.Parse(collection["country_id"]) }; db.Addresses.Add(address); db.SaveChanges(); return(RedirectToAction("Index", new { id = id })); } catch { return(View()); } }
public virtual async Task DeleteAddressAsync(int id) { Models.Address address = await GetAddressByIdAsync(id); _db.Entry(address).State = EntityState.Deleted; await _db.SaveChangesAsync(); }
public string AddAddress([FromBody] Models.Address address) { var status = "Adding address failed"; try { EFModels.Address addressb = new EFModels.Address() { Id = address.Id, Addressid = address.Addressid, Userid = address.Userid, Firstname = address.Firstname, Lastname = address.Lastname, Addresslineone = address.Addresslineone, Addresslinetwo = address.Addresslinetwo, Landmark = address.Landmark, City = address.City, Pincode = address.Pincode, State = address.State, Country = address.Country, Email = address.Email, Phone = address.Phone, Isshippingaddress = address.Isshippingaddress, }; status = _UserFacade.AddAddress(addressb); } catch (Exception e) { status = e.Message; throw e; } return(status); }
protected async Task Hide(Models.Address item) { await _addressService.HideAsync(item.Id); await SaveAsync(); StateHasChanged(); }
public ActionResult BillingAddress(Models.Address address) { //set the billing address for the order to be this address this.MyOrder.BillingAddress = address; //save changes db.SaveChanges(); return(RedirectToAction("Payment")); }
public async Task AddAddress(Models.Address address) { using (ApplicationDbContext context = new ApplicationDbContext()) { context.Addresses.Add(address); await context.SaveChangesAsync(); } }
public void CheckAddress2(Models.Address address) { // TODO: Create custom exception for required address line 2. if (address.AddressLine2 == null) { throw new Exception($"{nameof(address.AddressLine2)} is a required field for {address.CountryCode} addresses."); } }
private PagarMe.Billing BillingFactory(Models.Customer customer, Models.Address address) { return(new PagarMe.Billing() { Name = customer.Name, Address = AddressFactory(address) }); }
public async Task EditAddress(Models.Address address) { using (ApplicationDbContext context = new ApplicationDbContext()) { context.Entry(address).State = EntityState.Modified; await context.SaveChangesAsync(); } }
protected void Add() { Model = new Models.Address(); Model.AppUserId = UserId; _showAdd = true; _isButtonAddVisible = false; }
public ActionResult Shipping(string shippingRecipientName, string shippingStreet, string shippingZipCode, string shippingCity, int shippingCountryId , bool sameBillingAddress , int addressIndex , string billingRecipientName, string billingStreet, string billingZipCode, string billingCity, int billingCountryId , Models.RegistrationUser registrationUser , string emailConfirmation) { var cart = CartService.GetCurrentOrderCart(User.GetUserPrincipal()); if (cart == null || cart.ItemCount == 0) { return RedirectToERPStoreRoute(ERPStoreRoutes.HOME); } var user = User.GetUserPrincipal().CurrentUser; ViewData.Model = cart; var shippingAddress = new Models.Address(); var billingAddress = new Models.Address(); Models.RegistrationUser registration = null; if (user == null) { shippingAddress.RecipientName = shippingRecipientName; shippingAddress.Street = shippingStreet; shippingAddress.ZipCode = shippingZipCode; shippingAddress.CountryId = shippingCountryId; shippingAddress.City = shippingCity; var shippingAddressBrokenrules = AccountService.ValidateUserAddress(shippingAddress, HttpContext); foreach (var item in shippingAddressBrokenrules) { item.PropertyName = "shipping" + item.PropertyName; } ViewData.ModelState.AddModelErrors(shippingAddressBrokenrules); if (!sameBillingAddress) { billingAddress.RecipientName = billingRecipientName; billingAddress.Street = billingStreet; billingAddress.ZipCode = billingZipCode; billingAddress.CountryId = billingCountryId; billingAddress.City = billingCity; var billingAddressBrokenrules = AccountService.ValidateUserAddress(billingAddress, HttpContext); foreach (var item in billingAddressBrokenrules) { item.PropertyName = "billing" + item.PropertyName; } ModelState.AddModelErrors(billingAddressBrokenrules); } // Pour passer tout test registrationUser.Password = (registrationUser.Password.IsNullOrTrimmedEmpty()) ? "1234567489abcdefg" : registrationUser.Password; var registrationUserBrokenRules = AccountService.ValidateRegistrationUser(registrationUser, HttpContext); ModelState.AddModelErrors(registrationUserBrokenRules); registration = AccountService.GetRegistrationUser(User.GetUserPrincipal().VisitorId); if (registration == null) { // Ce cas ne doit etre possible normalement registration = AccountService.CreateRegistrationUser(); } if (registration.Email.IsNullOrTrimmedEmpty() && (emailConfirmation.IsNullOrTrimmedEmpty() || !registrationUser.Email.Equals(emailConfirmation, StringComparison.InvariantCultureIgnoreCase))) { ModelState.AddModelError("emailConfirmation", "L'Email indiqué n'est pas confirmé"); } // Adresse de livraison registration.ShippingAddressCity = shippingAddress.City; registration.ShippingAddressCountryId = shippingAddress.CountryId; registration.ShippingAddressRecipientName = shippingAddress.RecipientName; registration.ShippingAddressRegion = shippingAddress.Region; registration.ShippingAddressStreet = shippingAddress.Street; registration.ShippingAddressZipCode = shippingAddress.ZipCode; registration.IsSameBillingAddress = sameBillingAddress; if (!sameBillingAddress) { // Adresse de facturation registration.BillingAddressCity = billingAddress.City; registration.BillingAddressCountryId = billingAddress.CountryId; registration.BillingAddressRecipientName = billingAddress.RecipientName; registration.BillingAddressRegion = billingAddress.Region; registration.BillingAddressStreet = billingAddress.Street; registration.BillingAddressZipCode = billingAddress.ZipCode; } // Informations sur la société registration.CorporateEmail = registrationUser.CorporateEmail; registration.CorporateFaxNumber = registrationUser.CorporateFaxNumber; registration.CorporateName = registrationUser.CorporateName; registration.CorporatePhoneNumber = registrationUser.CorporatePhoneNumber; registration.CorporateSocialStatus = registrationUser.CorporateSocialStatus; registration.CorporateWebSite = registrationUser.CorporateWebSite; registration.FaxNumber = registrationUser.FaxNumber; registration.NAFCode = registrationUser.NAFCode; registration.SiretNumber = registrationUser.SiretNumber; registration.VATNumber = registrationUser.TVANumber; registration.VatMandatory = registrationUser.VatMandatory; registration.RcsNumber = registrationUser.RcsNumber; // Informations personnelles registration.Email = registrationUser.Email; registration.FirstName = registrationUser.FirstName; registration.LastName = registrationUser.LastName; registration.MobileNumber = registrationUser.MobileNumber; // registration.Password = registrationUser.Password; registration.PhoneNumber = registrationUser.PhoneNumber; registration.PresentationId = registrationUser.PresentationId; registration.ReturnUrl = registrationUser.ReturnUrl; AccountService.SaveRegistrationUser(User.GetUserPrincipal().VisitorId, registration); user = AccountService.CreateUserFromRegistration(registration); } else { if (addressIndex == -1) // Cas d'une nouvelle adresse { shippingAddress.RecipientName = shippingRecipientName; shippingAddress.Street = shippingStreet; shippingAddress.ZipCode = shippingZipCode; shippingAddress.CountryId = shippingCountryId; shippingAddress.City = shippingCity; var shippingAddressBrokenrules = AccountService.ValidateUserAddress(shippingAddress, HttpContext); foreach (var item in shippingAddressBrokenrules) { item.PropertyName = "shipping" + item.PropertyName; } ViewData.ModelState.AddModelErrors(shippingAddressBrokenrules); if (ModelState.IsValid) { AddressService.SaveAddress(user, shippingAddress, true); } } } ViewData["SelectedAddressId"] = addressIndex; Models.Address address = null; if (addressIndex == -1) // Nouvelle adresse { address = shippingAddress; user.DeliveryAddressList.Add(address); } else { address = user.DeliveryAddressList[addressIndex]; } cart.DeliveryAddress = address; if (sameBillingAddress) { cart.BillingAddress = cart.DeliveryAddress; } else { cart.BillingAddress = user.DefaultAddress; } if (!ModelState.IsValid) { ViewData["RegistrationUser"] = registration; if (registration != null) { return View("shipping"); } else { return View("connectedshipping"); } } using (var ts = TransactionHelper.GetNewReadCommitted()) { CartService.Save(cart); ts.Complete(); } return RedirectToERPStoreRoute(ERPStoreRoutes.CHECKOUT_CONFIGURATION); }