/// <summary> /// Edits the UPS international shipping method. /// </summary> //[TestMethod] //[Priority(28)] public void EditSM_UPSInternational() { #region Arrange var smethod0 = new ShippingMethod(); var store = _application.CurrentStore; var setting = _irepo.GetEditSMInfo_UPS_Internation(ref store, ref smethod0); var smethod1 = _application.OrderServices.ShippingMethods.FindAll(_application.CurrentStore.Id) .FirstOrDefault(x => x.ShippingProviderId.Equals(GetShippingProviderId(smethod0.ShippingProviderId))); smethod1.Name = smethod0.Name; smethod1.ZoneId = smethod0.ZoneId; var settings = new UPSServiceSettings(); settings.Merge(smethod1.Settings); var servicecodes = AvailableServices.FindById(GetShippingProviderId(smethod0.ShippingProviderId), _application.CurrentStore).ListAllServiceCodes(); foreach (var scode in setting.ServiceCodeFilter.Select(filter => servicecodes.FirstOrDefault(x => x.DisplayName.Equals(filter.DisplayName)))) { settings.ServiceCodeFilter.Add(scode); } smethod1.Settings.Merge(settings); #endregion //Act/Assert Assert.IsTrue(_application.OrderServices.ShippingMethods.Update(smethod1)); }
private void LoadShippingMethodEditor(ShippingMethod shippingMethod) { var p = AvailableServices.FindById(shippingMethod.ShippingProviderId, HccApp.CurrentStore); var editor = (HccShippingPart)HccPartController.LoadShippingEditor(p.Name, Page); if (editor != null) { ClearEditorsInfo(); if (string.IsNullOrEmpty(shippingMethod.Bvin)) { NewShippingMethod = shippingMethod; } else { EditedShippingMethodId = shippingMethod.Bvin; } editor.ShippingMethod = shippingMethod; editor.ID = string.Format("ShippingMethod_{0}_{1}", shippingMethod.ShippingProviderId, shippingMethod.Bvin); editor.EditingComplete += ShippingMethodEditor_EditingComplete; AddCloseDialogScript(editor); phrEditor.Controls.Add(editor); } }
/// <summary> /// Adds the UPS international shipping method. /// </summary> //[TestMethod] //[Priority(27)] public void AddSM_UPSInternational() { #region Arrange var smethod0 = new ShippingMethod(); var store = _application.CurrentStore; var setting = _irepo.GetAddSMInfo_UPS_Internation(ref store, ref smethod0); var spproviderid = GetShippingProviderId(smethod0.ShippingProviderId); var smethod1 = new ShippingMethod { Name = smethod0.Name, StoreId = _application.CurrentStore.Id, ZoneId = smethod0.ZoneId, AdjustmentType = ShippingMethodAdjustmentType.Amount, Adjustment = 0, ShippingProviderId = spproviderid, }; var settings = new UPSServiceSettings(); settings.Merge(smethod1.Settings); var servicecodes = AvailableServices.FindById(GetShippingProviderId(smethod0.ShippingProviderId), _application.CurrentStore).ListAllServiceCodes(); foreach (var scode in setting.ServiceCodeFilter.Select(filter => servicecodes.FirstOrDefault(x => x.DisplayName.Equals(filter.DisplayName)))) { settings.ServiceCodeFilter.Add(scode); } smethod1.Settings.Merge(settings); #endregion //Act/Assert Assert.IsTrue(_application.OrderServices.ShippingMethods.Create(smethod1)); }
private void LoadServiceCodes() { MerchantTribe.Shipping.IShippingService uspostal = AvailableServices.FindById(ShippingMethod.ShippingProviderId, CurrentStore); this.ShippingTypesCheckBoxList.DataSource = uspostal.ListAllServiceCodes(); this.ShippingTypesCheckBoxList.DataTextField = "DisplayName"; this.ShippingTypesCheckBoxList.DataValueField = "Code"; this.ShippingTypesCheckBoxList.DataBind(); }
private void LoadServices() { MerchantTribe.Shipping.IShippingService uspostal = AvailableServices.FindById(WebAppSettings.ShippingUSPostalDomesticId, MTApp.CurrentStore); this.lstServiceTypes.DataSource = uspostal.ListAllServiceCodes(); this.lstServiceTypes.DataTextField = "DisplayName"; this.lstServiceTypes.DataValueField = "Code"; this.lstServiceTypes.DataBind(); }
private void LoadServiceCodes() { var ups = AvailableServices.FindById(ShippingMethod.ShippingProviderId, HccApp.CurrentStore); ShippingTypesCheckBoxList.DataSource = ups.ListAllServiceCodes(); ShippingTypesCheckBoxList.DataTextField = "DisplayName"; ShippingTypesCheckBoxList.DataValueField = "Code"; ShippingTypesCheckBoxList.DataBind(); }
private void LoadServices() { var uspostal = AvailableServices.FindById(DomesticProvider.ServiceId, HccApp.CurrentStore); lstServiceTypes.DataSource = uspostal.ListAllServiceCodes(); lstServiceTypes.DataTextField = "DisplayName"; lstServiceTypes.DataValueField = "Code"; lstServiceTypes.DataBind(); }
private void PopulateLists() { var provider = AvailableServices.FindById(ShippingMethod.ShippingProviderId, HccApp.CurrentStore); if (provider != null) { var codes = provider.ListAllServiceCodes(); lstServiceCode.Items.Clear(); foreach (var code in codes) { lstServiceCode.Items.Add(new ListItem(code.DisplayName, code.Code)); lstServicesTest.Items.Add(new ListItem(code.DisplayName, code.Code)); } } }
private void LoadServiceCodes() { ShippingTypesRadioButtonList.Items.Clear(); var ups = AvailableServices.FindById(ShippingMethod.ShippingProviderId, HccApp.CurrentStore); ShippingTypesRadioButtonList.DataSource = ups.ListAllServiceCodes(); ShippingTypesRadioButtonList.DataTextField = "DisplayName"; ShippingTypesRadioButtonList.DataValueField = "Code"; ShippingTypesRadioButtonList.DataBind(); if (IsNew || ShippingTypesRadioButtonList.SelectedIndex == -1) { ShippingTypesRadioButtonList.Items[0].Selected = true; } }
private void LoadEditor() { var p = AvailableServices.FindById(m.ShippingProviderId, HccApp.CurrentStore); var editor = HccPartController.LoadShippingEditor(p.Name, this) as HccShippingPart; if (editor != null) { editor.ShippingMethod = m; phEditor.Controls.Add(editor); editor.EditingComplete += editor_EditingComplete; } else { phEditor.Controls.Add(new LiteralControl(Localization.GetString("EditorLoadError"))); } }
public void UPS_DomesticTestRate() { #region Arrange var shipment = _irepo.GetTestRate_UPS_DomesticShipment(); var item = _irepo.GetTestRate_UPS_DomesticShippableInfo(); shipment.Items.Add(item); var globalSettings = new USPostalServiceGlobalSettings { UserId = _application.CurrentStore.Settings.ShippingUSPostalUserId, DiagnosticsMode = true, IgnoreDimensions = false }; var settings = _irepo.GetTestRate_UPS_DomesticServiceSetting(); var servicecodes = AvailableServices.FindById(GetShippingProviderId("US Postal Service - Domestic"), _application.CurrentStore).ListAllServiceCodes(); var displayname = settings.ServiceCodeFilter.FirstOrDefault().DisplayName; var code = servicecodes.FirstOrDefault(x => x.DisplayName.Equals(displayname)); settings.ServiceCodeFilter = new List <IServiceCode> { code }; var provider = new DomesticProvider(globalSettings, new Web.Logging.TextLogger()) { Settings = settings }; #endregion //Act var rates = provider.RateShipment(shipment); //Assert if (rates == null) { Assert.AreEqual(1, 0); } else { Assert.AreEqual(25, rates.FirstOrDefault().EstimatedCost); } }
private void ShippingProviderServices() { var selectedValue = lstTrackingProvider.SelectedValue; var services = new List <IServiceCode>(); if (!string.IsNullOrEmpty(selectedValue)) { var shippingMethod = HccApp.OrderServices.ShippingMethods.Find(selectedValue); var provider = AvailableServices.FindById(shippingMethod.ShippingProviderId, HccApp.CurrentStore); services = provider.ListAllServiceCodes(); } if (services != null && services.Any()) { var removeItem = services.FirstOrDefault(x => x.DisplayName == "All Available Services"); if (removeItem != null) { services.Remove(removeItem); } } if (services != null && services.Any()) { lstTrackingProviderServices.ClearSelection(); lblShippingServices.Visible = true; lstTrackingProviderServices.Visible = true; lstTrackingProviderServices.DataSource = services; lstTrackingProviderServices.DataTextField = "DisplayName"; lstTrackingProviderServices.DataValueField = "Code"; lstTrackingProviderServices.DataBind(); } else { lstTrackingProviderServices.Items.Clear(); lstTrackingProviderServices.Visible = false; lblShippingServices.Visible = false; } }
protected void PackagesGridView_RowDataBound(object sender, GridViewRowEventArgs e) { var p = (OrderPackage)e.Row.DataItem; if (p != null) { var provider = AvailableServices.FindById(p.ShippingProviderId, HccApp.CurrentStore); var ShippedByField = (Label)e.Row.FindControl("ShippedByField"); if (ShippedByField != null) { if (provider != null) { var codes = provider.ListAllServiceCodes(); var serviceCode = codes.FirstOrDefault(c => c.Code == p.ShippingProviderServiceCode); if (serviceCode != null) { ShippedByField.Text = serviceCode.DisplayName; } else { ShippedByField.Text = provider.Name; } } } var TrackingLink = (HyperLink)e.Row.FindControl("TrackingLink"); var TrackingText = (Label)e.Row.FindControl("TrackingText"); if (TrackingLink != null) { TrackingLink.Text = p.TrackingNumber; TrackingText.Text = p.TrackingNumber; if (provider != null) { if (provider.IsSupportsTracking) { TrackingLink.NavigateUrl = provider.GetTrackingUrl(p.TrackingNumber); TrackingLink.Visible = true; TrackingText.Visible = false; } else { TrackingLink.Visible = false; TrackingText.Visible = true; } } else { TrackingLink.Visible = false; TrackingText.Visible = false; } } var TrackingTextBox = (TextBox)e.Row.FindControl("TrackingNumberTextBox"); if (TrackingTextBox != null) { TrackingTextBox.Text = p.TrackingNumber; } var items = (Label)e.Row.FindControl("items"); if (items != null) { items.Text = string.Empty; foreach (var pi in p.Items) { if (pi.Quantity > 0) { items.Text += pi.Quantity.ToString("#") + " - "; foreach (var li in CurrentOrder.Items) { if (li.Id == pi.LineItemId) { items.Text += li.ProductSku + ": " + li.ProductName + "<br />"; } } } } } } }