Beispiel #1
0
    protected void Util_BindRegions(int cCountryId)
    {
        System.Collections.Generic.List<RegionData> RegionList = new System.Collections.Generic.List<RegionData>();
        RegionApi m_refRegion;
        m_refRegion = new RegionApi(); //(Me.m_refContentApi.RequestInformationRef)

        Ektron.Cms.Common.Criteria<RegionProperty> criteria = new Ektron.Cms.Common.Criteria<RegionProperty>(RegionProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        criteria.AddFilter(RegionProperty.CountryId, CriteriaFilterOperator.EqualTo, cCountryId);
        criteria.AddFilter(RegionProperty.IsEnabled, CriteriaFilterOperator.EqualTo, true);
        criteria.PagingInfo.RecordsPerPage = 10000;

        RegionList = m_refRegion.GetList(criteria);
        if ((RegionList != null) && RegionList.Count > 0)
        {
            drp_address_region.DataSource = RegionList;
            drp_address_region.DataTextField = "Name";
            drp_address_region.DataValueField = "Id";
            drp_address_region.DataBind();
        }
        else
        {
            drp_address_region.DataSource = "";
            drp_address_region.DataTextField = "Name";
            drp_address_region.DataValueField = "Id";
            drp_address_region.DataBind();
        }
    }
Beispiel #2
0
    protected override void Page_Load(object sender, System.EventArgs e)
    {
        base.Page_Load(sender, e);
        if (!Ektron.Cms.DataIO.LicenseManager.LicenseManager.IsFeatureEnable(m_refContentApi.RequestInformationRef, Ektron.Cms.DataIO.LicenseManager.Feature.eCommerce))
        {
            Utilities.ShowError(m_refContentApi.EkMsgRef.GetMessage("feature locked error"));
        }
        if (!Utilities.ValidateUserLogin())
        {
            return;
        }
        this.CommerceLibrary.CheckCommerceAdminAccess();
        Util_RegisterResources();
        m_refRegion = new RegionApi();
        m_refCountry = new CountryApi();
        criteria.PagingInfo = new PagingInfo(10000);
        RegionCriteria.PagingInfo = new PagingInfo(10000);
        CountryList = m_refCountry.GetList(criteria);
        RegionList = m_refRegion.GetList(RegionCriteria);

        try
        {
            switch (base.m_sPageAction)
            {
                case "markdef":
                    Process_MarkDefault();
                    break;
                case "del":
                    Process_Delete();
                    break;
                case "addedit":
                    if (Page.IsPostBack && smAddressCountry.IsInAsyncPostBack == false)
                    {
                        Process_AddEdit();
                    }
                    else if (smAddressCountry.IsInAsyncPostBack == true)
                    {
                        Util_BindRegions((string)drp_address_country.SelectedValue);
                    }
                    else
                    {
                        Display_AddEdit();
                    }
                    break;
                case "view":
                    Display_View();
                    break;
                default: // "viewall"
                    if (Page.IsPostBack == false)
                    {
                        Display_View_All();
                    }
                    break;
            }
            SetLabels();
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
Beispiel #3
0
    protected void Display_ViewAddress(bool WithEdit)
    {
        pnl_view.Visible = false;
        pnl_viewall.Visible = false;
        AddressData aAddress = null;
        RegionManager = new RegionApi();

        Ektron.Cms.Common.Criteria<RegionProperty> regioncriteria = new Ektron.Cms.Common.Criteria<RegionProperty>(RegionProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        if (!(this.m_iID > 0))
        {
            regioncriteria.AddFilter(RegionProperty.CountryId, CriteriaFilterOperator.EqualTo, drp_address_country.SelectedIndex);
        }
        regioncriteria.PagingInfo.RecordsPerPage = 1000;
        drp_address_region.DataTextField = "Name";
        drp_address_region.DataValueField = "Id";
        drp_address_region.DataSource = RegionManager.GetList(regioncriteria);
        drp_address_region.DataBind();

        Ektron.Cms.Common.Criteria<CountryProperty> addresscriteria = new Ektron.Cms.Common.Criteria<CountryProperty>(CountryProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        addresscriteria.PagingInfo.RecordsPerPage = 1000;
        drp_address_country.DataTextField = "Name";
        drp_address_country.DataValueField = "Id";
        drp_address_country.DataSource = CountryManager.GetList(addresscriteria);
        drp_address_country.DataBind();

        if (this.m_iID > 0)
        {
            cCustomer = CustomerManager.GetItem(this.m_iCustomerId);
            aAddress = AddressManager.GetItem(this.m_iID);
            regioncriteria.AddFilter(RegionProperty.CountryId, CriteriaFilterOperator.EqualTo, aAddress.Country.Id);

            drp_address_region.DataSource = RegionManager.GetList(regioncriteria);
            ltr_address_id.Text = aAddress.Id.ToString();
            txt_address_name.Text = aAddress.Name;
            txt_address_company.Text = aAddress.Company;
            txt_address_line1.Text = aAddress.AddressLine1;
            txt_address_line2.Text = aAddress.AddressLine2;
            txt_address_city.Text = aAddress.City;
            drp_address_country.SelectedIndex = FindItem(aAddress.Country.Id, "country");
            Util_BindRegions(aAddress.Country.Id);
            drp_address_region.SelectedValue = aAddress.Region.Id.ToString();
            txt_address_postal.Text = aAddress.PostalCode;
            txt_address_phone.Text = aAddress.Phone;
            chk_default_billing.Checked = aAddress.Id == cCustomer.BillingAddressId;
            chk_default_shipping.Checked = aAddress.Id == cCustomer.ShippingAddressId;
        }
        ToggleAddressFields(WithEdit);
    }