public ActionResult Sources_getItems()
        {
            var parameters = AjaxModel.GetParameters(HttpContext);
            var mng = new CRMManager();
            var items = mng.GetClientSources();

            var res = items.Select(item => new crm_sources
            {
                id = item.id,
                name = item.name,
                code = item.code,
                desc = item.desc
            }).AsQueryable();

            var sorts = parameters.sort.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);
            var directions = parameters.direction.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);
            var sort1 = sorts.Length > 0 ? sorts[0] : "";
            var direction1 = directions.Length > 0 ? directions[0] : "";

            switch (sort1)
            {
                case "name":
                    if (direction1 == "up") res = res.OrderBy(x => x.name);
                    else res = res.OrderByDescending(x => x.name);
                    break;

                case "code":
                    if (direction1 == "up") res = res.OrderBy(x => x.code);
                    else res = res.OrderByDescending(x => x.code);
                    break;
                case "desc":
                    if (direction1 == "up") res = res.OrderBy(x => x.desc);
                    else res = res.OrderByDescending(x => x.desc);
                    break;
                default:
                    if (direction1 == "up") res = res.OrderBy(x => x.name);
                    else res = res.OrderByDescending(x => x.name);
                    break;
            }

            var total = res.Count();
            var res2 = res.Skip(parameters.pageSize * (parameters.page - 1)).Take(parameters.pageSize).ToList();

            return Json(new 
            {
                items =res2.Select(x=> new
                {
                    x.id,
                    x.name,
                    x.code,
                    x.desc,
                }),
                total = items.Count
            }, JsonRequestBehavior.AllowGet);
        }