Ejemplo n.º 1
0
    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ShippingAdmin shipAdmin = new ShippingAdmin();
        StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin();

        if (ItemId > 0)
        {
            Shipping shippingOption = shipAdmin.GetShippingOptionById(ItemId);

            lblShippingType.Text = shipAdmin.GetShippingTypeName(shippingOption.ShippingTypeID);
            if (shippingOption.ProfileID.HasValue)
                lblProfileName.Text = shipAdmin.GetProfileNamee((int)shippingOption.ProfileID);
            else
                lblProfileName.Text = "All Profiles";

            lblDescription.Text  = shippingOption.Description;
            lblShippingCode.Text = shippingOption.ShippingCode;

            if (shippingOption.HandlingCharge > 0)
            {
                lblHandlingCharge.Text = shippingOption.HandlingCharge.ToString("N2");
            }
            else
            {
                lblHandlingCharge.Text = "0.00";
            }

            if (shippingOption.DestinationCountryCode != null)
            {
                if (shippingOption.DestinationCountryCode.Length > 0)
                {
                    lblDestinationCountry.Text = shippingOption.DestinationCountryCode;
                }
            }
            else
            {
                lblDestinationCountry.Text = "All Countries";
            }

            imgActive.Src = ZNodeHelper.GetCheckMark((bool)shippingOption.ActiveInd);
            lblDisplayOrder.Text = shippingOption.DisplayOrder.ToString();

            if (shippingOption.ShippingTypeID == 1)
            {
                pnlShippingRuletypes.Visible = true;
            }
        }
        else
        {
            //nothing to do here
        }
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Bind data to the fields on the screen
 /// </summary>
 protected void BindData()
 {
     ShippingAdmin shipAdmin = new ShippingAdmin();
     ShippingOptionName = shipAdmin.GetShippingOptionById(ItemId).Description;
 }
Ejemplo n.º 3
0
    /// <summary>
    /// Bind data to the fields 
    /// </summary>
    protected void BindData()
    {
        ShippingAdmin shipAdmin = new ShippingAdmin();
        StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin();

        //GET LIST DATA

        //Get shipping types
        lstShippingType.DataSource = shipAdmin.GetShippingTypes();
        lstShippingType.DataTextField = "Name";
        lstShippingType.DataValueField = "ShippingTypeID";
        lstShippingType.DataBind();
        lstShippingType.SelectedIndex = 0;

        //Bind countries
        BindCountry();

        //get profiles
        lstProfile.DataSource = settingsAdmin.GetProfiles();
        lstProfile.DataTextField = "Name";
        lstProfile.DataValueField = "ProfileID";
        lstProfile.DataBind();
        lstProfile.Items.Insert(0, new ListItem("All Profiles", "-1"));
        lstProfile.SelectedItem.Value = "-1";

        if (ItemId > 0)
        {
            Shipping shippingOption = shipAdmin.GetShippingOptionById(ItemId);

            if(shippingOption.ProfileID.HasValue)
                lstProfile.SelectedValue = shippingOption.ProfileID.Value.ToString();
            lstShippingType.SelectedValue = shippingOption.ShippingTypeID.ToString();

            lstShippingType.Enabled = false;

            //If UPS Shipping Option is Selected
            if (lstShippingType.SelectedValue == "2")
            {
                //Bind UPS Service codes
                BindShippingServiceCodes();
                lstShippingServiceCodes.SelectedValue = shippingOption.ShippingCode;

                pnlShippingServiceCodes.Visible = true;
                pnlShippingOptions.Visible = false;
                pnlDestinationCountry.Visible = false;
            }
            //If FedEx Shipping Option is Selected
            else if (lstShippingType.SelectedValue == "3")
            {
                //Bind FedEx Service codes
                BindShippingServiceCodes();
                lstShippingServiceCodes.SelectedValue = shippingOption.ShippingCode;

                pnlShippingServiceCodes.Visible = true;
                pnlShippingOptions.Visible = false;
                pnlDestinationCountry.Visible = false;
            }
            else
            {
                txtDescription.Text = shippingOption.Description;
                txtShippingCode.Text = shippingOption.ShippingCode;
            }
            if (shippingOption.HandlingCharge > 0)
            {
                txtHandlingCharge.Text = shippingOption.HandlingCharge.ToString("N2");
            }
            else
            {
                txtHandlingCharge.Text = "0.00";
            }

            if (shippingOption.DestinationCountryCode != null)
            {
                if (shippingOption.DestinationCountryCode.Length > 0)
                {
                    lstCountries.SelectedValue = shippingOption.DestinationCountryCode;
                }
            }
            chkActiveInd.Checked = (bool)shippingOption.ActiveInd;
            txtDisplayOrder.Text = shippingOption.DisplayOrder.ToString();
        }
        else
        {
           //nothing to do here
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Submit button click event
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        StoreSettingsAdmin settingsAdmin = new StoreSettingsAdmin();
        ShippingAdmin shipAdmin = new ShippingAdmin();
        Shipping shipOption = new Shipping();

        //If edit mode then retrieve data first
        if (ItemId > 0)
        {
            shipOption = shipAdmin.GetShippingOptionById(ItemId);
        }

        //set values
        shipOption.ActiveInd = chkActiveInd.Checked;

        //If UPS Shipping type is selected
        if (lstShippingType.SelectedValue == "2")
        {
            shipOption.ShippingCode = lstShippingServiceCodes.SelectedItem.Value;
            shipOption.Description = lstShippingServiceCodes.SelectedItem.Text;
        }
        //If FedEx Shipping type is selected
        else if (lstShippingType.SelectedValue == "3")
        {
            shipOption.ShippingCode = lstShippingServiceCodes.SelectedItem.Value;
            shipOption.Description = lstShippingServiceCodes.SelectedItem.Text;
        }
        else
        {
            shipOption.ShippingCode = txtShippingCode.Text;
            shipOption.Description = txtDescription.Text;
        }

        if (lstCountries.SelectedValue.Equals("*"))
        {
            shipOption.DestinationCountryCode = null;
        }
        else
        {
            shipOption.DestinationCountryCode = lstCountries.SelectedValue;
        }

        shipOption.DisplayOrder = int.Parse(txtDisplayOrder.Text);
        //Profile settings
        if (lstProfile.SelectedValue != "-1")
        {
            shipOption.ProfileID = int.Parse(lstProfile.SelectedValue);
        }
        else
        {
            shipOption.ProfileID = null;
        }

        shipOption.ShippingTypeID = int.Parse(lstShippingType.SelectedValue);

        if (txtHandlingCharge.Text.Length > 0)
        {
            shipOption.HandlingCharge = decimal.Parse(txtHandlingCharge.Text);
        }

        bool retval = false;

        if (ItemId > 0)
        {
            retval = shipAdmin.UpdateShippingOption(shipOption);
        }
        else
        {
            retval = shipAdmin.AddShippingOption(shipOption);
        }

        if (retval)
        {
            //redirect to main page
            Response.Redirect("~/admin/secure/settings/shipping/default.aspx");
        }
        else
        {
            //display error message
            lblMsg.Text = "An error occurred while updating. Please try again.";
        }
    }
Ejemplo n.º 5
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;
        }
    }
Ejemplo n.º 6
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="ds"></param>
    /// <returns></returns>
    private DataSet FormatReportDataSet(DataSet ds)
    {
        //This will copied the structure and data from the Original dataset
        DataSet tempDataSet = ds.Copy();

        # region Local Variables
        OrderAdmin orderAdmin = new OrderAdmin();
        ShippingAdmin shippingAdmin = new ShippingAdmin();
        StoreSettingsAdmin storeAdmin = new StoreSettingsAdmin();
        #endregion

        //Initialize new columns for OrderStatus,ShippingType,Payment Type
        //Add column to this temporary dataset
        DataColumn columnOrderStatus = new DataColumn("OrderStatus");
        tempDataSet.Tables[0].Columns.Add(columnOrderStatus);

        //Add ShippingType column
        DataColumn columnShippingType = new DataColumn("ShippingTypeName");
        tempDataSet.Tables[0].Columns.Add(columnShippingType);

        //Add Paymenttype column
        DataColumn columnPaymentType = new DataColumn("PaymentTypeName");
        tempDataSet.Tables[0].Columns.Add(columnPaymentType);

        //Loop through the Orders in the dataset
        foreach (DataRow dr in tempDataSet.Tables[0].Rows)
        {
            //Get Order Status
            int OrderStateId = int.Parse(dr["OrderStateId"].ToString());
            OrderState entity = orderAdmin.GetByOrderStateID(OrderStateId);

            int shippingId = int.Parse(dr["ShippingId"].ToString());
            Shipping shippingEntity = shippingAdmin.GetShippingOptionById(shippingId);

            int paymentTypeId = 0;
            if(dr["PaymentTypeId"].ToString().Length > 0)
                //If PaymentTypeId value length is greater than Zero
                paymentTypeId = int.Parse(dr["PaymentTypeId"].ToString());
            PaymentType paymentType = storeAdmin.GetPaymentTypeById(paymentTypeId);

            if (entity != null)
                dr["OrderStatus"] = entity.OrderStateName;

            if (shippingEntity != null)
                dr["ShippingTypeName"] = (shippingAdmin.GetShippingTypeName(shippingEntity.ShippingTypeID));

            if (paymentType != null)
                dr["PaymentTypeName"] = paymentType.Name;
        }

        //Return dataset
        return tempDataSet;
    }