private void BindShipMethods() { // bind the configured methods IList <ShipMethod> configuredMethods = ShipMethodDataSource.LoadForShipGateway(this.ShipGatewayId); if (configuredMethods.Count > 0) { ViewPanel.Visible = true; ShipMethodGrid.DataSource = configuredMethods; ShipMethodGrid.DataBind(); } else { ViewPanel.Visible = false; } // bind the add panel ShipMethodList.Items.Clear(); ListItem[] servicesArray = _ShipGateway.GetProviderInstance().GetServiceListItems(); foreach (ListItem item in servicesArray) { bool isConfigured = configuredMethods.Where(x => x.ShipGatewayId == _ShipGateway.Id && x.ServiceCode.Equals(item.Value)).Count() > 0; if (!isConfigured) { ShipMethodList.Items.Add(item); } } AddPanel.Visible = ShipMethodList.Items.Count > 0; }
private void BindServiceCodes() { ServiceCode.Items.Clear(); int shipGatewayId = AlwaysConvert.ToInt(Provider.SelectedValue); ShipGateway provider = GetProvider(shipGatewayId); if (provider != null) { IList <ShipMethod> Shipmethods = ShipMethodDataSource.LoadForShipGateway(shipGatewayId); ListItem[] servicesArray = provider.GetProviderInstance().GetServiceListItems(); foreach (ListItem item in servicesArray) { ServiceCode.Items.Add(item); } } }
protected void ShipMethodGrid_RowDeleting(object sender, GridViewDeleteEventArgs e) { ShipMethodDataSource.LoadForShipGateway(this.ShipGatewayId).DeleteAt(e.RowIndex); BindShipMethods(); }