private void PopulatePreferAddress() { StringBuilder preferAddress = new StringBuilder(); if (StoreContext.CheckoutDetails.ContainsGiftRegistry()) { GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne( StoreContext.CheckoutDetails.GiftRegistryID); if (!giftRegistry.HideAddress) { preferAddress.Append(giftRegistry.ShippingAddress.FirstName + " " + giftRegistry.ShippingAddress.LastName); preferAddress = AppendString(preferAddress, string.Empty, giftRegistry.ShippingAddress.Company); preferAddress = AppendString(preferAddress, string.Empty, giftRegistry.ShippingAddress.Address1); preferAddress = AppendString(preferAddress, string.Empty, giftRegistry.ShippingAddress.Address2); preferAddress.Append("<br />"); preferAddress.Append(giftRegistry.ShippingAddress.City + "," + giftRegistry.ShippingAddress.State + " " + giftRegistry.ShippingAddress.Zip); preferAddress.Append("<br />"); preferAddress.Append( AddressUtilities.GetOnlyCountryNameByCountryCode(giftRegistry.ShippingAddress.Country)); preferAddress = AppendString(preferAddress, "Phone : ", giftRegistry.ShippingAddress.Phone); preferAddress = AppendString(preferAddress, "Fax : ", giftRegistry.ShippingAddress.Fax); uxPreferAddressLiteral.Text = preferAddress.ToString(); uxShippingInfoPanel.CssClass = "CheckoutShippingInfoPanel1"; uxSaleTaxExemptPanel.CssClass = "CheckoutShippingInfoPanel1"; uxSpecialPanel.CssClass = "CheckoutShippingInfoPanel1"; } else { uxPreferAddressPanel.Attributes.Add("class", "CheckoutPreferredAddressHide"); } } }
private void PopulateControls() { GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(GiftRegistryID); uxEventNameLable.Text = giftRegistry.EventName; uxEventDateLabel.Text = giftRegistry.EventDate.ToShortDateString(); IList <GiftRegistryItem> itemList = DataAccessContextDeluxe.GiftRegistryItemRepository.GetAllByGiftRegistryID(GiftRegistryID); for (int i = 0; i < itemList.Count; i++) { if (!IsExitsInCurrentStore(itemList[i].ProductID)) { itemList.RemoveAt(i); } } uxGrid.DataSource = itemList; uxGrid.DataBind(); if (uxGrid.Rows.Count == 0) { uxUpdateQuantityButton.Visible = false; } }
private void LoadRegistry(GiftRegistry giftRegistry) { ctrlGiftRegistryViewForm.LoadGiftRegistry(giftRegistry); var items = giftRegistry.GiftRegistryItems; if (items.Count() == 0) { return; } items = items.BuildItemsForTransaction(ThisCustomer, giftRegistry.RegistryID); var regItems = items.Where(item => item.GiftRegistryItemType == GiftRegistryItemType.vItem && item.Quantity > 0) .OrderBy(item => item.SortOrder); pnlItems.Visible = false; if (regItems.Count() > 0) { ctrGiftRegistryViewItemList.CustomUrl = giftRegistry.CustomURLPostfix; ctrGiftRegistryViewItemList.GiftRegistryItems = regItems; pnlItems.Visible = true; } var regOptions = items.Where(item => item.GiftRegistryItemType == GiftRegistryItemType.vOption && item.Quantity > 0) .OrderByDescending(item => item.SortOrder); pnlOptionItems.Visible = false; if (regOptions.Count() > 0) { GiftRegistryViewItemOptionList.CustomUrl = giftRegistry.CustomURLPostfix; GiftRegistryViewItemOptionList.GiftRegistryItems = regOptions; pnlOptionItems.Visible = true; } }
private OrderNotifyService CreateOrder(CheckoutDetails checkout) { OrderCreateService orderCreateService = new OrderCreateService( StoreContext.ShoppingCart, checkout, StoreContext.Culture, CurrenntCurrency, AffiliateHelper.GetAffiliateCode(), WebUtilities.GetVisitorIP()); OrderNotifyService orderBusiness; OrderAmount amount = orderCreateService.GetOrderAmount(StoreContext.Customer) .Add(CartItemPromotion.CalculatePromotionShippingAndTax( checkout, StoreContext.ShoppingCart.SeparateCartItemGroups(), StoreContext.Customer)); Order order = orderCreateService.PlaceOrder(amount, StoreContext.Customer, DataAccessContext.StoreRetriever, StoreContext.Culture); GiftRegistry.UpdateGiftRegistryQuantity(StoreContext.ShoppingCart, checkout); CustomerRewardPoint.UpdateRedeemPoint(checkout, StoreContext.Customer, order); orderBusiness = new OrderNotifyService(order.OrderID); return(orderBusiness); }
protected void GiftButton_Click(object sender, EventArgs e) { try { // If a user does not have a gift registry create one int giftRegistryID = GiftRegistries.GetGiftRegistry(0, GetLoggedCustomerID(), string.Empty, false).GiftRegistryID; if (giftRegistryID == 0) { GiftRegistry giftRegistry = new GiftRegistry() { CustomerID = GetLoggedCustomerID(), DateCreated = DateTime.Now, Active = true }; giftRegistryID = GiftRegistries.AddGiftRegistry(giftRegistry); } // Add this product GiftRegistries.AddGiftRegistryProduct(new GiftRegistryProduct() { GiftRegistryID = giftRegistryID, ProductID = CartProduct.ProductID, Active = true }); Response.Redirect("MyAccount/GiftRegistry.aspx"); } catch (Exception ex) { ((Button)sender).Text = "Error " + ex.Message; } }
private void ProcessOnPayPalProUSPayment(CheckoutDetails checkout) { PayPalProUSPaymentMethod paypalPayment = (PayPalProUSPaymentMethod)checkout.PaymentMethod; bool result = false; PaymentAppResult paymentResult; RecurringPaymentResult recurringPaymentResult; ProcessPaymentService process = ProcessPaymentService.CreateNew(new HttpService(), StoreContext.ShoppingCart); result = process.ProcessPayPalProUSPayment( StoreContext.GetOrderAmount().Total, DataAccessContext.CurrencyRepository.GetOne(DataAccessContext.Configurations.GetValue("PaymentCurrency")), StoreContext.Culture, checkout, StoreContext.ShoppingCart, StoreContext.Customer, UrlPath.StorefrontUrl, WebUtilities.GetVisitorIP(), out paymentResult, out recurringPaymentResult); if (result) { OrderCreateService orderCreateService = new OrderCreateService( StoreContext.ShoppingCart, StoreContext.CheckoutDetails, StoreContext.Culture, CurrenntCurrency, AffiliateHelper.GetAffiliateCode(), WebUtilities.GetVisitorIP(), recurringPaymentResult ); Order order; OrderAmount amount = orderCreateService.GetOrderAmount(StoreContext.Customer) .Add(CartItemPromotion.CalculatePromotionShippingAndTax( StoreContext.CheckoutDetails, StoreContext.ShoppingCart.SeparateCartItemGroups(), StoreContext.Customer)); order = orderCreateService.PlaceOrder(amount, StoreContext.Customer, DataAccessContext.StoreRetriever, StoreContext.Culture); GiftRegistry.UpdateGiftRegistryQuantity(StoreContext.ShoppingCart, StoreContext.CheckoutDetails); CustomerRewardPoint.UpdateRedeemPoint(StoreContext.CheckoutDetails, StoreContext.Customer, order); OrderNotifyService orderBusiness = new OrderNotifyService(order.OrderID); ProcessCreditCardPaymentSuccess( orderBusiness, paymentResult.GatewayOrderID, paymentResult.PaymentLog, paymentResult.CvvStatus, paymentResult.AvsAddrStatus, paymentResult.AvsZipStatus); } else { ProcessCreditCardPaymentFailure(paymentResult.ErrorMessage); } }
public void LoadGiftRegistry(GiftRegistry giftRegistry) { if (giftRegistry == null) { return; } StartDate = giftRegistry.StartDate; EndDate = giftRegistry.EndDate; Title = giftRegistry.Title; CustomURL = giftRegistry.CustomURLPostfix; Subject = giftRegistry.Title; }
private void BindRegistry() { giftRegistry = GiftRegistries.GetGiftRegistry(0, GetLoggedCustomerID(), string.Empty, true); GiftRegistryListView.DataSource = giftRegistry.Products; GiftRegistryListView.DataBind(); if (giftRegistry.IsPublic) { VisibilityRadioButtonList.SelectedValue = "true"; } else { VisibilityRadioButtonList.SelectedValue = "false"; } }
private void LoadRegistry(GiftRegistry giftRegistry) { ctrlGiftRegistryForm.LoadGiftRegistry(giftRegistry); var items = giftRegistry.GiftRegistryItems; pnlRegItems.Visible = false; pnlRegItemOptions.Visible = false; if (items.Count() == 0) { topicContainer.Visible = true; litTopic.Text = new Topic("GiftRegistry.EmptyCartInstruction", ThisCustomer.SkinID).Contents; return; } items = items.BuildItemsForTransaction(ThisCustomer, giftRegistry.RegistryID); var regItems = items.Where(item => item.GiftRegistryItemType == GiftRegistryItemType.vItem) .OrderBy(item => item.SortOrder); if (ctrlGiftRegistryForm.IsEditMode) { pnlRegItems.Visible = false; bool hasRegItems = (regItems.Count() > 0); if (hasRegItems) { ctrlGiftRegistryItemList.GiftRegistryItems = regItems; pnlRegItems.Visible = true; } var regItemsOptions = items.Where(item => item.GiftRegistryItemType == GiftRegistryItemType.vOption) .OrderByDescending(item => item.SortOrder); pnlRegItemOptions.Visible = false; bool hasRegOptionItems = (regItemsOptions.Count() > 0); if (hasRegOptionItems) { ctrlGiftRegistryItemListOptions.GiftRegistryItems = regItemsOptions; pnlRegItemOptions.Visible = true; } //filter the current registry. Should not be shown to the list. ddlModalRegistries.DataSource = ThisCustomer.GiftRegistries.Where(item => item.RegistryID != giftRegistry.RegistryID); ddlModalRegistries.DataTextField = "Title"; ddlModalRegistries.DataValueField = "RegistryID"; ddlModalRegistries.DataBind(); } }
public void LoadGiftRegistry(GiftRegistry giftRegistry) { if (giftRegistry == null) { return; } StartDate = giftRegistry.StartDate; EndDate = giftRegistry.EndDate; Title = giftRegistry.Title; GuestMessage = giftRegistry.Message; PictureFileName = giftRegistry.PictureFileName; PrivatePrivacy = giftRegistry.IsPrivate; GuestPassword = giftRegistry.GuestPassword; CustomURL = giftRegistry.CustomURLPostfix; OwnerFullName = giftRegistry.OwnersFullName; }
private void PopulateControls() { string customerID = DataAccessContext.CustomerRepository.GetIDFromUserName(Membership.GetUser().UserName); Customer customer = DataAccessContext.CustomerRepository.GetOne(customerID); GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(GiftRegistryID); string giftRegistryLink = UrlPath.StorefrontUrl + "GiftRegistryItem.aspx?GiftRegistryID=" + GiftRegistryID; string subjectText; string bodyText; EmailTemplateTextVariable.ReplaceGiftRegistryInvitationText(giftRegistry, giftRegistryLink, out subjectText, out bodyText); uxSubjectText.Text = subjectText; uxFromText.Text = customer.Email; uxEmailBodyHidden.Value = bodyText; }
private void EditAndRedirect() { if (Page.IsValid) { bool validateCountry, validateState; if (!uxCountryState.Validate(out validateCountry, out validateState)) { uxSummaryLiteral.Text = uxCountryState.FormatErrorHtml("Please correct the following errors:", validateCountry, validateState); return; } GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(GiftRegistryID); giftRegistry = SetUpGiftRegistry(giftRegistry); DataAccessContextDeluxe.GiftRegistryRepository.Save(giftRegistry); Redirect(); } }
protected void VisibilityRadioButtonList_SelectedIndexChanged(object sender, EventArgs e) { if (giftRegistry == null) { giftRegistry = GiftRegistries.GetGiftRegistry(0, GetLoggedCustomerID(), string.Empty, true); } // Create a registry if it doesnt exist if (giftRegistry.GiftRegistryID == 0) { giftRegistry = new GiftRegistry() { CustomerID = GetLoggedCustomerID(), DateCreated = DateTime.Now, Active = true }; giftRegistry.GiftRegistryID = GiftRegistries.AddGiftRegistry(giftRegistry); } GiftRegistries.UpdateGiftRegistryPublic(giftRegistry.GiftRegistryID, Convert.ToBoolean(VisibilityRadioButtonList.SelectedValue)); }
private void PopulateControls() { GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(GiftRegistryID); uxEventNameLable.Text = giftRegistry.EventName; uxEventDateLabel.Text = giftRegistry.EventDate.ToShortDateString(); if ((DataAccessContext.Configurations.GetBoolValue("PriceRequireLogin") && !Page.User.Identity.IsAuthenticated) || (CatalogUtilities.IsCatalogMode())) { uxGrid.Visible = false; uxAddToCartImageButton.Visible = false; } uxGrid.DataSource = DataAccessContextDeluxe.GiftRegistryItemRepository.GetAllByGiftRegistryID(GiftRegistryID); uxGrid.DataBind(); CheckCannotBuyItem(); }
public void LoadGiftRegistry(GiftRegistry giftRegistry) { if (giftRegistry == null) { return; } ctrlDatePickerStartDate.DateValue = giftRegistry.StartDate; ctrlDatePickerEndDate.DateValue = giftRegistry.EndDate; Title = giftRegistry.Title; GuestMessage = giftRegistry.Message; PrivatePrivacy = giftRegistry.IsPrivate; GuestPassword = giftRegistry.GuestPassword; CustomURL = giftRegistry.CustomURLPostfix; PictureFileName = giftRegistry.PictureFileName; txtGuestPassword.Enabled = (giftRegistry.IsPrivate); }
private void PopulateControls() { GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(GiftRegistryID); uxEventName.Text = giftRegistry.EventName; uxEventDateCalendarPopup.SelectedDate = giftRegistry.EventDate; uxCompany.Text = giftRegistry.ShippingAddress.Company; uxAddress1.Text = giftRegistry.ShippingAddress.Address1; uxAddress2.Text = giftRegistry.ShippingAddress.Address2; uxCity.Text = giftRegistry.ShippingAddress.City; uxZip.Text = giftRegistry.ShippingAddress.Zip; uxCountryState.CurrentCountry = giftRegistry.ShippingAddress.Country; uxCountryState.CurrentState = giftRegistry.ShippingAddress.State; uxPhone.Text = giftRegistry.ShippingAddress.Phone; uxFax.Text = giftRegistry.ShippingAddress.Fax; uxResidentialDrop.SelectedValue = giftRegistry.ShippingAddress.Residential.ToString(); uxHideAddressCheck.Checked = giftRegistry.HideAddress; uxHideEventCheck.Checked = giftRegistry.HideEvent; uxNotifyNewOrderCheck.Checked = giftRegistry.NotifyNewOrder; }
public void SetShippingAddress() { bool showShippingAddress = true; if (StoreContext.CheckoutDetails.ContainsGiftRegistry() && uxPreferShippingAddressRadio.Checked) { string giftRegistryID = StoreContext.CheckoutDetails.GiftRegistryID; GiftRegistry giftRegistry = DataAccessContextDeluxe.GiftRegistryRepository.GetOne(giftRegistryID); StoreContext.CheckoutDetails.ShippingAddress = giftRegistry.ShippingAddress; showShippingAddress = !giftRegistry.HideAddress; } else { Address address = new Address( uxShippingFirstName.Text, uxShippingLastName.Text, uxShippingCompany.Text, uxShippingAddress1.Text, uxShippingAddress2.Text, uxShippingCity.Text, uxCountryState.CurrentState, uxShippingZip.Text, uxCountryState.CurrentCountry, uxShippingPhone.Text, uxShippingFax.Text ); StoreContext.CheckoutDetails.ShippingAddress = new ShippingAddress( address, ConvertUtilities.ToBoolean(uxShippingResidentialDrop.SelectedValue)); if (!IsAnonymousCheckout()) { StoreContext.CheckoutDetails.ShippingAddress.ShippingAddressID = uxShippingAddressDrop.SelectedValue; StoreContext.CheckoutDetails.ShippingAddress.AliasName = uxShippingAddressDrop.Text; } } StoreContext.CheckoutDetails.ShippingAddress.IsSameAsBillingAddress = uxUseBillingAsShipping.Checked; StoreContext.CheckoutDetails.SetShowShippingAddress(showShippingAddress); }
private GiftRegistry SetUpGiftRegistry(GiftRegistry giftRegistry) { string customerID = DataAccessContext.CustomerRepository.GetIDFromUserName(Page.User.Identity.Name); Customer customer = DataAccessContext.CustomerRepository.GetOne(customerID); giftRegistry.EventName = uxEventName.Text; giftRegistry.EventDate = uxEventDateCalendarPopup.SelectedDate; giftRegistry.CustomerID = customerID; giftRegistry.UserName = customer.UserName; giftRegistry.ShippingAddress = new ShippingAddress(new Address( customer.BillingAddress.FirstName, customer.BillingAddress.LastName, uxCompany.Text, uxAddress1.Text, uxAddress2.Text, uxCity.Text, uxCountryState.CurrentState, uxZip.Text, uxCountryState.CurrentCountry, uxPhone.Text, uxFax.Text), ConvertUtilities.ToBoolean(uxResidentialDrop.SelectedValue)); giftRegistry.HideAddress = uxHideAddressCheck.Checked; giftRegistry.HideEvent = uxHideEventCheck.Checked; giftRegistry.NotifyNewOrder = uxNotifyNewOrderCheck.Checked; giftRegistry.StoreID = DataAccessContext.StoreRetriever.GetCurrentStoreID(); return(giftRegistry); }
private void SaveRegistry() { GiftRegistry giftRegistryItem = null; string defaultFileName = ctrlGiftRegistryForm.PictureFileName; if (ctrlGiftRegistryForm.IsEditMode) { giftRegistryItem = GiftRegistryDA.GetGiftRegistryByRegistryID(ctrlGiftRegistryForm.RegistryID.Value, InterpriseHelper.ConfigInstance.WebSiteCode); giftRegistryItem.StartDate = ctrlGiftRegistryForm.StartDate; giftRegistryItem.EndDate = ctrlGiftRegistryForm.EndDate; giftRegistryItem.Title = ctrlGiftRegistryForm.Title; giftRegistryItem.Message = ctrlGiftRegistryForm.GuestMessage; giftRegistryItem.IsPrivate = ctrlGiftRegistryForm.PrivatePrivacy; giftRegistryItem.PictureFileName = (!defaultFileName.IsNullOrEmptyTrimmed()) ? defaultFileName : DomainConstants.DEFAULT_NO_PIC_FILENAME; giftRegistryItem.PictureStream = ctrlGiftRegistryForm.PhotoStream; giftRegistryItem.CustomURLPostfix = ctrlGiftRegistryForm.CustomURL.TrimEnd().ToUrlEncode(); giftRegistryItem.RegistryID = ctrlGiftRegistryForm.RegistryID.Value; giftRegistryItem.GuestPassword = (ctrlGiftRegistryForm.PrivatePrivacy) ? ctrlGiftRegistryForm.GuestPassword : string.Empty; giftRegistryItem.SkinID = ThisCustomer.SkinID; giftRegistryItem.LocaleSettings = ThisCustomer.LocaleSetting; giftRegistryItem.IsEditMode = true; //giftRegistryItem.IsActive = true; } else { giftRegistryItem = new GiftRegistry(ThisCustomer.SkinID, ThisCustomer.LocaleSetting) { ContactGUID = ThisCustomer.ContactGUID, StartDate = ctrlGiftRegistryForm.StartDate, EndDate = ctrlGiftRegistryForm.EndDate, Title = ctrlGiftRegistryForm.Title, Message = ctrlGiftRegistryForm.GuestMessage, IsPrivate = ctrlGiftRegistryForm.PrivatePrivacy, GuestPassword = (ctrlGiftRegistryForm.PrivatePrivacy) ? ctrlGiftRegistryForm.GuestPassword : string.Empty, PictureFileName = (!defaultFileName.IsNullOrEmptyTrimmed()) ? defaultFileName : DomainConstants.DEFAULT_NO_PIC_FILENAME, PictureStream = ctrlGiftRegistryForm.PhotoStream, CustomURLPostfix = ctrlGiftRegistryForm.CustomURL.TrimEnd().ToUrlEncode(), WebsiteCode = InterpriseHelper.ConfigInstance.WebSiteCode, RegistryID = Guid.NewGuid(), IsEditMode = false, IsActive = true }; } giftRegistryItem.Validate(); if (!giftRegistryItem.HasErrors) { if (!ctrlGiftRegistryForm.IsEditMode) { giftRegistryItem.PictureFileName = giftRegistryItem.ProcessPicture(Server.MapPath(string.Empty)); ThisCustomer.GiftRegistries.AddToDb(giftRegistryItem); Response.Redirect(string.Format("editgiftregistry.aspx?{0}={1}", DomainConstants.GIFTREGISTRYPARAMCHAR, giftRegistryItem.RegistryID.ToString())); } else { giftRegistryItem.PictureFileName = giftRegistryItem.ProcessPicture(Server.MapPath(string.Empty)); ThisCustomer.GiftRegistries.UpdateToDb(giftRegistryItem); UpdatePreview(); LoadRegistry(giftRegistryItem); } pnlErrorMessage.Visible = false; } else { DisplayError(giftRegistryItem.GetErrorMessage()); } }