Esempio n. 1
0
        public static UICategory GetYearCategory(string queryField, int before = 5, int after = 1, bool hasAllAttr = true, string name = "年份", string key = "Year")
        {
            var category = new UICategory();

            category.Name       = name;
            category.Key        = key;
            category.QueryField = queryField;
            if (hasAllAttr)
            {
                var item = new CategroyItem();
                item.Name      = "全部";
                item.Value     = "All";
                item.IsDefault = true;
                item.SortIndex = 0;
                category.Items.Add(item);
            }
            var date = DateTime.Now;

            for (int i = date.Year - before; i < date.Year + after; i++)
            {
                var item = new CategroyItem();
                item.Name      = i.ToString() + "年";
                item.Value     = i.ToString();
                item.SortIndex = i + 1;
                category.Items.Add(item);
            }
            return(category);
        }
Esempio n. 2
0
        public static UICategory GetCategoryByString(string enumJson, string name, string queryField, bool hasAllAttr = true)
        {
            var category = new UICategory();

            category.Name = name;

            category.QueryField = queryField;
            if (hasAllAttr)
            {
                var item = new CategroyItem();
                item.Name      = "全部";
                item.Value     = "All";
                item.SortIndex = 0;
                item.IsDefault = true;
                category.Items.Add(item);
            }
            var list = JsonHelper.ToList(enumJson);

            foreach (var e in list)
            {
                var item = new CategroyItem();
                item.Name  = e["text"].ToString();
                item.Value = e["value"].ToString();
                category.Items.Add(item);
            }

            return(category);
        }
Esempio n. 3
0
        public static UICategory GetQuarterCategory(string queryField, bool hasAllAttr = true, string name = "季度", string key = "Quarter")
        {
            var category = new UICategory();

            category.Name       = name;
            category.Key        = key;
            category.QueryField = queryField;
            if (hasAllAttr)
            {
                var item = new CategroyItem();
                item.Name      = "全部";
                item.Value     = "All";
                item.IsDefault = true;
                item.SortIndex = 0;
                category.Items.Add(item);
            }
            return(category);
        }