예제 #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);
            }
        }
    }
예제 #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();
        _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();
    }
예제 #3
0
    protected void Display_All()
    {
        System.Collections.Generic.List<TaxRateData> RateList = new System.Collections.Generic.List<TaxRateData>();
        System.Collections.Generic.List<TaxClassData> TaxClassList = new System.Collections.Generic.List<TaxClassData>();
        Ektron.Cms.Common.Criteria<TaxClassProperty> TaxClasscriteria = new Ektron.Cms.Common.Criteria<TaxClassProperty>(TaxClassProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        Ektron.Cms.Common.Criteria<CountryProperty> countryCriteria = new Ektron.Cms.Common.Criteria<CountryProperty>(CountryProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        int i = 0;
        dg_viewall.PageSize = m_refContentApi.RequestInformationRef.PagingSize;
        countryCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
        countryCriteria.PagingInfo.CurrentPage = _CurrentPageNumber;

        _TaxApi = new TaxApi();
        TaxClassList = _TaxClassApi.GetList(TaxClasscriteria);

        dg_viewall.AutoGenerateColumns = false;
        dg_viewall.Columns.Clear();

        System.Collections.Generic.List<CountryData> CountryRateList = new System.Collections.Generic.List<CountryData>();
        CountryApi m_refCountryTaxRate = new CountryApi();
        m_refCountryTaxRate = new CountryApi();

        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);
        }

        CountryRateList = m_refCountryTaxRate.GetList(countryCriteria);

        _TotalPagesNumber = System.Convert.ToInt32(countryCriteria.PagingInfo.TotalPages);
        TotalPages.ToolTip = _TotalPagesNumber.ToString();

        if (_TotalPagesNumber <= 1)
        {
            TotalPages.Visible = false;
            CurrentPage.Visible = false;
            lnkBtnPreviousPage.Visible = false;
            NextPage.Visible = false;
            LastPage.Visible = false;
            FirstPage.Visible = false;
            PageLabel.Visible = false;
            OfLabel.Visible = false;
        }
        else
        {
            lnkBtnPreviousPage.Enabled = true;
            FirstPage.Enabled = true;
            LastPage.Enabled = true;
            NextPage.Enabled = true;
            TotalPages.Visible = true;
            CurrentPage.Visible = true;
            lnkBtnPreviousPage.Visible = true;
            NextPage.Visible = true;
            LastPage.Visible = true;
            FirstPage.Visible = true;
            PageLabel.Visible = true;
            OfLabel.Visible = true;
            TotalPages.Text = (System.Math.Ceiling(Convert.ToDouble(_TotalPagesNumber))).ToString();
            TotalPages.ToolTip = TotalPages.Text;

            CurrentPage.Text = _CurrentPageNumber.ToString();
            CurrentPage.ToolTip = CurrentPage.Text;

            if (_CurrentPageNumber == 1)
            {
                lnkBtnPreviousPage.Enabled = false;
                FirstPage.Enabled = false;
            }
            else if (_CurrentPageNumber == _TotalPagesNumber)
            {
                NextPage.Enabled = false;
                LastPage.Enabled = false;
            }
        }

        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Id";
        colBound.HeaderText = this.GetMessage("generic id");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        dg_viewall.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Name";
        colBound.HeaderText = this.GetMessage("generic name")+" (" + m_refMsg.GetMessage("lbl view tax rate for region") + ")";
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        dg_viewall.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Enabled";
        colBound.HeaderText = this.GetMessage("enabled");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        dg_viewall.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "Code";
        colBound.HeaderText = this.GetMessage("lbl code");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        dg_viewall.Columns.Add(colBound);

        dg_viewall.BorderColor = System.Drawing.Color.White;

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn("Id", typeof(string)));
        dt.Columns.Add(new DataColumn("Name", typeof(string)));
        dt.Columns.Add(new DataColumn("Enabled", typeof(string)));
        dt.Columns.Add(new DataColumn("Code", typeof(string)));
        dt.Columns.Add(new DataColumn("Country", typeof(string)));

        if (!(CountryRateList == null))
        {

            for (i = 0; i <= (CountryRateList.Count - 1); i++)
            {
                dr = dt.NewRow();
                dr[0] = "<a  href=\"countrytaxtables.aspx?action=View&id=" + CountryRateList[i].Id + "\">" + CountryRateList[i].Id + "</a>";
                dr[1] = "<a href=\"#ExpandContent\" onclick=\"expandcontent(\'sc" + i + "\');return false;\">" + CountryRateList[i].Name + "</a><br />";

                dr[1] += "<div class=\"switchcontent\" id=\"sc" + i + "\"><table class=\"ektronForm\"><a onclick=\"expandcontent(\'sc" + i + "\')\" href=\"countrytaxtables.aspx?action=View&id=" + CountryRateList[i].Id + "\">" + m_refMsg.GetMessage("lbl view tax rate") + "</a><br />";
                foreach (TaxClassData taxClass in TaxClassList)
                {
                    dr[1] += "<tr><td><br/><label class=\"label\" id=\"" + taxClass.Name + "\">" + taxClass.Name + "</label></td>";
                    dr[1] += "<td><input type=\"text\" size=\"10\" align=\"right\" name=\"value\" readonly=\"true\" id=\"value\" value=\"" + GetRate(taxClass.Id, CountryRateList[i].Id) * 100 + "\"/>" + "<label id=\"lblPercentage\">" + "%" + "</label></td></tr>";
                }

                dr[1] += "</table></div>";

                dr[2] = "<input type=\"CheckBox\" ID=\"chk_enabled" + i + "\" disabled=\"true\"  " + ((CountryRateList[i].Enabled) ? "Checked=\"checked\"" : "") + "/>";
                dr[3] = "<a href=\"countrytaxtables.aspx?action=View&id=" + CountryRateList[i].Id + "\">" + CountryRateList[i].ShortIsoCode + "</a>";
                dt.Rows.Add(dr);
            }
        }
        DataView dv = new DataView(dt);

        dg_viewall.DataSource = dv;
        dg_viewall.DataBind();
    }
예제 #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;
        }
        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();
    }
예제 #5
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);
        }
    }