Esempio n. 1
0
        private List <SelectItem> GetCategory(string categoryCode, string search, bool notLike)
        {
            List <SelectItem> result = new List <SelectItem>();
            var query = BaseCodeService.GetItemsByCategory(categoryCode);

            if (!string.IsNullOrEmpty(search))
            {
                if (notLike)
                {
                    string[] values = search.Split(',');
                    query = query.Where(o => values.Contains(o.Key)).ToList();
                }
                else
                {
                    query = query.Where(o => o.Value.IndexOf(search, StringComparison.CurrentCultureIgnoreCase) > -1 || o.Key.IndexOf(search, StringComparison.CurrentCultureIgnoreCase) > -1).ToList();
                }
            }
            else if (notLike)
            {
                return(result);
            }
            result = query.OrderBy(o => o.Value)
                     .Select(o => new SelectItem()
            {
                key = o.Key, value = o.Value
            })
                     .ToList();

            return(result);
        }
Esempio n. 2
0
        public JsonResult GetBaseCategory(string category)
        {
            var list = BaseCodeService.GetItemsByCategory(category);
            var data = list.Select(o => new { id = o.Key, text = o.Value }).ToList();

            return(Json(new JsonResultDataEntity <object>()
            {
                Code = 0, Data = data
            }));
        }
Esempio n. 3
0
        public string GetDispalyName(string[] categories)
        {
            List <string> lst = new List <string>();

            foreach (var item in categories)
            {
                lst.Add(BaseCodeService.GetDispalyName(_companyType, item));
            }
            return(string.Join(",", lst));
        }