Imports BVSoftware.BVC.Core Imports BVSoftware.BVC.Interfaces Imports System.Globalization Public Class configuration_shipping_edit Inherits BaseAdminPage Protected WithEvents inName As System.Web.UI.WebControls.TextBox Protected WithEvents lblName As System.Web.UI.WebControls.Label Protected WithEvents btnCancel As System.Web.UI.WebControls.ImageButton Protected WithEvents btnSave As System.Web.UI.WebControls.ImageButton Protected WithEvents inCountries As System.Web.UI.WebControls.ListBox Protected WithEvents btnAddCountry As System.Web.UI.WebControls.ImageButton Protected WithEvents btnDelCountry As System.Web.UI.WebControls.ImageButton Protected WithEvents inNOTCountries As System.Web.UI.WebControls.ListBox Protected WithEvents MetaDescriptionControl As BVSoftware.WebControls.MetaTag Protected WithEvents MetaKeywordsControl As BVSoftware.WebControls.MetaTag Protected WithEvents inRegions As System.Web.UI.WebControls.ListBox Protected WithEvents btnAddRegion As System.Web.UI.WebControls.ImageButton Protected WithEvents btnDelRegion As System.Web.UI.WebControls.ImageButton Protected WithEvents inNOTRegions As System.Web.UI.WebControls.ListBox Protected WithEvents SelectTypeButton As System.Web.UI.WebControls.ImageButton Protected WithEvents lstType As BVSoftware.WebControls.SelectDropDownList Protected WithEvents AddNewLevelButton As System.Web.UI.WebControls.ImageButton Protected WithEvents dgLevels As System.Web.UI.WebControls.DataGrid Protected WithEvents msg As BVSoftware.WebControls.WebPageMessage Protected WithEvents AdjustmentField As System.Web.UI.WebControls.TextBox Protected WithEvents AdjustmentTypeField As BVSoftware.WebControls.SelectDropDownList Protected WithEvents LevelsPanel As System.Web.UI.WebControls.Panel #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load BVC2004Store.CheckThisPage(Security.RolePermission.LoginToAdmin) BVC2004Store.CheckThisPage(Security.RolePermission.AccessSettingsArea) If Not Page.IsPostBack Then MetaKeywordsControl.Content = WebAppSettings.MetaKeywords MetaDescriptionControl.Content = WebAppSettings.MetaDescription End If If Not Page.IsPostBack() Then Dim EditID As Integer EditID = Request.Params("id") If EditID < 1 Then msg.ShowError("No Valid ID Number found") Else ViewState("EditID") = EditID Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(EditID) = True Then inName.Text = ShipMethod.Name ' Load Settings Here PopulateMethodTypes() SetMethodType(ShipMethod.Type) CheckMethodType() 'SP2 Me.AdjustmentField.Text = ShipMethod.Adjustment Dim ci As System.Globalization.CultureInfo = System.Globalization.CultureInfo.CreateSpecificCulture(WebAppSettings.SiteCultureCode) If Not ci Is Nothing Then Me.AdjustmentTypeField.Items.Clear() Me.AdjustmentTypeField.Items.Add(New ListItem(ci.NumberFormat.CurrencySymbol, 1)) Me.AdjustmentTypeField.Items.Add(New ListItem(ci.NumberFormat.PercentSymbol, 2)) End If Me.AdjustmentTypeField.SelectByValue(ShipMethod.AdjustmentType) Else msg.ShowError("Couldn't load shipping method!") End If ShipMethod = Nothing End If LoadLevels() LoadCountries() LoadNOTCountries() LoadRegions() LoadNOTRegions() End If End Sub Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnCancel.Click Response.Redirect("configuration_shipping.aspx", True) End Sub Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click msg.Clear() Dim ShipMethod As New Shipping.ShipMethod Try If ShipMethod.Load(ViewState("EditID")) = True Then Dim TypeID As Shipping.ShippingMethodType2 TypeID = lstType.SelectedValue ShipMethod.Name = Me.inName.Text.Trim ShipMethod.Type = TypeID ShipMethod.Adjustment = Me.AdjustmentField.Text ShipMethod.AdjustmentType = Me.AdjustmentTypeField.SelectedValue If MethodValid(ShipMethod.Type) = True Then If ShipMethod.Update() = True Then Response.Redirect("configuration_shipping.aspx", True) Else msg.ShowError("Error while saving ship method!") End If End If Else msg.ShowError("Couldn't load ship method for update!") End If Catch Ex As Exception msg.ShowException(Ex) End Try ShipMethod = Nothing End Sub Public Function SaveMethodType() Dim ShipMethod As New Shipping.ShipMethod Try If ShipMethod.Load(ViewState("EditID")) = True Then Dim iTypeID As Integer = 0 iTypeID = Convert.ToInt32(lstType.SelectedItem.Value) ShipMethod.Type = lstType.SelectedItem.Value ShipMethod.Update() Else msg.ShowError("Couldn't load ship method for update!") End If Catch Ex As Exception msg.ShowException(Ex) End Try ShipMethod = Nothing End Function Private Sub btnAddCountry_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnAddCountry.Click Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then Dim li As ListItem For Each li In inNOTCountries.Items If li.Selected = True Then ShipMethod.DelCountryRestriction(li.Value) End If Next End If LoadCountries() LoadNOTCountries() LoadRegions() LoadNOTRegions() ShipMethod = Nothing End Sub Private Sub btnDelCountry_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnDelCountry.Click Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then Dim li As ListItem For Each li In inCountries.Items If li.Selected = True Then ShipMethod.AddCountryRestriction(li.Value) End If Next End If LoadCountries() LoadNOTCountries() LoadRegions() LoadNOTRegions() ShipMethod = Nothing End Sub Private Sub btnAddRegion_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnAddRegion.Click Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then Dim li As ListItem For Each li In inNOTRegions.Items If li.Selected = True Then ShipMethod.DelRegionRestriction(li.Value) End If Next End If LoadRegions() LoadNOTRegions() ShipMethod = Nothing End Sub Private Sub btnDelRegion_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnDelRegion.Click Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then Dim li As ListItem For Each li In inRegions.Items If li.Selected = True Then ShipMethod.AddRegionRestriction(li.Value) End If Next End If LoadRegions() LoadNOTRegions() ShipMethod = Nothing End Sub Sub PopulateMethodTypes() lstType.Items.Clear() lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.ByItemCount), Shipping.ShippingMethodType2.ByItemCount)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.ByPrice), Shipping.ShippingMethodType2.ByPrice)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.ByWeight), Shipping.ShippingMethodType2.ByWeight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.PerItem), Shipping.ShippingMethodType2.PerItem)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExStandardOvernight), Shipping.ShippingMethodType2.FedExStandardOvernight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExPriorityOvernight), Shipping.ShippingMethodType2.FedExPriorityOvernight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedEx2Day), Shipping.ShippingMethodType2.FedEx2Day)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExExpressSaver), Shipping.ShippingMethodType2.FedExExpressSaver)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExFirstOvernight), Shipping.ShippingMethodType2.FedExFirstOvernight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExGround), Shipping.ShippingMethodType2.FedExGround)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExGroundHomeDelivery), Shipping.ShippingMethodType2.FedExGroundHomeDelivery)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExInternationalFirst), Shipping.ShippingMethodType2.FedExInternationalFirst)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExInternationalPriority), Shipping.ShippingMethodType2.FedExInternationalPriority)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExInternationalEconomy), Shipping.ShippingMethodType2.FedExInternationalEconomy)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedEx1DayFreight), Shipping.ShippingMethodType2.FedEx1DayFreight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedEx2DayFreight), Shipping.ShippingMethodType2.FedEx2DayFreight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedEx3DayFrieght), Shipping.ShippingMethodType2.FedEx3DayFrieght)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExInternationalEconomyFreight), Shipping.ShippingMethodType2.FedExInternationalEconomyFreight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.FedExInternationalPriorityFreight), Shipping.ShippingMethodType2.FedExInternationalPriorityFreight)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPS3DaySelect), Shipping.ShippingMethodType2.UPS3DaySelect)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpeditedCanada), Shipping.ShippingMethodType2.UPSExpeditedCanada)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressCanada), Shipping.ShippingMethodType2.UPSExpressCanada)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressEurope), Shipping.ShippingMethodType2.UPSExpressEurope)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressMexico), Shipping.ShippingMethodType2.UPSExpressMexico)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressPlus), Shipping.ShippingMethodType2.UPSExpressPlus)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressSaverCanada), Shipping.ShippingMethodType2.UPSExpressSaverCanada)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressSaverEurope), Shipping.ShippingMethodType2.UPSExpressSaverEurope)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSExpressSaverUS), Shipping.ShippingMethodType2.UPSExpressSaverUS)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSGround), Shipping.ShippingMethodType2.UPSGround)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSNextDayAir), Shipping.ShippingMethodType2.UPSNextDayAir)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSNextDayAirEarlyAM), Shipping.ShippingMethodType2.UPSNextDayAirEarlyAM)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSNextDayAirSaver), Shipping.ShippingMethodType2.UPSNextDayAirSaver)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSSecondDayAir), Shipping.ShippingMethodType2.UPSSecondDayAir)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSSecondDayAirAM), Shipping.ShippingMethodType2.UPSSecondDayAirAM)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSStandard), Shipping.ShippingMethodType2.UPSStandard)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSWorldwideExpedited), Shipping.ShippingMethodType2.UPSWorldwideExpedited)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSWorldwideExpress), Shipping.ShippingMethodType2.UPSWorldwideExpress)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.UPSWorldwideExpressPlus), Shipping.ShippingMethodType2.UPSWorldwideExpressPlus)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceFirstClass), Shipping.ShippingMethodType2.USPostalServiceFirstClass)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceParcel), Shipping.ShippingMethodType2.USPostalServiceParcel)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServicePriority), Shipping.ShippingMethodType2.USPostalServicePriority)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceExpress), Shipping.ShippingMethodType2.USPostalServiceExpress)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceGlobalExpress), Shipping.ShippingMethodType2.USPostalServiceGlobalExpress)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceGlobalExpressGuaranteed), Shipping.ShippingMethodType2.USPostalServiceGlobalExpressGuaranteed)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceGlobalPriorityMail), Shipping.ShippingMethodType2.USPostalServiceGlobalPriorityMail)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceInternational), Shipping.ShippingMethodType2.USPostalServiceInternational)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceBoundPrintedMaterial), Shipping.ShippingMethodType2.USPostalServiceBoundPrintedMaterial)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceLibrary), Shipping.ShippingMethodType2.USPostalServiceLibrary)) lstType.Items.Add(New ListItem(ShippingServices.GetShippingMethodTypeName(Shipping.ShippingMethodType2.USPostalServiceMedia), Shipping.ShippingMethodType2.USPostalServiceMedia)) End Sub Sub SetMethodType(ByVal val As Integer) lstType.SelectByValue(val) CheckMethodType() End Sub Sub LoadRegions() Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then inRegions.Items.Clear() inRegions.DataSource = ShipMethod.GetRegions() inRegions.DataTextField = "name" inRegions.DataValueField = "id" inRegions.DataBind() End If ShipMethod = Nothing End Sub Sub LoadNOTRegions() Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then inNOTRegions.Items.Clear() inNOTRegions.DataSource = ShipMethod.GetNOTRegions() inNOTRegions.DataTextField = "name" inNOTRegions.DataValueField = "id" inNOTRegions.DataBind() End If ShipMethod = Nothing End Sub Sub LoadCountries() Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then inCountries.Items.Clear() inCountries.DataSource = ShipMethod.GetCountries() inCountries.DataTextField = "DisplayName" inCountries.DataValueField = "Code" inCountries.DataBind() End If ShipMethod = Nothing End Sub Sub LoadNOTCountries() Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then inNOTCountries.Items.Clear() inNOTCountries.DataSource = ShipMethod.GetNOTCountries() inNOTCountries.DataTextField = "DisplayName" inNOTCountries.DataValueField = "Code" inNOTCountries.DataBind() End If ShipMethod = Nothing End Sub Sub CheckMethodType() SaveMethodType() Me.LevelsPanel.Visible = False Dim iMethodID As Integer = 0 iMethodID = Convert.ToInt32(lstType.SelectedItem.Value) Dim typeID As BVSoftware.BVC.Interfaces.ShippingMethodType = lstType.SelectedValue Select Case typeID Case Shipping.ShippingMethodType2.ByWeight Me.LevelsPanel.Visible = True Me.dgLevels.Columns(0).HeaderText = "When weight is greater than" Me.dgLevels.Columns(1).HeaderText = "charge this amount" Case Shipping.ShippingMethodType2.ByPrice Me.LevelsPanel.Visible = True Me.dgLevels.Columns(0).HeaderText = "When order total is greater than" Me.dgLevels.Columns(1).HeaderText = "charge this amount" Case Shipping.ShippingMethodType2.ByItemCount Me.LevelsPanel.Visible = True Me.dgLevels.Columns(0).HeaderText = "When items ordered is greater than" Me.dgLevels.Columns(1).HeaderText = "charge this amount" Case Shipping.ShippingMethodType2.PerItem Me.LevelsPanel.Visible = True Me.dgLevels.Columns(0).HeaderText = "When items ordered is greater than" Me.dgLevels.Columns(1).HeaderText = "charge this amount PER ITEM" End Select End Sub Private Sub AddNewLevelButton_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles AddNewLevelButton.Click Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then ShipMethod.CreateNewLevel(0, 0) End If ShipMethod = Nothing LoadLevels() End Sub Sub LoadLevels() Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then dgLevels.DataSource = ShipMethod.GetLevels() dgLevels.DataBind() End If ShipMethod = Nothing End Sub Private Sub dgLevels_Edit(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgLevels.EditCommand dgLevels.EditItemIndex = e.Item.ItemIndex LoadLevels() End Sub Private Sub dgLevels_Cancel(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgLevels.CancelCommand dgLevels.EditItemIndex = -1 LoadLevels() End Sub Private Sub dgLevels_Update(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgLevels.UpdateCommand Dim levelID As String = dgLevels.DataKeys(e.Item.ItemIndex) Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then Dim _total As TextBox = e.Item.Cells(0).FindControl("TotalBox") Dim _charge As TextBox = e.Item.Cells(1).FindControl("ChargeBox") ShipMethod.UpdateLevel(Convert.ToInt32(levelID), Convert.ToDouble(_total.Text), Convert.ToDouble(_charge.Text)) End If ShipMethod = Nothing dgLevels.EditItemIndex = -1 LoadLevels() End Sub Private Sub dgLevels_Delete(ByVal sender As Object, ByVal e As DataGridCommandEventArgs) Handles dgLevels.DeleteCommand Dim DeleteID As String = dgLevels.DataKeys(e.Item.ItemIndex) Dim ShipMethod As New Shipping.ShipMethod If ShipMethod.Load(ViewState("EditID")) = True Then ShipMethod.DeleteLevel(Convert.ToInt32(DeleteID)) End If ShipMethod = Nothing LoadLevels() End Sub Private Sub lstType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lstType.SelectedIndexChanged CheckMethodType() End Sub Private Sub dgLevels_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgLevels.ItemDataBound If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim TotalLabel As Label Dim typeID As BVSoftware.BVC.Interfaces.ShippingMethodType typeID = lstType.SelectedValue If Not TotalLabel Is Nothing Then Select Case typeID Case Shipping.ShippingMethodType2.ByWeight TotalLabel.Text = String.Format("{0:0.00}", e.Item.DataItem("Total")) Case Shipping.ShippingMethodType2.ByPrice TotalLabel.Text = String.Format("{0:c}", e.Item.DataItem("Total")) Case Shipping.ShippingMethodType2.ByItemCount TotalLabel.Text = String.Format("{0:######0}", e.Item.DataItem("Total")) Case Shipping.ShippingMethodType2.PerItem TotalLabel.Text = String.Format("{0:######0}", e.Item.DataItem("Total")) End Select End If End If End Sub Private Function MethodValid(ByVal methodType As Shipping.ShippingMethodType2) As Boolean Dim result As Boolean = True Select Case methodType Case Shipping.ShippingMethodType2.FedEx1DayFreight, _ Shipping.ShippingMethodType2.FedEx2Day, _ Shipping.ShippingMethodType2.FedEx2DayFreight, _ Shipping.ShippingMethodType2.FedEx3DayFrieght, _ Shipping.ShippingMethodType2.FedExExpressSaver, _ Shipping.ShippingMethodType2.FedExFirstOvernight, _ Shipping.ShippingMethodType2.FedExGround, _ Shipping.ShippingMethodType2.FedExGroundHomeDelivery, _ Shipping.ShippingMethodType2.FedExInternationalEconomy, _ Shipping.ShippingMethodType2.FedExInternationalEconomyFreight, _ Shipping.ShippingMethodType2.FedExInternationalFirst, _ Shipping.ShippingMethodType2.FedExInternationalPriority, _ Shipping.ShippingMethodType2.FedExInternationalPriorityFreight, _ Shipping.ShippingMethodType2.FedExPriorityOvernight, _ Shipping.ShippingMethodType2.FedExStandardOvernight If ShippingServices.IsFedExRegistered = False Then result = False Me.msg.ShowWarning("You must register for a FedEx meter number through the FedEx settings page in the BVC admin before you can create FedEx shipping methods.") End If Case Shipping.ShippingMethodType2.UPS3DaySelect, _ Shipping.ShippingMethodType2.UPSExpeditedCanada, _ Shipping.ShippingMethodType2.UPSExpressCanada, _ Shipping.ShippingMethodType2.UPSExpressEurope, _ Shipping.ShippingMethodType2.UPSExpressMexico, _ Shipping.ShippingMethodType2.UPSExpressPlus, _ Shipping.ShippingMethodType2.UPSExpressSaverCanada, _ Shipping.ShippingMethodType2.UPSExpressSaverEurope, _ Shipping.ShippingMethodType2.UPSExpressSaverUS, _ Shipping.ShippingMethodType2.UPSGround, _ Shipping.ShippingMethodType2.UPSNextDayAir, _ Shipping.ShippingMethodType2.UPSNextDayAirEarlyAM, _ Shipping.ShippingMethodType2.UPSNextDayAirSaver, _ Shipping.ShippingMethodType2.UPSSecondDayAir, _ Shipping.ShippingMethodType2.UPSSecondDayAirAM, _ Shipping.ShippingMethodType2.UPSStandard, _ Shipping.ShippingMethodType2.UPSWorldwideExpedited, _ Shipping.ShippingMethodType2.UPSWorldwideExpress, _ Shipping.ShippingMethodType2.UPSWorldwideExpressPlus If ShippingServices.IsUpsRegistered = False Then result = False Me.msg.ShowWarning("You must register for a UPS meter number through the UPS settings page in the BVC admin before you can create UPS shipping methods.") End If Case Shipping.ShippingMethodType2.USPostalServiceBoundPrintedMaterial, _ Shipping.ShippingMethodType2.USPostalServiceExpress, _ Shipping.ShippingMethodType2.USPostalServiceFirstClass, _ Shipping.ShippingMethodType2.USPostalServiceGlobalExpress, _ Shipping.ShippingMethodType2.USPostalServiceGlobalExpressGuaranteed, _ Shipping.ShippingMethodType2.USPostalServiceGlobalPriorityMail, _ Shipping.ShippingMethodType2.USPostalServiceInternational, _ Shipping.ShippingMethodType2.USPostalServiceLibrary, _ Shipping.ShippingMethodType2.USPostalServiceMedia, _ Shipping.ShippingMethodType2.USPostalServiceParcel, _ Shipping.ShippingMethodType2.USPostalServicePriority If ShippingServices.IsUSPostalRegistered = False Then result = False Me.msg.ShowWarning("You must enter your US Postal username/password on the US Postal settings page in the BVC admin before you can create US Postal shipping method.") End If End Select Return result End Function End Class