Beispiel #1
0
    protected void Display_ViewAll()
    {
        CatalogEntry CatalogManager = new CatalogEntry(m_refContentApi.RequestInformationRef);
        System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
        Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();

        entryCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
        entryCriteria.PagingInfo.CurrentPage = _currentPageNumber;

        entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_iID);
        entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.ContentLanguage);
        entryCriteria.AddFilter(EntryProperty.IsArchived, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, false);
        entryCriteria.AddFilter(EntryProperty.IsPublished, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);

        entryCriteria.OrderByDirection = Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending;
        entryCriteria.OrderByField = Util_GetSortColumn();

        switch (m_sPageAction)
        {
            case "browsecrosssell":
            case "browseupsell":
            case "couponselect":

                // If m_sPageAction = "couponselect" Then entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, CatalogEntryType.SubscriptionProduct)
                entryList = CatalogManager.GetList(entryCriteria);
                break;

            case "browse":

                long[] IdList = new long[3];

                IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
                // IdList(1) = Ektron.Cms.Common.EkEnumeration.CatalogEntryType.ComplexProduct
                entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
                if (excludeId > 0)
                {
                    entryCriteria.AddFilter(EntryProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, excludeId);
                }
                entryList = CatalogManager.GetList(entryCriteria);
                break;

            default:

                pnl_catalogs.Visible = true;
                pnl_viewall.Visible = false;
                System.Collections.Generic.List<CatalogData> catalogList = new System.Collections.Generic.List<CatalogData>();
                catalogList = CatalogManager.GetCatalogList(1, 1);
                Util_ShowCatalogs(catalogList);
                break;

        }

        TotalPagesNumber = System.Convert.ToInt32(entryCriteria.PagingInfo.TotalPages);

        if (TotalPagesNumber > 1) {
            SetPagingUI();
        }

        Populate_ViewCatalogGrid(entryList);
    }
Beispiel #2
0
    protected void Display_All()
    {
        System.Collections.Generic.List<TaxClassData> TaxClassList = new System.Collections.Generic.List<TaxClassData>();
        Ektron.Cms.Common.Criteria<TaxClassProperty> criteria = new Ektron.Cms.Common.Criteria<TaxClassProperty>(TaxClassProperty.Name, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        criteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;
        criteria.PagingInfo.CurrentPage = _currentPageNumber;

        TaxClassList = m_refTaxClass.GetList(criteria);

        TotalPagesNumber = System.Convert.ToInt32(criteria.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.ToDecimal(TotalPagesNumber))).ToString();

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

        dg_viewall.DataSource = TaxClassList;
        dg_viewall.Columns[0].HeaderText = this.GetMessage("generic id");
        dg_viewall.Columns[1].HeaderText = this.GetMessage("generic name");
        dg_viewall.DataBind();
    }
Beispiel #3
0
    private void GenerateTargetLanguageList(int ContentLanguage)
    {
        Ektron.Cms.Common.Criteria<LocaleProperty> criteria = new Ektron.Cms.Common.Criteria<LocaleProperty>(
        LocaleProperty.EnglishName, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        criteria.PagingInfo.RecordsPerPage = Int32.MaxValue;
        criteria.AddFilter(LocaleProperty.Enabled, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);

        List<LocaleData> locales = _locApi.GetList(criteria);
        List<LocaleData> displayLocales = new List<LocaleData>();

        if (m_intId > 0 &&
            (CmsTranslatableType.Content == m_Type || CmsTranslatableType.Product == m_Type)
            )
        {
            LocalizableCmsObjectType locObjType = LocalizableCmsObjectType.Content;
            switch (content_data.Type)
            {
                case (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.Content:
                    locObjType = LocalizableCmsObjectType.Content;
                    break;
                case (int)Ektron.Cms.Common.EkEnumeration.CMSContentType.CatalogEntry:
                    locObjType = LocalizableCmsObjectType.Product;
                    break;
                default:
                    locObjType = LocalizableCmsObjectType.DmsAsset;
                    break;
            }
            List<LocalizationObjectData> localeObjectData = new List<LocalizationObjectData>();
            Ektron.Cms.Framework.Localization.LocalizationObject localizationObject = new Ektron.Cms.Framework.Localization.LocalizationObject();
            localeObjectData = localizationObject.GetLocalizationObjectList(locObjType, m_intId, -1);
            List<LocaleData> preselectedLocales = new List<LocaleData>();
            locales.ForEach(delegate(LocaleData loc)
            {
                LanguageState enabled = (localeObjectData.FindAll(x => x.ObjectLanguage == loc.Id).Count > 0 ? LanguageState.Active : LanguageState.Undefined);
                LocaleData uiDisplayLocale = new LocaleData(loc.Id, loc.LCID, loc.EnglishName, loc.NativeName, loc.IsRightToLeft, loc.Loc, loc.Culture, loc.UICulture, loc.LangCode, loc.XmlLang, loc.FlagFile, loc.FlagUrl, loc.FallbackId, enabled);
                displayLocales.Add(uiDisplayLocale);
            });
        }
        else
        {
            displayLocales = locales;
        }

        BoundField field = default(BoundField);

        LanguageGrid.Columns.Clear();

        // Selected?
        field = new BoundField();
        field.DataField = "";
        //.HeaderText = "Export"
        field.HeaderText = "<input type=\"checkbox\" name=\"chkAll\" onclick=\"onCheckAll(this)\" checked=\"checked\" />";
        field.HtmlEncode = false;
        field.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
        field.HeaderStyle.Width = new Unit(20, UnitType.Pixel);
        field.ItemStyle.Wrap = false;
        field.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        LanguageGrid.Columns.Add(field);

        // Flag Icon
        field = new BoundField();
        field.DataField = "FlagFile";
        field.HeaderText = "";
        field.HeaderStyle.Width = new Unit(20, UnitType.Pixel);
        field.ItemStyle.Wrap = false;
        field.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        LanguageGrid.Columns.Add(field);

        // Language Name
        field = new BoundField();
        field.DataField = "CombinedName";
        field.HtmlEncode = false;
        field.SortExpression = LocaleProperty.EnglishName.ToString();
        field.HeaderText = GetMessage("generic name");
        field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
        field.ItemStyle.Wrap = false;
        LanguageGrid.Columns.Add(field);

        // Loc
        field = new BoundField();
        field.DataField = "Loc";
        field.SortExpression = LocaleProperty.Loc.ToString();
        field.HeaderText = GetMessage("lbl loc");
        field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
        field.HeaderStyle.Width = new Unit(6, UnitType.Em);
        field.ItemStyle.Wrap = false;
        field.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        LanguageGrid.Columns.Add(field);

        //// Language Code
        //field = new BoundField();
        //field.DataField = "XmlLang";
        //// or "BrowserCode"
        //field.SortExpression = EkDS.SortBy.XmlLang.ToString();
        //// or .BrowserCode
        //field.HeaderText = GetMessage("lbl code");
        //field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
        //field.HeaderStyle.Width = new Unit(6, UnitType.Em);
        //field.ItemStyle.Wrap = false;
        //field.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        //LanguageGrid.Columns.Add(field);

        // Language ID (decimal)
        field = new BoundField();
        field.DataField = "Id";
        field.SortExpression = LocaleProperty.Id.ToString();
        field.HeaderText = GetMessage("generic ID");
        field.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        field.HeaderStyle.CssClass = "right";
        field.HeaderStyle.Width = new Unit(8, UnitType.Em);
        field.ItemStyle.Wrap = false;
        field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
        field.ItemStyle.CssClass = "right";
        LanguageGrid.Columns.Add(field);

        //// Language ID (hex)
        //field = new BoundField();
        //field.DataField = "LanguageID";
        //field.HtmlEncode = false;
        //// necessary to make DataFormatString effective
        //field.DataFormatString = "{0:x4}";
        //field.HeaderText = GetMessage("lbl hex");
        //field.HeaderStyle.HorizontalAlign = HorizontalAlign.Right;
        //field.HeaderStyle.Width = new Unit(4, UnitType.Em);
        //field.ItemStyle.Wrap = false;
        //field.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
        //LanguageGrid.Columns.Add(field);

        // FireFox: border between cells is a result of the <table rules="all" attribute, which I do not know how to eliminate.

        LanguageGrid.RowDataBound += LanguageGrid_RowDataBound;

        LanguageGrid.DataSource = displayLocales;
        LanguageGrid.DataBind();
    }
Beispiel #4
0
    private void Display_ExchangeRate()
    {
        Ektron.Cms.Common.Criteria<CurrencyProperty> criteria = new Ektron.Cms.Common.Criteria<CurrencyProperty>(sortCriteria, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
            System.Collections.Generic.List<CurrencyData> currencyList;

            criteria.PagingInfo = new PagingInfo(1000);
            criteria.PagingInfo.CurrentPage = _currentPageNumber;
            criteria.AddFilter(CurrencyProperty.Enabled, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
            criteria.AddFilter(CurrencyProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, m_refCurrency.RequestInformation.CommerceSettings.DefaultCurrencyId);

            currencyList = m_refCurrency.GetList(criteria);

            ExchangeRateApi exchangeRateApi = new ExchangeRateApi();
            Ektron.Cms.Common.Criteria<Ektron.Cms.Commerce.ExchangeRateProperty> exchangeRateCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.Commerce.ExchangeRateProperty>();
            System.Collections.Generic.List<long> currencyIDList = new System.Collections.Generic.List<long>();
            for (int i = 0; i <= (currencyList.Count - 1); i++)
            {
                currencyIDList.Add(currencyList[i].Id);
            }
            if (currencyIDList.Count > 0)
            {
                exchangeRateCriteria.AddFilter(ExchangeRateProperty.BaseCurrencyId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.CommerceSettings.DefaultCurrencyId);
                exchangeRateCriteria.AddFilter(ExchangeRateProperty.ExchangeCurrencyId, Ektron.Cms.Common.CriteriaFilterOperator.In, currencyIDList.ToArray());
                exchangeRateList = exchangeRateApi.GetCurrentList(exchangeRateCriteria);

                dg_xc.DataSource = currencyList;
                dg_xc.DataBind();
            }
            else
            {
                ltr_ExchangeRateMsg.Text = GetMessage("ecomm no enabled currencies");
            }
            Util_SetJs();
            paginglinks.Visible = false;
            Util_SetLabels();
    }
Beispiel #5
0
    protected override void OnLoadComplete(EventArgs e)
    {
        base.OnLoadComplete(e);

        bool updateEnable = this.hasPermissionToEnable && ("update" == this.pageAction);
        bool saveDetail = this.hasPermissionToEdit && ("save_detail" == this.pageAction);
        this.enabling = this.hasPermissionToEnable && ("enable" == this.pageAction);
        this.editingGrid = this.hasPermissionToEdit && ("edit_grid" == this.pageAction);
        this.editingDetail = this.hasPermissionToEdit && ("edit_detail" == this.pageAction);
        this.viewing = this.hasPermissionToView && !this.enabling && !this.editingGrid && !this.editingDetail && !saveDetail;

        if (this.enabling)
        {
            this.Title = GetMessage("lbl enable languages");
        }
        else if (this.editingGrid)
        {
            this.Title = GetMessage("lbl edit languages");
        }
        else if (this.editingDetail)
        {
            this.Title = GetMessage("lbl edit language details");
        }
        else if (this.viewing)
        {
            this.Title = GetMessage("lbl view languages");
        }
        else
        {
            this.Title = GetMessage("lbl Language settings");
        }

        // UPDATE language state
        if (updateEnable)
        {
            this.UpdateLanguageState();
        }
        else if (saveDetail)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                this.SaveLocale(LocaleDetail.Locale);
                this.editingGrid = true;
            }
            else
            {
                saveDetail = false;
                this.editingDetail = true;
            }
        }

        LanguageGrid.Visible = !this.editingGrid && !this.editingDetail;
        EditableGrid.Visible = this.editingGrid && !this.editingDetail;
        LocaleDetail.Visible = this.editingDetail;
        if (!this.editingDetail)
        {
            this.visibleGrid = this.editingGrid ? EditableGrid : LanguageGrid;

            // find columns
            for (int i = 0; i < this.visibleGrid.Columns.Count; i++)
            {
                DataControlField field = this.visibleGrid.Columns[i];
                if (field != null)
                {
                    ButtonField buttonField = field as ButtonField;
                    CommandField commandField = field as CommandField;
                    BoundField boundField = field as BoundField;
                    ImageField imageField = field as ImageField;
                    if (buttonField != null)
                    {
                        buttonField.ImageUrl = Ektron.Cms.Common.EkFunctions.QualifyURL(this.appImgPath, "../UI/icons/propertiesEdit.png");
                        if ("EditDetail" == buttonField.CommandName)
                        {
                            this.editDetailIndex = i;
                        }
                    }
                    else if (commandField != null)
                    {
                        commandField.EditImageUrl = Ektron.Cms.Common.EkFunctions.QualifyURL(this.appImgPath, "../UI/icons/pencil.png");
                        commandField.UpdateImageUrl = Ektron.Cms.Common.EkFunctions.QualifyURL(this.appImgPath, "../UI/icons/save.png");
                        commandField.CancelImageUrl = Ektron.Cms.Common.EkFunctions.QualifyURL(this.appImgPath, "../UI/icons/cancel.png");
                        this.commandIndex = i;
                    }
                    else if (imageField != null)
                    {
                        switch (imageField.DataImageUrlField)
                        {
                            case "LanguageState":
                                this.languageStateIndex = i;
                                break;
                            case "FlagFile":
                            case "FlagUrl":
                                this.flagFileIndex = i;
                                break;
                        }
                    }
                    else if (boundField != null)
                    {
                        switch (boundField.DataField)
                        {
                            case "SiteEnabled":
                                this.siteEnabledIndex = i;
                                break;
                            case "Enabled":
                                this.enabledIndex = i;
                                break;
                            case "NativeName":
                                this.nativeNameIndex = i;
                                break;
                        }
                    }
                }
            }

            if (!IsPostBack || updateEnable || saveDetail)
            {
                // show/hide columns
                if (this.siteEnabledIndex >= 0)
                {
                    this.visibleGrid.Columns[this.siteEnabledIndex].Visible = this.enabling;
                }

                if (this.enabledIndex >= 0)
                {
                    this.visibleGrid.Columns[this.enabledIndex].Visible = this.enabling;
                }

                if (this.languageStateIndex >= 0)
                {
                    this.visibleGrid.Columns[this.languageStateIndex].Visible = !this.enabling;
                }
            }

            // headers
            for (int i = 0; i < this.visibleGrid.Columns.Count; i++)
            {
                DataControlField field = this.visibleGrid.Columns[i];
                if (field != null)
                {
                    string reskey = field.HeaderText;
                    if (!String.IsNullOrEmpty(reskey) && reskey.StartsWith("reskey:"))
                    {
                        reskey = reskey.Substring("reskey:".Length);
                        field.HeaderText = GetMessage(reskey);
                    }

                    string url = field.HeaderImageUrl;
                    if (!String.IsNullOrEmpty(url) && !url.StartsWith(this.appImgPath))
                    {
                        field.HeaderImageUrl = this.appImgPath + url;
                    }
                }
            }
        } // !this._editDetail

        // Get list of locales
        Ektron.Cms.Common.Criteria<LocaleProperty> criteria = new Ektron.Cms.Common.Criteria<LocaleProperty>(
                LocaleProperty.EnglishName,
                Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);
        criteria.PagingInfo.RecordsPerPage = Int32.MaxValue;

        if (this.editingGrid || this.editingDetail)
        {
            criteria.AddFilter(LocaleProperty.Enabled, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, true);
        }

        List<LocaleData> locales = this.LocaleManager.GetList(criteria);

        List<LocaleData> systemLocales = null;
        if (!IsPostBack && this.viewing)
        {
            // Compare list of locales in database with list of system cultures
            bool listChanged = false;

            systemLocales = this.localeMgrBO.GetSystemCultures();
            List<LocaleData> listInvalidFallback = systemLocales.FindAll(data => data.FallbackId > 0 && !systemLocales.Exists(d => d.Id == data.FallbackId));
            System.Diagnostics.Debug.Assert(0 == listInvalidFallback.Count, "At least one fallback language is invalid");

            List<Ektron.Cms.Localization.LocaleDataReport> report = Ektron.Cms.Localization.LocaleDataReport.CompareLocaleLists(locales, systemLocales);

            // Remove disabled custom locales
            foreach (Ektron.Cms.Localization.LocaleDataReport reportData in report.Where(d => d.Type == Ektron.Cms.Localization.LocaleDataReport.ReportType.NotSystemCulture && !d.Data.Enabled))
            {
                try
                {
                    if (!this.LocaleManager.IsLocaleUsed(reportData.Data.Id))
                    {
                        this.LocaleManager.Delete(reportData.Data.Id);
                        listChanged = true;
                    }
                }
                catch (Exception)
                {
                    // ignore, must be in use
                }
            }

            foreach (Ektron.Cms.Localization.LocaleDataReport reportData in report.Where(d => d.Type == Ektron.Cms.Localization.LocaleDataReport.ReportType.SystemCulture))
            {
                this.LocaleManager.Add(reportData.Data);
                listChanged = true;
            }

            foreach (Ektron.Cms.Localization.LocaleDataReport reportData in report.Where(d => d.Type == Ektron.Cms.Localization.LocaleDataReport.ReportType.Different))
            {
                this.LocaleManager.Update(reportData.Data);
                listChanged = true;
            }

            if (listChanged)
            {
                locales = this.LocaleManager.GetList(criteria);
            }
        }

        this.defaultLangId = this.commonApi.DefaultContentLanguage;
        LocaleData defaultData = this.LocaleManager.FindLocale(locales, this.defaultLangId);
        this.defaultLangLoc = (defaultData != null ? defaultData.Loc : string.Empty);

        if (this.visibleGrid != null)
        {
            this.visibleGrid.DataSource = this.SortLanguages(locales, this.sortExpression, this.sortDirection);
            this.visibleGrid.DataBind();
        }
        else if (this.editingDetail)
        {
            LocaleDetail.Locales = locales;
            if (null == systemLocales)
            {
                systemLocales = this.localeMgrBO.GetSystemCultures();
            }

            LocaleDetail.SystemLocales = systemLocales;
            LocaleDetail.DefaultLocaleId = this.defaultLangId;

            if (this.editIndex >= 0)
            {
                List<LocaleData> sortedLocales = this.SortLanguages(locales, this.sortExpression, this.sortDirection);
                LocaleData data = sortedLocales[this.editIndex];
                LocaleDetail.Locale = data;
            }
        }
    }
    private UserGroupData[] GetSearchedUsers()
    {
        ValidatePermissions();

            List<UserData> userDataList;
            Ektron.Cms.Common.Criteria<Ektron.Cms.User.UserProperty> userCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.User.UserProperty>();

            Ektron.Cms.Framework.Users.User userFrameworkApi = new Ektron.Cms.Framework.Users.User(Ektron.Cms.Framework.ApiAccessMode.Admin);
            int i = 0;
            int j = 0;
            int count = 0;
            UserGroupData[] userGroupData = null;
            int permissionUserType = System.Convert.ToInt32(_IsMembership ? ContentAPI.PermissionUserType.Membership : ContentAPI.PermissionUserType.Cms);
            Ektron.Cms.UserGroupData[] emptyUserGroupData = null;
            string assignedUser = (string) hdnAssignedUserGroupIds.Value;
            _AssignedUsers = assignedUser.Split(",".ToCharArray());
            //set paging size
            Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo();
            if (! this._IsSearch)
            {
                pageInfo.CurrentPage = _CurrentPage + 1;
                pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;
            }

            //_UserGroupData = _ContentApi.GetPermissionsByItem(_Id, _ItemType, 0, "", permissionUserType, ContentAPI.PermissionRequestType.UnAssigned, pageInfo)

            userCriteria.PagingInfo = pageInfo;
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText);
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.IsMemberShip, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership);
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, "internaladmin");
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.UserName, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, "builtin");
            userCriteria.AddFilter(Ektron.Cms.User.UserProperty.IsDeleted, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, true);
            userDataList = userFrameworkApi.GetList(userCriteria);

            while (i < userDataList.Count)
            {
                for (j = 0; j <= _AssignedUsers.Length - 2; j++)
                {
                    if (Convert.ToInt64(_AssignedUsers[j]) == userDataList[i].Id)
                    {
                        userDataList.Remove(userDataList[i]);
                    }
                    if (userDataList.Count == 0)
                    {
                        goto endOfWhileLoop;
                    }
                }
                i++;
            }
        endOfWhileLoop:
            i = 0;
            if (userDataList.Count > 0)
            {
                if (userDataList.Count == 1)
                {
                    userGroupData = new UserGroupData[userDataList.Count + 1];
                }
                else
                {
                    userGroupData = new UserGroupData[userDataList.Count - 1 + 1];
                }
                //isAssignedUser = isAssigned(_UserGroupData, userDataList)
                //If (isAssignedUser = False) Then
                foreach (UserData user in userDataList)
                {
                    userGroupData[i] = new UserGroupData();
                    userGroupData[i].UserId = user.Id;
                    userGroupData[i].UserName = user.Username;
                    userGroupData[i].GroupId = -1;
                    userGroupData[i].IsMemberShipUser = user.IsMemberShip;
                    i++;
                }
                //End If
            }
            //Return IIf(userGroupDataItem.GroupId <> -1, userGroupDataItem.GroupId.ToString(), userGroupDataItem.UserId.ToString())
            if (userGroupData != null)
            {
                for (j = 0; j <= userGroupData.Length - 1; j++)
                {
                    if (userGroupData[j] == null)
                    {
                        count++;
                    }
                }
                if (count == userGroupData.Length)
                {
                    return emptyUserGroupData;
                }
                else
                {
                    return userGroupData;
                }
            }
            _TotalPages = pageInfo.TotalPages;

            return emptyUserGroupData;
    }
    private UserGroupData[] GetSearchedGroups()
    {
        ValidatePermissions();

            //set paging size
            Ektron.Cms.PagingInfo pageInfo = new Ektron.Cms.PagingInfo();
            System.Collections.Generic.List<Ektron.Cms.UserGroupData> groupList = new System.Collections.Generic.List<Ektron.Cms.UserGroupData>();
            int i = 0;
            int j;
            pageInfo.CurrentPage = _CurrentPage + 1;
            pageInfo.RecordsPerPage = _ContentApi.RequestInformationRef.PagingSize;
            UserGroupData[] userGroupData = null;

            Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty> userGroupCriteria = new Ektron.Cms.Common.Criteria<Ektron.Cms.Common.UserGroupProperty>();
            userGroupCriteria.PagingInfo = pageInfo;
            userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.Name, Ektron.Cms.Common.CriteriaFilterOperator.Contains, _SearchText);
            userGroupCriteria.AddFilter(Ektron.Cms.Common.UserGroupProperty.IsMembershipGroup, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, _IsMembership);

            string assignedUser = (string) hdnAssignedUserGroupIds.Value;
            _AssignedUsers = assignedUser.Split(",".ToCharArray());
            groupList = _UserApi.GetUserGroupList(userGroupCriteria);

            if (groupList.Count > 0)
            {
                while (i < groupList.Count)
                {
                    for (j = 0; j <= _AssignedUsers.Length - 2; j++)
                    {
                        if (Convert.ToInt64(_AssignedUsers[j]) == groupList[i].GroupId)
                        {
                            groupList.Remove(groupList[i]);
                        }
                        if (groupList.Count == 0)
                        {
                            goto endOfWhileLoop;
                        }
                    }
                    i++;
                }
        endOfWhileLoop:
                if (groupList.Count == 1)
                {
                    userGroupData = new UserGroupData[groupList.Count + 1];
                }
                else
                {
                    userGroupData = new UserGroupData[groupList.Count - 1 + 1];
                }
                i = 0;

                //isAssignedUser = isAssigned(_UserGroupData, userDataList)
                //If (isAssignedUser = False) Then
                foreach (UserGroupData groupData in groupList)
                {
                    userGroupData[i] = new UserGroupData();
                    userGroupData[i].GroupId = groupData.GroupId;
                    userGroupData[i].GroupName = groupData.GroupName;
                    userGroupData[i].UserId = -1;
                    userGroupData[i].IsMemberShipUser = groupData.IsMemberShipGroup;
                    i++;
                }
                //End If
            }
            _TotalPages = pageInfo.TotalPages;
            return userGroupData;
    }
Beispiel #8
0
    protected void Display_View_All()
    {
        IPaymentGateway gatewayService = ObjectFactory.GetPaymentGateway();
        System.Collections.Generic.List<PaymentGatewayData> gatewayList;
        Ektron.Cms.Common.Criteria<PaymentGatewayProperty> paymentCriteria = new Ektron.Cms.Common.Criteria<PaymentGatewayProperty>();

        paymentCriteria.PagingInfo.CurrentPage = _currentPageNumber;
        paymentCriteria.PagingInfo.RecordsPerPage = m_refContentApi.RequestInformationRef.PagingSize;

        gatewayList = gatewayService.GetList(paymentCriteria);
        TotalPagesNumber = System.Convert.ToInt32(paymentCriteria.PagingInfo.TotalPages);

        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;
            }
        }
        dg_gateway.DataSource = gatewayList;
        dg_gateway.Columns[1].HeaderText = GetMessage("generic Gateway");
        dg_gateway.Columns[2].HeaderText = GetMessage("generic id");
        dg_gateway.Columns[3].HeaderText = GetMessage("lbl gateway default");
        dg_gateway.Columns[4].HeaderText = GetMessage("lbl custom");
        dg_gateway.Columns[5].HeaderText = GetMessage("lbl gateway userid");
        dg_gateway.Columns[6].HeaderText = GetMessage("lbl commerce payment option cc");
        dg_gateway.Columns[7].HeaderText = GetMessage("lbl commerce payment option check");
        dg_gateway.DataBind();
    }
Beispiel #9
0
    /// <summary>
    /// Handles the ServerValidate event
    /// </summary>
    /// <param name="source">The object raising the event</param>
    /// <param name="args">ServerValidate event args</param>
    private void ServerValidateHandler(object source, ServerValidateEventArgs args)
    {
        string loc = args.Value;

        // Ensure uniqueness
        Ektron.Cms.Common.Criteria<LocaleProperty> criteria = new Ektron.Cms.Common.Criteria<LocaleProperty>();

        criteria.AddFilter(LocaleProperty.Loc, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, loc); // case-insensitive
        if (this.Locale != null)
        {
            criteria.AddFilter(LocaleProperty.Id, Ektron.Cms.Common.CriteriaFilterOperator.NotEqualTo, this.Locale.Id); // may be updating existing locale
        }

        List<LocaleData> locales = this.locApi.GetList(criteria);

        args.IsValid = null == locales || 0 == locales.Count; // valid if not other locale with this loc exists
    }
Beispiel #10
0
    protected void Display_ViewAll()
    {
        CatalogEntryApi CatalogManager = new CatalogEntryApi();
        System.Collections.Generic.List<EntryData> entryList = new System.Collections.Generic.List<EntryData>();
        Ektron.Cms.Common.Criteria<EntryProperty> entryCriteria = new Ektron.Cms.Common.Criteria<EntryProperty>();
        string OrderBy = "";

        entryCriteria.AddFilter(EntryProperty.CatalogId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_iID);
        entryCriteria.AddFilter(EntryProperty.LanguageId, Ektron.Cms.Common.CriteriaFilterOperator.EqualTo, m_refContentApi.RequestInformationRef.ContentLanguage);

        if (Request.QueryString["orderby"] != null)
        {
            OrderBy = Request.QueryString["orderby"];
        }

        switch (m_sPageAction)
        {
            case "couponselect":
            case "crosssellselect":
            case "upsellselect":
            case "reportingselect":
                break;
            // do nothing
            default:
                GetProducts = true;
                GetBundles = false;
                GetComplexProducts = false;
                GetKits = false;
                long[] IdList = new long[2];
                IdList[0] = Convert.ToInt64(Ektron.Cms.Common.EkEnumeration.CatalogEntryType.Product);
                entryCriteria.AddFilter(EntryProperty.EntryType, Ektron.Cms.Common.CriteriaFilterOperator.In, IdList);
                break;
        }

        switch (OrderBy.ToLower())
        {
            case "title":
                entryCriteria.OrderByField = EntryProperty.Title;
                break;
            case "language":
                entryCriteria.OrderByField = EntryProperty.LanguageId;
                break;
            case "id":
                entryCriteria.OrderByField = EntryProperty.Id;
                break;
            case "status":
                entryCriteria.OrderByField = EntryProperty.Status;
                break;
            case "datemodified":
                entryCriteria.OrderByField = EntryProperty.EntryType;
                break;
            case "editor":
                entryCriteria.OrderByField = EntryProperty.ListPrice;
                break;
            default:
                entryCriteria.OrderByField = EntryProperty.LastEditDate;
                break;
        }

        entryCriteria.PagingInfo.CurrentPage = this.ucPaging.SelectedPage + 1;
        entryList = CatalogManager.GetList(entryCriteria);

        if (entryCriteria.PagingInfo.TotalPages > 1)
        {
            this.ucPaging.Visible = true;
            this.ucPaging.TotalPages = entryCriteria.PagingInfo.TotalPages;
            this.ucPaging.CurrentPageIndex = this.ucPaging.SelectedPage;
        }

        if (TotalPagesNumber <= 1)
        {
            TotalPages.Visible = false;
            CurrentPage.Visible = false;
            PageLabel.Visible = false;
            OfLabel.Visible = false;
        }
        else
        {
            TotalPages.Visible = true;
            CurrentPage.Visible = true;
            PageLabel.Visible = true;
            OfLabel.Visible = true;
            TotalPages.Text = (System.Math.Ceiling(Convert.ToDecimal(TotalPagesNumber))).ToString();
            TotalPages.ToolTip = TotalPages.Text;
            CurrentPage.Text = _currentPageNumber.ToString();
            CurrentPage.ToolTip = CurrentPage.Text;
        }

        Populate_ViewCatalogGrid(entryList);
    }