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;
        }
Ejemplo n.º 2
0
 protected void MultipleRowDelete_Click(object sender, EventArgs e)
 {
     // Looping through all the rows in the GridView
     foreach (GridViewRow row in ShipMethodGrid.Rows)
     {
         CheckBox checkbox = (CheckBox)row.FindControl("DeleteCheckbox");
         if ((checkbox != null) && (checkbox.Checked))
         {
             // Retreive the GiftCertificateId
             int        shipMethodId = Convert.ToInt32(ShipMethodGrid.DataKeys[row.RowIndex].Value);
             ShipMethod sm           = ShipMethodDataSource.Load(shipMethodId);
             if (sm != null)
             {
                 sm.Delete();
             }
         }
     }
     ShipMethodGrid.DataBind();
 }
Ejemplo n.º 3
0
        protected void ShipMethodGrid_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            IList <ShipMethod> shipMethods = ShipMethodDataSource.LoadAll(ShipMethodGrid.SortExpression);

            if (e.CommandName.StartsWith("Do_"))
            {
                int shipMethodId = AlwaysConvert.ToInt(e.CommandArgument.ToString());
                int index;
                index = shipMethods.IndexOf(shipMethodId);
                switch (e.CommandName)
                {
                case "Do_Up":
                    ReorderMethod(shipMethods, index, index - 1);
                    ShipMethodGrid.DataBind();
                    break;

                case "Do_Down":
                    ReorderMethod(shipMethods, index, index + 1);
                    ShipMethodGrid.DataBind();
                    break;
                }
            }
        }