protected void Page_Load(object sender, EventArgs e) { // LOCATE THE SHIP GATEWAY INFORMATION string classId = Misc.GetClassId(typeof(UPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count == 0) { Response.Redirect("License.aspx"); } _ShipGateway = gateways[0]; if (!Page.IsPostBack) { UPS provider = (UPS)_ShipGateway.GetProviderInstance(); // INITIALIZE THE FORM FIELDS ON FIRST VISIT UserId.Text = provider.UserId; AccessKey.Text = provider.AccessKey; Password.Text = provider.Password; EnableAddressValidation.Checked = provider.EnableAddressValidation; AddressServiceTestUrl.Text = provider.AddressServiceTestUrl; AddressServiceLiveUrl.Text = provider.AddressServiceLiveUrl; } }
protected void Page_Load(object sender, EventArgs e) { // LOCATE THE SHIP GATEWAY INFORMATION string classId = Misc.GetClassId(typeof(AustraliaPost)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count == 0) { Response.Redirect("Register.aspx"); } _ShipGateway = gateways[0]; // INITIALIZE THE PROVIDER SHIP METHOD CONTROL ShipMethods.ShipGatewayId = _ShipGateway.Id; // INITIALIZE THE FORM FIELDS ON FIRST VISIT if (!Page.IsPostBack) { AustraliaPost provider = (AustraliaPost)_ShipGateway.GetProviderInstance(); UseDebugMode.Checked = provider.UseDebugMode; EnablePackaging.Checked = provider.EnablePackageBreakup; MaxWeight.Text = provider.MaxPackageWeight.ToString(); MinWeight.Text = provider.MinPackageWeight.ToString(); } }
protected void ShipmentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { //CAST DATA ITEM BasketShipment shipment = (BasketShipment)e.Item.DataItem; //UPDATE SHIPPING WEIGHT Literal shipWeight = (Literal)e.Item.FindControl("ShipWeight"); if (shipWeight != null) { shipWeight.Text = string.Format(weightFormat, shipment.Items.TotalWeight()); } //SHOW SHIPPING METHODS DropDownList ShipMethodsList = (DropDownList)e.Item.FindControl("ShipMethodsList"); Localize ShipMethodErrorMessage = (Localize)e.Item.FindControl("ShipMethodErrorMessage"); PlaceHolder phNoShippingMethods = (PlaceHolder)e.Item.FindControl("phNoShippingMethods"); PlaceHolder phShipMessage = (PlaceHolder)e.Item.FindControl("PHShipMessage"); if (phShipMessage != null) { phShipMessage.Visible = AbleContext.Current.Store.Settings.EnableShipMessage; } if (ShipMethodsList != null) { _ShipmentIndex = e.Item.ItemIndex; IShipRateQuoteCalculator shippingCalculator = AbleContext.Resolve <IShipRateQuoteCalculator>(); ICollection <ShipRateQuote> rateQuotes = shippingCalculator.QuoteForShipment(shipment); foreach (var rec in rateQuotes) { rec.Rate = Math.Abs(rec.Rate); } ShipMethodsList.DataSource = GetShipMethodListDs(rateQuotes); ShipMethodsList.DataBind(); if (rateQuotes.Count == 0) { ShipMethodErrorMessage.Visible = true; phNoShippingMethods.Visible = true; ShipMethodsList.Visible = false; Localize ShipMethodUPSErrorMessage = (Localize)e.Item.FindControl("ShipMethodUPSErrorMessage"); // CHECK IF UPS IS ENABLED string classId = Misc.GetClassId(typeof(UPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count > 0) { // CHECK IF PROVIDED ADDRESS IS A PO-BOX ADDRESS if (ValidationHelper.IsPostOfficeBoxAddress(shipment.Address.Address1)) { ShipMethodUPSErrorMessage.Visible = true; } } _shippingMethodsAvailable = false; } } }
protected void Page_Load(object sender, EventArgs e) { // LOCATE THE SHIP GATEWAY INFORMATION string classId = Misc.GetClassId(typeof(UPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count == 0) { Response.Redirect("License.aspx"); } _ShipGateway = gateways[0]; UPS provider = (UPS)_ShipGateway.GetProviderInstance(); // INITIALIZE THE PROVIDER SHIP METHOD CONTROL ShipMethods.ShipGatewayId = _ShipGateway.Id; // INITIALIZE THE FORM FIELDS ON FIRST VISIT UserId.Text = provider.UserId; AccessKey.Text = provider.AccessKey; if (!Page.IsPostBack) { if ((provider.CustomerType == UPS.UpsCustomerType.DailyPickup)) { CustomerType_DailyPickup.Checked = true; } else if ((provider.CustomerType == UPS.UpsCustomerType.Occasional)) { CustomerType_Occasional.Checked = true; } else if ((provider.CustomerType == UPS.UpsCustomerType.Retail)) { CustomerType_Retail.Checked = true; } else { CustomerType_Negotiated.Checked = true; } UseInsurance.Checked = provider.UseInsurance; UseDebugMode.Checked = provider.UseDebugMode; UseTestMode.Checked = provider.UseTestMode; LiveServerURL.Text = provider.LiveModeUrl; TestServerURL.Text = provider.TestModeUrl; TrackingURL.Text = provider.TrackingUrl; ShipperNumber.Text = provider.ShipperNumber; EnableLabels.Checked = provider.EnableShipping; MaxWeight.Text = provider.MaxPackageWeight.ToString(); MinWeight.Text = provider.MinPackageWeight.ToString(); EnablePackaging.Checked = provider.EnablePackageBreakup; //EnableAddressValidation.Checked = provider.EnableAddressValidation; //AddressServiceTestUrl.Text = provider.AddressServiceTestUrl; //AddressServiceLiveUrl.Text = provider.AddressServiceLiveUrl; } }
protected void Page_Load(object sender, System.EventArgs e) { // VERIFY THIS PROVIDER IS NOT ALREADY REGISTERED string classId = Misc.GetClassId(typeof(USPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count > 0) { Response.Redirect("Configure.aspx?ShipGatewayId=" + gateways[0].Id); } Logo.ImageUrl = new USPS().GetLogoUrl(this.Page.ClientScript); }
protected void ShipmentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e) { //CAST DATA ITEM BasketShipment shipment = (BasketShipment)e.Item.DataItem; //UPDATE SHIPPING WEIGHT Literal shipWeight = (Literal)e.Item.FindControl("ShipWeight"); if (shipWeight != null) { shipWeight.Text = string.Format(weightFormat, shipment.Items.TotalWeight()); } //SHOW SHIPPING METHODS RadioButtonList ShipMethodsList = (RadioButtonList)e.Item.FindControl("ShipMethodsList"); Localize ShipMethodErrorMessage = (Localize)e.Item.FindControl("ShipMethodErrorMessage"); PlaceHolder phNoShippingMethods = (PlaceHolder)e.Item.FindControl("phNoShippingMethods"); if (ShipMethodsList != null) { _ShipmentIndex = e.Item.ItemIndex; IShipRateQuoteCalculator shippingCalculator = AbleContext.Resolve <IShipRateQuoteCalculator>(); ICollection <ShipRateQuote> rateQuotes = shippingCalculator.QuoteForShipment(shipment); ShipMethodsList.DataSource = GetShipMethodListDs(rateQuotes); ShipMethodsList.DataBind(); if (rateQuotes.Count == 0) { ShipMethodErrorMessage.Visible = true; phNoShippingMethods.Visible = true; ShipMethodsList.Visible = false; Localize ShipMethodUPSErrorMessage = (Localize)e.Item.FindControl("ShipMethodUPSErrorMessage"); // CHECK IF UPS IS ENABLED string classId = Misc.GetClassId(typeof(UPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count > 0) { // CHECK IF PROVIDED ADDRESS IS A PO-BOX ADDRESS if (ValidationHelper.IsPostOfficeBoxAddress(shipment.Address.Address1)) { ShipMethodUPSErrorMessage.Visible = true; } } ContinueButton.Visible = false; } else { // IN CASE WE HAVE DISABLED THE CONTINUE BUTTON BEFORE ContinueButton.Visible = true; } } }
protected void Page_Load(object sender, System.EventArgs e) { // VERIFY THIS PROVIDER IS NOT ALREADY REGISTERED string classId = Misc.GetClassId(typeof(AustraliaPost)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count > 0) { Response.Redirect("Configure.aspx?ShipGatewayId=" + gateways[0].Id); } ConditionText.Text = string.Format(ConditionText.Text, AbleContext.Current.Store.Name); Logo.ImageUrl = new AustraliaPost().GetLogoUrl(this.Page.ClientScript); }
protected void Page_Load(object sender, System.EventArgs e) { // LOCATE THE SHIP GATEWAY INFORMATION string classId = Misc.GetClassId(typeof(DHLInternational)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count == 0) { Response.Redirect("Register.aspx"); } _ShipGateway = gateways[0]; // INITIALIZE THE PROVIDER SHIP METHOD CONTROL ShipMethods.ShipGatewayId = _ShipGateway.Id; // INITIALIZE THE FORM FIELDS ON FIRST VISIT if (!Page.IsPostBack) { DHLInternational provider = (DHLInternational)_ShipGateway.GetProviderInstance(); UseDebugMode.Checked = provider.UseDebugMode; UseTestMode.Checked = provider.UseTestMode; EnablePackaging.Checked = provider.EnablePackageBreakup; UserID.Text = provider.UserID; Password.Text = provider.Password; ShippingKey.Text = provider.ShippingKey; AccountNumber.Text = provider.AccountNumber; DaysToShip.Text = provider.DaysToShip.ToString(); LiveServerURL.Text = provider.LiveModeUrl; TestServerURL.Text = provider.TestModeUrl; TrackingURL.Text = provider.TrackingUrl; MaxWeight.Text = provider.MaxPackageWeight.ToString(); MinWeight.Text = provider.MinPackageWeight.ToString(); DutiableFlag.Checked = provider.DutiableFlag; CustomsValueMultiplier.Text = provider.CustomsValueMultiplier.ToString(); CommerceLicensed.Checked = provider.CommerceLicensed; BindFilingType(provider.FilingType); FTRExemptionCode.Text = provider.FTRExemptionCode; ITNNumber.Text = provider.ITNNumber; EINCode.Text = provider.EINCode; } }
protected void Page_Load(object sender, EventArgs e) { // VERIFY THIS PROVIDER IS NOT ALREADY REGISTERED string classId = Misc.GetClassId(typeof(UPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count > 0) { Response.Redirect("Configure.aspx?ShipGatewayId=" + gateways[0].Id); } // INITIALIZE FORM if (!Page.IsPostBack) { Warehouse defaultWarehouse = AbleContext.Current.Store.DefaultWarehouse; ContactName.Text = AbleContext.Current.User.PrimaryAddress.FullName; CompanyName.Text = AbleContext.Current.Store.Name; Address1.Text = defaultWarehouse.Address1; Address2.Text = defaultWarehouse.Address2; City.Text = defaultWarehouse.City; string countryCode = defaultWarehouse.CountryCode; if ((countryCode.Equals("US") || countryCode.Equals("CA"))) { Province userProvince = new Province(); if ((!string.IsNullOrEmpty(defaultWarehouse.Province) && (defaultWarehouse.Province.Length == 2))) { Province.Text = defaultWarehouse.Province; } PostalCode.Text = defaultWarehouse.PostalCode; } ListItem countryItem = Country.Items.FindByValue(countryCode); if (countryItem != null) { countryItem.Selected = true; } Phone.Text = Regex.Replace(defaultWarehouse.Phone, "[^0-9]", ""); Email.Text = defaultWarehouse.Email; } }
protected void Page_Load(object sender, EventArgs e) { // LOCATE THE SHIP GATEWAY INFORMATION string classId = Misc.GetClassId(typeof(USPS)); IList <ShipGateway> gateways = ShipGatewayDataSource.LoadForClassId(classId); if (gateways.Count == 0) { Response.Redirect("Register.aspx"); } _ShipGateway = gateways[0]; USPS provider = (USPS)_ShipGateway.GetProviderInstance(); // INITIALIZE THE PROVIDER SHIP METHOD CONTROL ShipMethods.ShipGatewayId = _ShipGateway.Id; // INITIALIZE THE FORM FIELDS ON FIRST VISIT if (!Page.IsPostBack) { UseDebugMode.Checked = provider.UseDebugMode; UseTestMode.Checked = provider.UseTestMode; UserId.Text = provider.UserId; LiveServerURL.Text = provider.LiveModeUrl; TestServerURL.Text = provider.TestModeUrl; TrackingURL.Text = provider.TrackingUrl; MaxWeight.Text = provider.MaxPackageWeight.ToString(); MinWeight.Text = provider.MinPackageWeight.ToString(); EnablePackaging.Checked = provider.EnablePackageBreakup; EnableAddressValidation.Checked = provider.EnableAddressValidation; AddressServiceUrl.Text = provider.AddressServiceUrl; UseOnlineRates.Checked = provider.UseOnlineRate; var item = IntlMailType.Items.FindByValue(provider.IntlMailType); if (item != null) { item.Selected = true; } } }