Beispiel #1
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"));
        }
        RegisterResource();
        if (!Utilities.ValidateUserLogin())
        {
            return;
        }
        Util_CheckAccess();

        if (!string.IsNullOrEmpty(Page.Request.QueryString["search"]))
        {
            searchCriteria = Page.Request.QueryString["search"];
        }
        if (!string.IsNullOrEmpty(Page.Request.QueryString["country"]))
        {
            countryId = Convert.ToInt64(Page.Request.QueryString["country"]);
        }

        try
        {

            m_refRegion = new RegionApi();
            m_refCountry = new CountryApi();
            criteria.PagingInfo = new PagingInfo(10000);
            criteria.AddFilter(CountryProperty.IsEnabled, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
            if (countryId > 0)
            {
                criteria.AddFilter(CountryProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, countryId);
            }

            hdnCurrentPage.Value = CurrentPage.Text;
            switch (this.m_sPageAction)
            {
                case "addedit":
                    CountryList = m_refCountry.GetList(criteria);
                    if (Page.IsPostBack)
                    {
                        Process_AddEdit();
                    }
                    else
                    {
                        Display_AddEdit();
                    }
                    break;
                case "del":
                    Process_Delete();
                    break;
                case "view":
                    CountryList = m_refCountry.GetList(criteria);
                    Display_View();
                    break;
                default:
                    CountryList = m_refCountry.GetList(criteria);
                    if (Page.IsPostBack == false)
                    {
                        Display_All();
                    }
                    break;
            }
            Util_SetLabels();
            Util_SetJS();

        }
        catch (Exception ex)
        {
            if (ex.Message.IndexOf("unique key") > -1)
            {
                Utilities.ShowError(GetMessage("lbl region dupe"));
            }
            else
            {
                Utilities.ShowError(ex.Message);
            }
        }
    }
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;
        }
        Util_CheckAccess();
        Util_RegisterResources();
        if (Page.Request.QueryString["search"] != "")
        {
            _SearchCriteria = Page.Request.QueryString["search"];
        }
        _RegionApi = new RegionApi(); //(Me.m_refContentApi.RequestInformationRef)
        _CountryApi = new CountryApi(); //(Me.m_refContentApi.RequestInformationRef)
        _CountryCriteria.PagingInfo = new PagingInfo(10000);

        hdnCurrentPage.Value = CurrentPage.Text;
        switch (this.m_sPageAction)
        {
            case "addedit":
                _CountryList = _CountryApi.GetList(_CountryCriteria);
                if (Page.IsPostBack)
                {
                    Process_AddEdit();
                }
                else
                {
                    Display_AddEdit();
                }
                break;
            case "del":
                Process_Delete();
                break;
            case "view":
                _CountryList = _CountryApi.GetList(_CountryCriteria);
                Display_View();
                break;
            default:
                _CountryCriteria.Condition = LogicalOperation.Or;
                if (_SearchCriteria != "")
                {
                    _CountryCriteria.AddFilter(CountryProperty.Name, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchCriteria);
                }
                if (_SearchCriteria != "")
                {
                    _CountryCriteria.AddFilter(CountryProperty.LongIsoCode, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchCriteria);
                }
                if (_SearchCriteria != "")
                {
                    _CountryCriteria.AddFilter(CountryProperty.ShortIsoCode, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchCriteria);
                }
                _CountryList = _CountryApi.GetList(_CountryCriteria);
                if (Page.IsPostBack == false)
                {
                    Display_All();
                }
                break;
        }
        Util_SetLabels();
        Util_SetJS();
    }
Beispiel #3
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;
        }
        Util_CheckAccess();
        Util_RegisterResources();
        _RegionApi = new RegionApi(); //(Me.m_refContentApi.RequestInformationRef)
        _CountryApi = new CountryApi(); //(Me.m_refContentApi.RequestInformationRef)
        _Criteria.PagingInfo = new PagingInfo(10000);
        _Criteria.AddFilter(CountryProperty.IsEnabled, CriteriaFilterOperator.EqualTo, true);
        AppPath = m_refContentApi.AppPath;

        switch (this.m_sPageAction)
        {
            case "addedit":
                _CountryList = _CountryApi.GetList(_Criteria);
                if (Page.IsPostBack && smUpdateRegion.IsInAsyncPostBack == false)
                {
                    if (Request.Form[isCPostData.UniqueID] == "")
                    {
                        Process_AddEdit();
                    }
                }
                else
                {
                    if (smUpdateRegion.IsInAsyncPostBack == true)
                    {
                        UpdateRegions();
                    }
                    else
                    {
                        Display_AddEdit();
                    }
                }
                break;
            case "del":
                Process_Delete();
                break;
            case "view":
                _CountryList = _CountryApi.GetList(_Criteria);
                Display_View();
                break;
            default:
                _CountryList = _CountryApi.GetList(_Criteria);
                if (Page.IsPostBack == false)
                {
                    Display_All();
                }
                break;
        }
        Util_SetLabels();
        Util_SetJS();
    }
Beispiel #4
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 #5
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 #6
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"));
        }
        RegisterResources();
        AppPath = m_refContentApi.ApplicationPath;

        try
        {

            if (!Utilities.ValidateUserLogin())
            {
                return;
            }
            CommerceLibrary.CheckCommerceAdminAccess();

            System.Web.HttpCookie siteCookie = CommonApiBase.GetEcmCookie();
            Ektron.Cms.Commerce.CurrencyApi m_refCurrencyApi = new Ektron.Cms.Commerce.CurrencyApi();
            defaultCurrency = (new CurrencyApi()).GetItem(m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId);

            if (siteCookie["SiteCurrency"] != defaultCurrency.Id.ToString())
            {
                defaultCurrency.Id = Convert.ToInt32(siteCookie["SiteCurrency"]);
                defaultCurrency = m_refCurrencyApi.GetItem(defaultCurrency.Id);
            }

            if (!string.IsNullOrEmpty(Request.QueryString["customerid"]))
            {
                m_iCustomerId = Convert.ToInt64(Request.QueryString["customerid"]);
            }
            defaultCurrency = (new CurrencyApi()).GetItem(m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId);
            CustomerManager = new CustomerApi();
            AddressManager = new AddressApi();

            if (siteCookie["SiteCurrency"] != defaultCurrency.Id.ToString())
            {
                defaultCurrency.Id = Convert.ToInt32(siteCookie["SiteCurrency"]);
                defaultCurrency = m_refCurrencyApi.GetItem(defaultCurrency.Id);
            }

            switch (base.m_sPageAction)
            {
                case "addeditaddress":
                    RegionManager = new RegionApi();
                    CountryManager = new CountryApi();
                    if (Page.IsPostBack)
                    {
                        if (Request.Form[isCPostData.UniqueID] == "")
                        {
                            Process_ViewAddress();
                        }
                    }
                    else
                    {
                        Display_ViewAddress(true);
                    }
                    break;
                case "viewaddress":
                    RegionManager = new RegionApi();
                    CountryManager = new CountryApi();
                    Display_ViewAddress(false);
                    break;
                case "viewbasket":
                    Display_ViewBaskets(false);
                    break;
                case "view":
                    Display_View();
                    break;
                case "deleteaddress":
                    Process_AddressDelete();
                    break;
                case "deletebasket":
                    Process_BasketDelete();
                    break;
                default: // "viewall"
                    if (Page.IsPostBack == false)
                    {
                        Display_View_All();
                    }
                    break;
            }
            Util_SetLabels();
            Util_SetJS();
        }
        catch (Exception ex)
        {
            Utilities.ShowError(ex.Message);
        }
    }
Beispiel #7
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);
    }
 public void Init()
 {
     instance = new RegionApi();
 }