Example #1
0
        private List <string> GetGameTypeEntries()
        {
            List <string> gameEntries = new List <string> {
                ALL_GAME_TYPE
            };

            gameEntries.AddRange(EnumExtensions.GetAllItems <Game>().Select(gameType => gameType.GetDescription <Game>()));
            return(gameEntries);
        }
Example #2
0
        private List <string> GetGameTypeEntries()
        {
            List <string> gameEntries = new List <string> {
                ALL_GAME_TYPE
            };

            foreach (var gameType in EnumExtensions.GetAllItems <Game>())
            {
                gameEntries.Add(EnumExtensions.GetDescription <Game>(gameType));
            }
            return(gameEntries);
        }
    private void PopulateStoreType()
    {
        var items = EnumExtensions.GetAllItems <StoreType>();

        dlStoreType.DataTextField  = "Text";
        dlStoreType.DataValueField = "Value";
        dlStoreType.DataSource     = items.Select(item =>
                                                  new
        {
            Text  = item.ToString(),
            Value = ((int)item).ToString()
        });
        dlStoreType.DataBind();
    }
        private void InitPageContent()
        {
            SectionTitle = AppLogic.GetString("customersupport.aspx.49", SkinID, ThisCustomer.LocaleSetting, true);
            if (IsPostBack)
            {
                return;
            }

            var options = new StringBuilder();

            //Dynamic Adding of Enum items
            var arrActivityStatus = EnumExtensions.GetAllItems <Interprise.Framework.Base.Shared.Enum.ActivityStatus>().Reverse();

            arrActivityStatus.ForEach(item => { options.AppendFormat("<option value='{0}'>{0}</option>", item.ToString()); });
            ActivityStats.Text = string.Format(options.ToString());
        }
Example #5
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load([NotNull] object sender, [NotNull] EventArgs e)
        {
            // do it only once, not on post-backs
            if (this.IsPostBack)
            {
                return;
            }

            var allItem = new ListItem(this.GetText("ALL"), "-1");

            allItem.Attributes.Add(
                "data-content",
                $"<span class=\"select2-image-select-icon\"><i class=\"fas fa-filter fa-fw text-secondary\"></i>&nbsp;{this.GetText("ALL")}</span>");

            this.Types.Items.Add(allItem);

            EnumExtensions.GetAllItems <EventLogTypes>().ForEach(
                type =>
            {
                var icon = type switch
                {
                    EventLogTypes.Error => "radiation",
                    EventLogTypes.Warning => "exclamation-triangle",
                    EventLogTypes.Information => "exclamation",
                    EventLogTypes.Debug => "exclamation-triangle",
                    EventLogTypes.Trace => "exclamation-triangle",
                    EventLogTypes.SqlError => "exclamation-triangle",
                    EventLogTypes.UserSuspended => "user-clock",
                    EventLogTypes.UserUnsuspended => "user-check",
                    EventLogTypes.UserDeleted => "user-alt-slash",
                    EventLogTypes.IpBanSet => "hand-paper",
                    EventLogTypes.IpBanLifted => "slash",
                    EventLogTypes.IpBanDetected => "hand-paper",
                    EventLogTypes.SpamBotReported => "user-ninja",
                    EventLogTypes.SpamBotDetected => "user-lock",
                    EventLogTypes.SpamMessageReported => "flag",
                    EventLogTypes.SpamMessageDetected => "shield-alt",
                    _ => "exclamation-circle"
                };

                var item = new ListItem {
                    Value = type.ToInt().ToString(), Text = type.ToString()
                };

                item.Attributes.Add(
                    "data-content",
                    $"<span class=\"select2-image-select-icon\"><i class=\"fas fa-{icon} fa-fw text-secondary\"></i>&nbsp;{type}</span>");

                this.Types.Items.Add(item);
            });

            var ci = this.Get <ILocalization>().Culture;

            if (this.Get <BoardSettings>().UseFarsiCalender&& ci.IsFarsiCulture())
            {
                this.SinceDate.Text = PersianDateConverter.ToPersianDate(PersianDate.MinValue).ToString("d");
                this.ToDate.Text    = PersianDateConverter.ToPersianDate(PersianDate.Now).ToString("d");
            }
            else
            {
                this.SinceDate.Text = DateTime.UtcNow.AddDays(-this.Get <BoardSettings>().EventLogMaxDays).ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
                this.ToDate.Text = DateTime.UtcNow.Date.ToString(
                    ci.DateTimeFormat.ShortDatePattern, CultureInfo.InvariantCulture);
            }

            this.ToDate.ToolTip = this.SinceDate.ToolTip = this.GetText("COMMON", "CAL_JQ_TT");

            // bind data to controls
            this.BindData();
        }