示例#1
0
        public ActionResult Contragents_getItems()
        {
            var parameters = AjaxModel.GetParameters(HttpContext);
            var mng        = new FinanceManager();
            var items      = mng.GetFinContragents().AsQueryable();

            string nameFilter;

            if (GetStringFilter(parameters.filter, "name", out nameFilter))
            {
                items = items.Where(i => i.name.Contains(nameFilter));
            }

            int clientId;

            if (GetIntFilter(parameters.filter, "clientName", out clientId))
            {
                items = items.Where(i => i.clientID == clientId);
            }

            int humanId;

            if (GetIntFilter(parameters.filter, "humanName", out humanId))
            {
                items = items.Where(i => i.humanID == humanId);
            }

            var orderedItems = items.OrderByDescending(x => x.name);
            var sorts        = parameters.sort.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);
            var directions   = parameters.direction.Split(",".ToArray(), StringSplitOptions.RemoveEmptyEntries);

            if (sorts.Length > 0 && directions.Length > 0)
            {
                var sortExpression = GetSortExpression(sorts[0]);
                if (sortExpression != null)
                {
                    orderedItems = (directions[0] == "up")
                        ? orderedItems.OrderBy(sortExpression)
                        : orderedItems.OrderByDescending(sortExpression);
                }
            }

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

            return(Json(new
            {
                items = res2.Select(x => new
                {
                    x.id,
                    x.name,
                    x.clientID,
                    clientName = x.crm_clients != null ? x.crm_clients.fio : "",
                    x.humanID,
                    humanName = x.hr_humans != null ? x.hr_humans.fio : ""
                }),
                total
            }, JsonRequestBehavior.AllowGet));
        }
示例#2
0
        public ActionResult Docs()
        {
            var mng    = new DocsManager();
            var finMng = new FinanceManager();

            ViewBag.DocTypes       = mng.GetDocTypes();
            ViewBag.DocStatuses    = mng.GetDocStatuses();
            ViewBag.FinProjects    = finMng.GetProjects().OrderBy(x => x.name).ToList();
            ViewBag.FinContragents = finMng.GetFinContragents().OrderBy(x => x.name).ToList();
            return(View());
        }
示例#3
0
        // GET: Finances
        public ActionResult Index()
        {
            var mng     = new FinanceManager();
            var mng_hr  = new HRManager();
            var mng_crm = new CRMManager();

            ViewBag.contragentName = mng.GetFinContragents();
            ViewBag.typeName       = mng.GetFinTypes();
            ViewBag.projectName    = mng.GetProjects();
            ViewBag.statusName     = mng.GetFinStatuses();
            ViewBag.hrName         = mng_hr.GetHumans();
            ViewBag.crmName        = mng_crm.GetClients();
            return(View());
        }