/// <summary> /// ProcessAddShippingSubmit - click on continue on new shipping address /// </summary> /// <param name="button"></param> protected void ProcessAddShippingSubmit() { bool isNicknameEntered = false; string distributorID = DistributorID; string locale = Locale; bool toSession = cbSaveThis.Checked ? false : true; WorkedUponAddress.ID = -1; IShippingProvider shippingProvider = (this.Page as ProductsBase).GetShippingProvider(); var addressList = GetShippingAddressesFromDeliveryOptions( shippingProvider.GetShippingAddresses(distributorID, locale)); // EMPTY IS ALLOWED OTHERWISE YOU COULD GET BUG 24224 for duplicates // if (!this.txtNickname.Text.Equals(String.Empty)) { WorkedUponAddress.Alias = txtNickname.Text.Trim(); isNicknameEntered = true; } try { //1) Submit validated chnages to Shippping Provider WorkedUponAddress.ID = ProductsBase.GetShippingProvider().SaveShippingAddress (distributorID, locale, WorkedUponAddress , toSession , true , isNicknameEntered); } finally { } if (WorkedUponAddress.ID == -2) //duplicateShippingAddress { trError.Visible = true; blErrors.Items.Add( new ListItem(PlatformResources.GetGlobalResourceString("ErrorMessage", "AddressExists"))); return; } if (WorkedUponAddress.ID == -3) //duplicateNickName { trError.Visible = true; blErrors.Items.Add( new ListItem(PlatformResources.GetGlobalResourceString("ErrorMessage", "DuplicateAddressNickname"))); return; } else { WorkedUponAddress.DisplayName = WorkedUponAddress.Alias == string.Empty ? shippingProvider.GetAddressDisplayName(WorkedUponAddress) : WorkedUponAddress.Alias; ShoppingCart.CopyInvoiceStatus = ServiceProvider.CatalogSvc.CopyInvoiceStatus.success; Session["IsCopingFromInvoice"] = null; OnShippingAddressCreated(this, new ShippingAddressEventArgs(distributorID, WorkedUponAddress, false, false)); //popup_AddEditShippingControl.Hide(); } }
protected override ShoppingCartRuleResult PerformRules(ShoppingCart_V02 cart, ShoppingCartRuleReason reason, ShoppingCartRuleResult Result) { if (HLConfigManager.Configurations.ShoppingCartConfiguration.CheckELearning) { switch (reason) { case ShoppingCartRuleReason.CartItemsBeingAdded: if (!CanBuy_eLearningRule(cart as MyHLShoppingCart)) { cart.CurrentItems.Clear(); Result.Result = RulesResult.Failure; Result.AddMessage(PlatformResources.GetGlobalResourceString("ErrorMessage", "RequiredELearning")); cart.RuleResults.Add(Result); return(Result); } break; case ShoppingCartRuleReason.CartRetrieved: checkLimits(cart as MyHLShoppingCart); break; } } return(base.PerformRules(cart, reason, Result)); }
protected bool CanSaveCart(ref DropDownList DeliveryType, ref DropDownList DropdownNickName) { var retValue = true; Session.Remove("CantSaveCart"); DeliveryOptionType deliveryType = getDeliveryOptionTypeFromDropdown(DeliveryType); if (deliveryType == DeliveryOptionType.Unknown) { (this.Page.Master as MasterPages.OrderingMaster).Status.AddMessage(PlatformResources.GetGlobalResourceString("ErrorMessage", "CantVisitWithNoDeliveryInfo")); Session["CantSaveCart"] = true; retValue = false; } else if (DropdownNickName != null) { int selectedValue = 0; int.TryParse(DropdownNickName.SelectedValue, out selectedValue); if (selectedValue < 1) { if (deliveryType == DeliveryOptionType.Pickup || deliveryType == DeliveryOptionType.PickupFromCourier) { (this.Page.Master as MasterPages.OrderingMaster).Status.AddMessage(PlatformResources.GetGlobalResourceString("ErrorMessage", "PickUpLocationNotSelected")); } else { (this.Page.Master as MasterPages.OrderingMaster).Status.AddMessage(PlatformResources.GetGlobalResourceString("ErrorMessage", "ShippingNickNameNotPopulated")); } Session["CantSaveCart"] = true; retValue = false; } } return(retValue); }
private void USFieldValidation(List <string> _errors) { //if ((_shippingAddr.Address.Line1 != null) && (!_shippingAddr.Address.Line1.Equals(string.Empty))) //{ // if (!StreetAddressRegularExpressionCheck(_shippingAddr.Address.Line1)) // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress")); //} //31554: All textbox allow these special characters (,) (-) (‘) (.) (/) and (\) if (!string.IsNullOrEmpty(_shippingAddr.Address.City)) { if (!Regex.IsMatch(_shippingAddr.Address.City, @"(^[\w\s\/,-.'\\]+$)")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidCity")); } } if (!string.IsNullOrEmpty(_shippingAddr.Address.PostalCode)) { if (!Regex.IsMatch(_shippingAddr.Address.PostalCode.Trim(), @"(^\d{4}$)|(^\d{4}-\d{4}$)|(^\d{4}\s\d{4}$)|(^\d{5}$)|(^\d{5}-\d{4}$)|(^\d{5}\s\d{4}$)")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode")); } } }
private ShoppingCartRuleResult CheckQualifiedEventSkus(ShoppingCart_V01 shoppingCart, ShoppingCartRuleResult ruleResult) { if (shoppingCart != null) { List <string> ConfigSKUList = HLConfigManager.Configurations.DOConfiguration.SkuForCurrentEvent.Split(',').ToList(); var SKUList = GetExtravaganza2017Skus(); if (SKUList != null && ConfigSKUList != null) { SKUList.AddRange(from s in ConfigSKUList where !SKUList.Contains(s) select s); } var cart = shoppingCart as MyHLShoppingCart; if (SKUList.Any() && SKUList.Contains(cart.CurrentItems[0].SKU)) { bool memberWithTicket; var memberQualified = DistributorOrderingProfileProvider.IsEventQualified(EventId, Locale, out memberWithTicket); if (!memberQualified) { var message = "SKUNotAvailableForNonQualified"; var globalResourceObject = PlatformResources.GetGlobalResourceString("ErrorMessage", message); if (!string.IsNullOrEmpty(globalResourceObject)) { message = string.Format(globalResourceObject.ToString(), cart.CurrentItems[0].SKU); } ruleResult.AddMessage(message); ruleResult.Result = RulesResult.Failure; } } } return(ruleResult); }
public override void LoadPage() { tbCountry.Text = @"Netherland"; if (_shippingAddr != null && _shippingProvider != null) { Recipient = _shippingAddr.Recipient; StreetAddress = _shippingAddr.Address.Line1; StreetAddress2 = _shippingAddr.Address.Line2; City = _shippingAddr.Address.City; ZipCode = _shippingAddr.Address.PostalCode; PhoneNumber = _shippingAddr.Phone; tbNombre.Focus(); } cvNombreRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCareOfName"); cvAddressRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoStreet1"); cvAddressRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress"); cvHouseNumberRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoStreet2"); cvHouseNumberRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress2"); cvCity.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCity"); cvPostalCode.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoZipCode"); cvPostalCodeRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode"); cvPhoneNumberRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPhone"); cvPhoneNumberRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone"); }
public override void ValidationCheck(List <string> _errors) { //31695: GDO:All:ShippingAddress:All:Special Characters not respecting the BRD //if ((_shippingAddr.Recipient != null) && (!_shippingAddr.Recipient.Equals(string.Empty))) //{ // if (!System.Text.RegularExpressions.Regex.IsMatch(_shippingAddr.Recipient, // @"(^[a-zA-Z\/,\s-.'\\]+$)")) // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidRecipentName")); //} //if ((_shippingAddr.Address.Line1 != null) && (!_shippingAddr.Address.Line1.Equals(string.Empty))) //{ // if (!StreetAddressRegularExpressionCheck(_shippingAddr.Address.Line1)) // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress")); //} if (!string.IsNullOrEmpty(_shippingAddr.Phone)) { if (!Regex.IsMatch(_shippingAddr.Phone, @"^(\d{9,12})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } } }
public override void ValidationCheck(List <string> _errors) { if (!string.IsNullOrEmpty(Recipient) && (Recipient.Trim().Length < 1 || Recipient.Trim().Length > 40)) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidRecipentName")); } if (!string.IsNullOrEmpty(StreetAddress) && (StreetAddress.Trim().Length < 1 || StreetAddress.Trim().Length > 40)) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress")); } if (!string.IsNullOrEmpty(City) && (City.Trim().Length < 1 || City.Trim().Length > 20)) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidCity")); } if (!string.IsNullOrEmpty(ZipCode)) { if (!System.Text.RegularExpressions.Regex.IsMatch(ZipCode, @"^(\d{5})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode")); } } if (!string.IsNullOrEmpty(PhoneNumber)) { if (!System.Text.RegularExpressions.Regex.IsMatch(_shippingAddr.Phone, @"^(\d{10,12})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } } }
public override void ValidationCheck(List <string> _errors) { Action <string> addErrMsg = (itemName) => _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", itemName)); if (!string.IsNullOrEmpty(Recipient) && (Recipient.Trim().Length < 2 || Recipient.Trim().Length > 40)) { addErrMsg("InvalidRecipentName"); } if (!string.IsNullOrEmpty(StreetAddress) && (StreetAddress.Trim().Length < 1 || StreetAddress.Trim().Length > 40)) { addErrMsg("InvalidStreetAddress"); } if (!string.IsNullOrEmpty(PhoneNumber) && !Regex.IsMatch(_shippingAddr.Phone, @"^(\d{8,12})$")) { addErrMsg("InvalidPhone"); } if (!string.IsNullOrWhiteSpace(ZipCode) && !Regex.IsMatch(ZipCode, @"\d{5}")) { addErrMsg("InvalidZipCode"); } }
public override void LoadPage() { tbPhoneNumber.MaxLength = Thread.CurrentThread.CurrentCulture.Name.Equals("fr-BE") ? 11 : 10; tbCountry.Text = @"Belgium"; if (_shippingAddr != null && _shippingProvider != null) { Recipient = _shippingAddr.Recipient; StreetAddress = _shippingAddr.Address.Line1; StreetAddress2 = _shippingAddr.Address.Line2; if (_shippingAddr.Address != null) { LoadCitiesForZipCode(_shippingAddr.Address.PostalCode); } City = _shippingAddr.Address.City; ZipCode = _shippingAddr.Address.PostalCode; PhoneNumber = _shippingAddr.Phone; tbNombre.Focus(); } cvNombreRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCareOfName"); cvAddressRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoStreet1"); cvHouseNumberRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoStreet2"); cvHouseNumberRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress2"); cvCity.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCity"); cvPostalCode.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoZipCode"); cvPostalCodeRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode"); cvPhoneNumberRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPhone"); cvPhoneNumberRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone"); }
private void UpdateViewChanges(int selected) { var pickupLocationId = GetSelected(selected); if (pickupLocationId < 0) { lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPickUpLocation"); return; } bool isPrimary = cbMakePrimary.Checked; bool isSession = !HLConfigManager.Configurations.CheckoutConfiguration.SavePickupFromCourierPreferences; string nickName = ViewState["DisplayName"] as string ?? string.Empty; string branchName = ViewState["BranchName"] as string ?? string.Empty; int returnId = ProductsBase.GetShippingProvider() .SavePickupLocationsPreferences(DistributorID, isSession, pickupLocationId, nickName, nickName, CountryCode, isPrimary, branchName); if (returnId == -2) //duplicate nickname { lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "DuplicateAddressNickname"); return; } if (returnId == -3) //duplicate pickuplocation { lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "DuplicatePickupLocation"); return; } OnPickupPreferenceCreated(this, new DeliveryOptionEventArgs(returnId, branchName)); }
public override void ValidationCheck(List <string> _errors) { if (!string.IsNullOrEmpty(_shippingAddr.Phone)) { if (!Regex.IsMatch(_shippingAddr.Phone, @"^(\d{6,10})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } } //Adding validation for special characters not allow in address1 and address2 if (!string.IsNullOrEmpty(_shippingAddr.Address.Line1)) { if (!Regex.IsMatch(_shippingAddr.Address.Line1, @"^([a-zA-Z0-9\s]*)$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress")); } } if (!string.IsNullOrEmpty(_shippingAddr.Address.Line2)) { if (!Regex.IsMatch(_shippingAddr.Address.Line2, @"^([a-zA-Z0-9\s]*)$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress2")); } } }
private OrderTotals_V01 GetTotals() { var totals = new OrderTotals_V01(); var cart = (Page as ProductsBase).ShoppingCart; if (null != cart) { if (null != cart.Totals) { totals.AmountDue = (cart.Totals as OrderTotals_V01).AmountDue; } } //totals.AmountDue = 3566M; if (HLConfigManager.Configurations.CheckoutConfiguration.ConvertAmountDue) { decimal amountDue = OrderProvider.GetConvertedAmount((cart.Totals as OrderTotals_V01).AmountDue, (Page as ProductsBase).CountryCode); if (amountDue == 0.0M) { LoggerHelper.Error("Exception while getting the currency conversion - "); lblErrorMessages.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "CurrencyConversionFailed"); lblErrorMessages.Visible = true; return(totals); } totals.AmountDue = amountDue; } return(totals); }
protected bool checkTotals(List <Payment> currentPayments, bool showErrors) { bool isValid = true; decimal total = (from c in currentPayments select c.Amount).Sum(); var orderTotals = GetTotals(); if (Convert.ToDecimal(total.ToString("0.00")) != Convert.ToDecimal(orderTotals.AmountDue.ToString("0.00"))) { isValid = false; if (total > 0) { if (showErrors) { lblErrorMessages.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "TotalNotMatch"); } totalAmountBalance.Text = DisplayAsCurrency(orderTotals.AmountDue - total, false); } else { if (showErrors) { lblErrorMessages.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPaymentInfo"); } } } return(isValid); }
public override void ValidationCheck(List <string> _errors) { //31695: GDO:All:ShippingAddress:All:Special Characters not respecting the BRD //if ((_shippingAddr.Recipient != null) && (!_shippingAddr.Recipient.Equals(string.Empty))) //{ // if (!System.Text.RegularExpressions.Regex.IsMatch(_shippingAddr.Recipient, // @"^[\w\s\/,-.'\\]+$")) // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidRecipentName")); //} //if ((_shippingAddr.Address.Line1 != null) && (!_shippingAddr.Address.Line1.Equals(string.Empty))) //{ // //if (!StreetAddressRegularExpressionCheck(_shippingAddr.Address.Line1)) // // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress); // if (!System.Text.RegularExpressions.Regex.IsMatch(_shippingAddr.Address.Line1, // @"^[\w\s\/,-.'\\]+$")) // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidStreetAddress2")); //} //if ((_shippingAddr.Address.StateProvinceTerritory != null) && (!_shippingAddr.Address.StateProvinceTerritory.Equals(string.Empty))) //{ // if (!System.Text.RegularExpressions.Regex.IsMatch(_shippingAddr.Address.StateProvinceTerritory, // @"(^[\w\s\/,-.'\\]+$)")) // _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidState); //} if (!Regex.IsMatch(_shippingAddr.Address.PostalCode, @"^(\d{5})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode")); } if (!Regex.IsMatch(_shippingAddr.Phone, @"^(\d{9})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } }
public override void ValidationCheck(List <string> _errors) { if (!string.IsNullOrEmpty(_shippingAddr.Phone)) { string[] numbers = _shippingAddr.Phone.Split('-'); if (numbers[0].Length == 0) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "NoAreaCode")); } else if (!Regex.IsMatch(numbers[0], @"^(\d{2,3})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidAreaCode")); } if (!Regex.IsMatch(numbers[1], @"^(\d{6,8})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } if (numbers[0].Length + numbers[1].Length > 11) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } } }
public override void ValidationCheck(List <string> _errors) { //if (!System.Text.RegularExpressions.Regex.IsMatch(_shippingAddr.Phone, @"^(\d{12})|(\d{2}[ |-]\d{9})|(\d{3}[ |-]\d{8})|(\d{4}[ |-]\d{7})|(\d{5}[ |-]\d{6})$")) if (!Regex.IsMatch(_shippingAddr.Phone, @"^(\d{9,12})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } }
/// <summary> /// Validates the control. /// </summary> /// <param name="_errors">List of errors.</param> public override void ValidationCheck(List <string> _errors) { if (!string.IsNullOrEmpty(_shippingAddr.Phone) && !Regex.IsMatch(_shippingAddr.Phone, @"^(\d{11,12})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } }
public override void LoadPage() { dnlState.SelectedIndex = dnlCity.SelectedIndex = -1; dnlCity.Enabled = false; tbCountryCode.Text = "63"; tbCountryCode.ReadOnly = true; tbCountryCode.Enabled = false; if (_shippingProvider != null) { if (dnlState.Items.Count == 0 && _shippingProviderBase != null) { dnlState.DataSource = _shippingProviderBase.GetStatesForCountry("PH"); dnlState.DataBind(); dnlState.Items.Insert(0, new ListItem(base.GetLocalResourceObject("Select") as string, string.Empty)); dnlState.SelectedIndex = 0; } } if (_shippingAddr != null && _shippingProvider != null) { Recipient = _shippingAddr.Recipient; StreetAddress = _shippingAddr.Address.Line1; StreetAddress2 = _shippingAddr.Address.Line2; ListItem item = dnlState.Items.FindByText(_shippingAddr.Address.StateProvinceTerritory); if (item != null) { dnlState.SelectedIndex = -1; item.Selected = true; dnlCity.DataSource = _shippingProvider.GetCitiesForState("PH", item.Text); dnlCity.DataBind(); item = dnlCity.Items.FindByText(_shippingAddr.Address.City); if (item != null) { dnlCity.SelectedIndex = -1; item.Selected = true; dnlCity.Enabled = true; } } ZipCode = _shippingAddr.Address.PostalCode; PhoneNumber = _shippingAddr.Phone; AreaCode = _shippingAddr.AreaCode; tbNombre.Focus(); cvNombreRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCareOfName"); cvNombreRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidRecipentName"); cvAddressRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoStreet1"); cvAddress2Required.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoStreet2"); cvStateRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoState"); cvCity.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCity"); cvPostalCode.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoZipCode"); cvAreaCodeRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoAreaCode"); cvAreaCodeRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidAreaCode"); //cvPhoneNumberRequired.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPhone"); //cvPhoneNumberRegex.ErrorMessage = PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone"); } }
//protected override bool hasNoPreference() //{ // IShippingProvider ShippingProvider = ProductsBase.GetShippingProvider(); // List<HL.Shipping.ValueObjects.PickupLocationPreference_V01> pickupRrefList = // ShippingProvider.GetPickupLocationsPreferences(DistributorID, CountryCode); // List<DeliveryOption> shippingAddresses = // ShippingProvider.GetShippingAddresses(DistributorID, Locale); // return (pickupRrefList == null || pickupRrefList.Count == 0) && // (shippingAddresses == null || shippingAddresses.Count == 0); //} private bool CheckDSCantBuyStatus() { if ((Page as ProductsBase).CantBuy || (Page as ProductsBase).Deleted) { errDRFraud.Visible = true; errDRFraud.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "CantOrder"); return(false); } return(true); }
public override void ValidationCheck(List <string> _errors) { if (!string.IsNullOrEmpty(PhoneNumber)) { if (!Regex.IsMatch(PhoneNumber, @"^(\d{8,10})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } } }
private void CheckHAPOptions() { if (HLConfigManager.Configurations.DOConfiguration.AllowHAP && SessionInfo.IsHAPMode && ShoppingCart.OrderCategory == OrderCategoryType.HSO) { if (ShoppingCart.HAPScheduleDay == 0) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "MissingHapDate")); } } }
protected void ContinueChanges_Clicked(object sender, EventArgs e) { if ((this.ViewState["SelectedPickupLocation"] == null) || this.ViewState["SelectedPickupLocation"].ToString().Equals("0")) { this.lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoPickUpLocation"); return; } UpdateViewChanges(); }
private void RenderDeletePickupView() { bool isXML = true; this.divAddPickUp.Visible = false; this.divDeletePickUp.Visible = true; this.btnContinue.Text = GetLocalResourceObject("btnContinueDelete") as string; ShippingAddress_V01 shipAddr = new ShippingAddress_V01(); shipAddr.Address = new Address_V01(); shipAddr.Address.Country = CountryCode; var deliveryOptionList = (this.Page as ProductsBase).GetShippingProvider(). GetDeliveryOptions(DeliveryOptionType.Pickup, shipAddr); DeliveryOption pickupDeliveryOption = deliveryOptionList.Find(p => p.Id == this.WorkedUponDeliveryOptionId); this.lblName.Text = pickupDeliveryOption.Description; string controlPath = getDeleteAddressControlPath(ref isXML); AddressBase addressBase = new AddressControl(); addressBase.XMLFile = controlPath; this.colDeletePickUp.Controls.Add((Control)addressBase); addressBase.DataContext = pickupDeliveryOption; var pickUpLocationPreferences = (this.Page as ProductsBase).GetShippingProvider(). GetPickupLocationsPreferences( (this.Page as ProductsBase).DistributorID, CountryCode); PickupLocationPreference_V01 selectedPickupPreference = pickUpLocationPreferences.Find (p => p.PickupLocationID == this.WorkedUponDeliveryOptionId); if (selectedPickupPreference != null) { this.lblDeleteIsPrimaryText.Text = selectedPickupPreference.IsPrimary ? GetLocalResourceObject("PrimaryYes.Text") as string : GetLocalResourceObject("PrimaryNo.Text") as string; this.lblDeleteNicknameText.Text = selectedPickupPreference.PickupLocationNickname; if (selectedPickupPreference.IsPrimary) //Eval UC:3.5.3.7 (deleting primary) { this.lblErrors.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "PrimaryPickupPreferenceDeleteNotAllowed"); this.btnContinue.Enabled = false; return; } else //Eval UC:3.5.3.6 (deleting non-primary) { this.btnContinue.Enabled = true; } } }
public override void ValidationCheck(List <string> _errors) { Func <string, string> getErrMsg = (itemName) => PlatformResources.GetGlobalResourceString("ErrorMessage", itemName); if (!string.IsNullOrEmpty(PhoneNumber) && !Regex.IsMatch(_shippingAddr.Phone, @"^(\d{7,8})$")) { _errors.Add(getErrMsg("InvalidPhone")); } }
public void OnQuoteError(object sender, EventArgs e) { var msg = PlatformResources.GetGlobalResourceString("ErrorMessage", "PricingError"); if (string.IsNullOrEmpty(msg)) { msg = PlatformResources.GetGlobalResourceString("ErrorMessage", "UnableToPrice"); } StatusDisplay.AddMessage(msg); }
public override void ValidationCheck(List <string> _errors) { if (!string.IsNullOrEmpty(_shippingAddr.Address.PostalCode)) { if (!Regex.IsMatch(_shippingAddr.Address.PostalCode, @"^(\d{6})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidZipCode")); } } if (!string.IsNullOrEmpty(_shippingAddr.Phone)) { string[] numbers = _shippingAddr.Phone.Split('-'); if (!Regex.IsMatch(numbers[0], @"^(\d{1,5})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidAreaCode")); } if (!Regex.IsMatch(numbers[1], @"^(\d{8,10})$")) { _errors.Add(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidPhone")); } if (numbers.Length.Equals(3)) { if (!string.IsNullOrEmpty(numbers[2])) { if (!Regex.IsMatch(numbers[2], @"^(\d{0,5})$")) { if ( _errors.Contains(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidExtension"))) { _errors.Remove(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidExtension")); _errors.Add(GetLocalResourceObject("InvalidExtension") as string); } } } } if (_errors.Contains(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidExtension"))) { _errors.Remove(PlatformResources.GetGlobalResourceString("ErrorMessage", "InvalidExtension")); _errors.Add(GetLocalResourceObject("InvalidExtension") as string); } } }
public override string FormatShippingAddress(ShippingAddress_V01 address, DeliveryOptionType type, string description, bool includeName) { if (null == address || address.Address == null) { return(string.Empty); } string formattedAddress = string.Empty; if (type == DeliveryOptionType.Shipping) { formattedAddress = includeName ? string.Format("{0}<br/>{1},{2}<br/>{3}<br/>{4}, {5}, {6}<br/>{7}", address.Recipient ?? string.Empty, address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.Line3 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory, address.Address.PostalCode, formatPhone(address.Phone)) : string.Format("{0},{1}<br/>{2}<br/>{3}, {4}, {5}<br/>{6}", address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.Line3 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory, address.Address.PostalCode, formatPhone(address.Phone)); } else if (type == DeliveryOptionType.PickupFromCourier) { string message = HttpContext.GetGlobalResourceObject("MYHL_Rules", "ViewMap").ToString(); string gAddress = string.Format("{0}+{1}+{2}+{3}+{4}", address.Address.Line1.Replace(" ", "+"), address.Address.Line2.Replace(" ", "+"), address.Address.City.Replace(" ", "+"), address.Address.StateProvinceTerritory.Replace(" ", "+"), address.Address.PostalCode.Replace(" ", "+")); formattedAddress = string.Format("{0}<br/>{1}, {2}<br/>{3} {4}<br/>{5}", address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory, address.Address.PostalCode, PlatformResources.GetGlobalResourceString("GlobalResources", "CountryName")); } else { formattedAddress = string.Format("{0}<br>{1},{2}<br>{3}, {4}, {5}", address.Address.Line1, address.Address.Line2 ?? string.Empty, address.Address.City, address.Address.StateProvinceTerritory, address.Address.CountyDistrict, address.Address.PostalCode); } if (formattedAddress.IndexOf(",,") > -1 || formattedAddress.IndexOf(", ,") > -1) { return(formattedAddress.Replace(",,,", ",").Replace(", , ,", ",").Replace(",,", ",").Replace(", ,", ",")); } else { return(formattedAddress); } }
/// <summary> /// process payment information /// </summary> private void processPaymentInformation() { if (HLConfigManager.Configurations.PaymentsConfiguration.AllowSavedCards) { mpPaymentInformation = (ModalPopupExtender)ucPaymentInfoControl.FindControl("ppPaymentInfoControl"); if (getPrimaryPaymentInformationList() == null || paymentInformations.Count() == 0) { if (HLConfigManager.Configurations.PaymentsConfiguration.UseCardRegistry) { // pre defect 23720 don't show it and an error is thrown when click on visible link dvViewAllPaymentInformation.Visible = false; lblPrimaryPaymentInformation.Text = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoCard"); dvNonPrimaryPaymentInformation.Visible = false; } else { dvViewAllPaymentInformation.Visible = false; dvNonPrimaryPaymentInformation.Visible = true; } } else { dvViewAllPaymentInformation.Visible = true; lbtViewAllPaymentInformation.PostBackUrl = "/Ordering/SavedPaymentInformation.aspx"; if ( (primaryPaymentInformation = paymentInformations.Where(s => s.IsPrimary && !s.IsTemporary).FirstOrDefault()) == null) { dvPrimaryPaymentInformation.Visible = false; dvNonPrimaryPaymentInformation.Visible = true; } else { int cardNumberLength = primaryPaymentInformation.CardNumber.Length; lblPrimaryPaymentInformation.Text = primaryPaymentInformation.CardHolder.First + " " + primaryPaymentInformation.CardHolder.Middle + " " + primaryPaymentInformation.CardHolder.Last + "<br /> " + getCardName(primaryPaymentInformation.CardType) + "<br /> " + primaryPaymentInformation.CardNumber.Substring( primaryPaymentInformation.CardNumber.Length - 4, 4) + "<br /> " + primaryPaymentInformation.Expiration.ToString("MM-yyyy"); dvPrimaryPaymentInformation.Visible = true; dvNonPrimaryPaymentInformation.Visible = false; } } } }
protected void OnNickNameChanged(object sender, EventArgs e) { if (ShoppingCart != null && DeliveryType.SelectedValue != null && DeliveryType.SelectedValue != "0") { handleNicknameChanged(DeliveryType, DropdownNickName, pAddress); } if (HLConfigManager.Configurations.CheckoutConfiguration.ErrorNoDeliveryOption && ShoppingCart.DeliveryInfo == null) { string message = PlatformResources.GetGlobalResourceString("ErrorMessage", "NoDeliveryOption"); (ProductsBase.Master as OrderingMaster).Status.AddMessage(message); } }