protected void Page_Init(object sender, EventArgs e) { int shipmentId = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]); _OrderShipment = OrderShipmentDataSource.Load(shipmentId); if (_OrderShipment == null) { Response.Redirect(CancelLink.NavigateUrl); } // BIND THE ADDRESS initAddress(); // BIND ADDITIONAL DETAILS ShipFrom.DataSource = AbleContext.Current.Store.Warehouses; ShipFrom.DataBind(); if (!Page.IsPostBack) { ListItem selectedItem = ShipFrom.Items.FindByValue(_OrderShipment.WarehouseId.ToString()); if (selectedItem != null) { selectedItem.Selected = true; } } ShipMessage.Text = _OrderShipment.ShipMessage; Caption.Text = string.Format(Caption.Text, _OrderShipment.Order.OrderNumber); EditShipmentCaption.Text = string.Format(EditShipmentCaption.Text, _OrderShipment.ShipmentNumber); CancelLink.NavigateUrl += "?OrderNumber=" + _OrderShipment.Order.OrderNumber.ToString(); TrackingNumbersLabel.Visible = (_OrderShipment.TrackingNumbers != null && _OrderShipment.TrackingNumbers.Count > 0); ShipGateway.DataSource = ShipGatewayDataSource.LoadAll(); ShipGateway.DataBind(); trAddTrackingNumber.Visible = (_OrderShipment.TrackingNumbers.Count == 0); }
protected void Page_Init(object sender, EventArgs e) { int shipmentId = AlwaysConvert.ToInt(Request.QueryString["OrderShipmentId"]); _OrderShipment = OrderShipmentDataSource.Load(shipmentId); if (_OrderShipment == null) { Response.Redirect("../Default.aspx"); } _Order = _OrderShipment.Order; Caption.Text = string.Format(Caption.Text, _Order.OrderNumber); ShipmentNumber.Text = string.Format(ShipmentNumber.Text, _Order.Shipments.IndexOf(_OrderShipment.Id) + 1, _Order.Shipments.Count); ShippingMethod.Text = _OrderShipment.ShipMethodName; trShipMessage.Visible = !string.IsNullOrEmpty(_OrderShipment.ShipMessage); ShipMessage.Text = _OrderShipment.ShipMessage; ShipFrom.Text = _OrderShipment.FormatFromAddress(); ShipTo.Text = _OrderShipment.FormatToAddress(); ShipmentItems.DataSource = GetShipmentItems(); ShipmentItems.DataBind(); // check if ship gateway supports shipping feature CommerceBuilder.Shipping.ShipGateway shipGateway = _OrderShipment.ShipMethod != null ?_OrderShipment.ShipMethod.ShipGateway : null; IShippingProvider shipProvider = null; if (shipGateway != null) { shipProvider = shipGateway.GetProviderInstance(); _IsProviderSupportShipping = shipProvider != null && shipProvider.IsShippingSupported; } ShipGateway.DataSource = ShipGatewayDataSource.LoadAll(); ShipGateway.DataBind(); if (ShipGateway.Items.Count > 1) { //TRY TO PRESET THE CORRECT GATEWAY if (_OrderShipment.ShipMethod != null) { ListItem item = ShipGateway.Items.FindByValue(_OrderShipment.ShipMethod.ShipGatewayId.ToString()); if (item != null) { item.Selected = true; } } } else { ShipGateway.Visible = false; } if (_IsProviderSupportShipping) { autoTrackingInputPanel.Visible = true; // update the provider name ProviderInstructionText.Text = string.Format(ProviderInstructionText.Text, shipProvider.Name); ProviderInstructionText.Visible = true; } else { autoTrackingInputPanel.Visible = false; } CancelButton.NavigateUrl += "?OrderNumber=" + _OrderShipment.Order.OrderNumber.ToString(); }