private void SaveInfoToOrder(bool savePaymentData) { if (chkBillToSame.Checked) { BillToAddress.LoadFromAddress(ShipToAddress.GetAsAddress()); } // Save Information to Cart in Case Save as Order Fails CurrentOrder.BillingAddress = BillToAddress.GetAsAddress(); CurrentOrder.ShippingAddress = ShipToAddress.GetAsAddress(); TagOrderWithUser(); CurrentOrder.UserEmail = EmailAddressTextBox.Text; CurrentOrder.Instructions = txtInstructions.Text.Trim(); // Save Shipping Selection var r = FindSelectedRate(ShippingRatesList.SelectedValue, CurrentOrder); if (r != null) { HccApp.OrderServices.OrdersRequestShippingMethodByUniqueKey(r.UniqueKey, CurrentOrder); } if (savePaymentData) { // Save Payment Information SavePaymentInfo(); } HccApp.CalculateOrderAndSave(CurrentOrder); }
private void TagOrderWithUser(CustomerAccount account) { var u = account; if (u != null) { if (u.Bvin != string.Empty) { UserIdField.Value = u.Bvin; CurrentOrder.UserID = u.Bvin; u.CheckIfNewAddressAndAddNoUpdate(BillToAddress.GetAsAddress()); u.CheckIfNewAddressAndAddNoUpdate(ShipToAddress.GetAsAddress()); HccApp.MembershipServices.Customers.Update(u); } } }
protected void UserSelected(UserSelectedEventArgs args) { if (args.UserAccount == null) { return; } UserIdField.Value = args.UserAccount.Bvin; CurrentOrder.UserID = args.UserAccount.Bvin; HccApp.OrderServices.Orders.Update(CurrentOrder); BillToAddress.LoadFromAddress(args.UserAccount.BillingAddress); ShipToAddress.LoadFromAddress(args.UserAccount.ShippingAddress); if (BillToAddress.FirstName == string.Empty) { BillToAddress.FirstName = args.UserAccount.FirstName; } if (BillToAddress.LastName == string.Empty) { BillToAddress.LastName = args.UserAccount.LastName; } if (ShipToAddress.FirstName == string.Empty) { ShipToAddress.FirstName = args.UserAccount.FirstName; } if (ShipToAddress.LastName == string.Empty) { ShipToAddress.LastName = args.UserAccount.LastName; } EmailAddressTextBox.Text = args.UserAccount.Email; LoadShippingMethods(); CurrentOrder.UserEmail = EmailAddressTextBox.Text; CurrentOrder.BillingAddress = BillToAddress.GetAsAddress(); CurrentOrder.ShippingAddress = ShipToAddress.GetAsAddress(); HccApp.OrderServices.Orders.Update(CurrentOrder); }