Пример #1
0
    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ShippingAdmin shipAdmin = new ShippingAdmin();
        Shipping shippingOption = shipAdmin.GetShippingOptionById(ShippingId);

        //Set Title
        lblTitle.Text = lblTitle.Text + shippingOption.Description;

        //Get shipping rule types
        foreach (ShippingRuleType ruleType in shipAdmin.GetShippingRuleTypes())
        {
            if (ruleType.ShippingRuleTypeID == 3 || ruleType.ShippingRuleTypeID == 4)
            { // Nothing to do here
            }
            else
            {
                ListItem li = new ListItem(ruleType.Description, ruleType.ShippingRuleTypeID.ToString());
                lstShippingRuleType.Items.Add(li);
            }
        }
        lstShippingRuleType.SelectedIndex = 0;

        if (ItemId > 0)
        {
            ShippingRule shippingRule = shipAdmin.GetShippingRule(ItemId);

            lstShippingRuleType.SelectedValue = shippingRule.ShippingRuleTypeID.ToString();

            SetShippingTypeOptions(shippingRule.ShippingRuleTypeID);

            if (shippingRule.BaseCost != 0)
            {
                txtBaseCost.Text = shippingRule.BaseCost.ToString("N2");
            }
            else
            {
                txtBaseCost.Text = "0";
            }

            if (shippingRule.PerItemCost != 0)
            {
                txtPerItemCost.Text = shippingRule.PerItemCost.ToString("N2");
            }
            else
            {
                txtPerItemCost.Text = "0";
            }

            if (shippingRule.LowerLimit != null)
            {
                txtLowerLimit.Text = shippingRule.LowerLimit.ToString();
            }
            else
            {
                txtLowerLimit.Text = "0";
            }

            if (shippingRule.UpperLimit != null)
            {
                txtUpperLimit.Text = shippingRule.UpperLimit.ToString();
            }
            else
            {
                txtUpperLimit.Text = "0";
            }

        }
        else
        {
            pnlNonFlat.Visible = false;
        }
    }
Пример #2
0
 /// <summary>
 /// Bind Shipping option list
 /// </summary>
 private void BindShippingTypes()
 {
     // Bind ShippingRuleTypes
     ShippingAdmin shippingAdmin = new ShippingAdmin();
     ShippingTypeList.DataSource = shippingAdmin.GetShippingRuleTypes();
     ShippingTypeList.DataTextField = "description";
     ShippingTypeList.DataValueField = "shippingruletypeid";
     ShippingTypeList.DataBind();
 }