// 我的计划 参考tita计划
        // GET: /Platform/MyPlan/

        public ActionResult Index(DateTime?date, string keyword)
        {
            date         = date.HasValue ? date : DateTime.Today;
            ViewBag.date = date;

            ViewBag.ProjectInfoId = new SelectList(
                _iProjectInfoService.GetAll()
                .Where(a => !a.Finish && a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow))
                .Select(a => new { a.Id, a.ProjectName }), "Id", "ProjectName");

            var model = _iPlanService.GetAll(a => a.UserId == _iUserInfo.UserId).Search(keyword);

            return(View(model));
        }
        public ActionResult Index(string keywords, bool?finish, int pageIndex = 1, int pageSize = 10)
        {
            var model = _iProjectInfoService.GetAll(a => a.Public && a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && b.Follow));

            if (!string.IsNullOrEmpty(keywords))
            {
                model =
                    model.Where(
                        a =>
                        a.ProjectName.Contains(keywords) || a.ProjectObjective.Contains(keywords) ||
                        a.Tag.Contains(keywords) || a.ProjectUsers.Any(b => b.SysUser.UserName == keywords));
            }

            if (finish.HasValue)
            {
                model = model.Where(a => a.Finish == finish);
            }

            //子项目
            var subModel = model.Where(a => a.LastProjectInfoId != null);
            //主项目
            var mainModel = model.Where(a => a.LastProjectInfoId == null).ToPagedList(pageIndex, pageSize);

            var mainList = new List <ProjectInfo>()
            {
            };

            foreach (var item in mainModel)
            {
                mainList.Add(item);
                mainList.AddRange((subModel as IQueryable <ProjectInfo>).Where(a => a.LastProjectInfoId == item.Id));
            }

            var m = mainList.Select(
                a => new
            {
                a.Id,
                a.UserId,
                Leader           = a.ProjectUsers != null ? a.ProjectUsers.Where(b => b.Leader).Select(b => b.SysUser.DisplayName) : null,
                ProjectInfoState = a.ProjectInfoState != null ? a.ProjectInfoState.ProjectInfoStateName : null,
                Follow           = a.Public && (a.ProjectUsers != null ? a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && b.Follow) : false),
                a.LastProjectInfoId,
                a.Raty,
                a.Public,
                PlanCount   = a.Plans.Count(p => !p.Deleted),
                TaskCount   = a.ProjectTasks.Count(t => !t.Deleted),
                ReplyCount  = a.ProjectInfoReplys.Count(r => !r.Deleted),
                MemberCount = a.ProjectUsers != null ? a.ProjectUsers.Count(b => !b.Follow) : 0,
                a.CustomerId,
                a.Tag,
                a.StarTime,
                a.EndTime,
                a.Finish,
                a.ProjectName,
                a.ProjectObjective,
                a.CreatedDate
            });

            return(Content(JsonConvert.SerializeObject(m)));
        }
Esempio n. 3
0
        // 知识库
        // GET: /Platform/ProjectFinancial/

        public ActionResult Index(string keywords, int pageIndex = 1, int pageSize = 10)
        {
            //筛选项目成员中包含我的
            var model =
                _iProjectInfoService.GetAll(a => a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow))
                .Select(
                    a =>
                    new
            {
                a.ProjectName,
                Count             = a.ProjectFinancials.Count(b => !b.Deleted),
                AccountReceivable =
                    a.ProjectFinancials.Any(b => !b.Deleted)
                                        ? a.ProjectFinancials.Where(b => !b.Deleted).Sum(b => b.AccountReceivable)
                                        : 0,
                PaidIn     = a.ProjectFinancials.Where(b => !b.Deleted).Sum(b => b.PaidIn),
                Difference =
                    a.ProjectFinancials.Where(b => !b.Deleted).Sum(b => b.AccountReceivable - b.PaidIn),
                Finish = a.ProjectFinancials.All(b => b.Finish)
            }).Where(a => a.Count > 0).Search(keywords);

            model = model.OrderBy(a => a.Finish).ThenByDescending(a => a.Difference);

            var result = model.Select(a => new
            {
                a.ProjectName,
                a.Count,
                a.AccountReceivable,
                a.PaidIn,
                a.Difference,
                a.Finish
            }).ToPagedList(pageIndex, pageSize);

            return(Content(JsonConvert.SerializeObject(result)));
        }
Esempio n. 4
0
        //
        // GET: /Platform/MyCreateWork/

        public ActionResult Index(string keyword, bool?finish, int pageIndex = 1)
        {
            IQueryable <ProjectInfo> model =
                _iProjectInfoService.GetAll(a => a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && b.Leader));

            //为了显示子项目准备
            ViewBag.ProjectInfo = model.Where(a => a.LastProjectInfoId != null);


            if (!string.IsNullOrEmpty(keyword))
            {
                model =
                    model.Where(
                        a =>
                        a.ProjectName.Contains(keyword) || a.ProjectObjective.Contains(keyword) ||
                        a.Tag.Contains(keyword) || a.ProjectUsers.Any(b => b.SysUser.UserName == keyword));
            }
            else
            {
                //筛选主项目
                model = model.Where(a => a.LastProjectInfoId == null);
            }

            ViewBag.CountAll = model.Count();
            ViewBag.unfinish = model.Count(a => !a.Finish);
            ViewBag.finish   = model.Count(a => a.Finish);

            if (finish.HasValue)
            {
                model = model.Where(a => a.Finish == finish);
            }

            return(View(model.ToPagedList(pageIndex)));
        }
        //
        // GET: /Platform/ProjectInfoCount/

        public ActionResult Index()
        {
            var model  = _IProjectInfoService.GetAll(a => a.LastProjectInfoId == null);
            var result = new
            {
                unfinished = model.Count(a => !a.Finish),
                finished   = model.Count(a => a.Finish)
            };

            return(Content(JsonConvert.SerializeObject(result)));
        }
        //
        // GET: /Platform/ProjectFinancial/Edit/5

        public ActionResult Edit(Guid?id)
        {
            var item = new ProjectFinancial();

            if (id.HasValue)
            {
                item = _iProjectFinancialService.GetById(id.Value);
            }
            ViewBag.ProjectInfoId =
                new SelectList(
                    _iProjectInfoService.GetAll(
                        a => a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow)), "Id",
                    "ProjectName", item.ProjectInfoId);
            return(View(item));
        }
        // 项目信息统计报表
        // GET: /Platform/ProjectInfoReport/

        public ActionResult Index(string keyword, int pageIndex = 1)
        {
            IQueryable <ProjectInfo> model =
                _iProjectInfoService.GetAll(a => a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow));

            if (!string.IsNullOrEmpty(keyword))
            {
                model =
                    model.Where(
                        a =>
                        a.ProjectName.Contains(keyword) || a.ProjectObjective.Contains(keyword) ||
                        a.Tag.Contains(keyword) || a.ProjectUsers.Any(b => b.SysUser.UserName == keyword));
            }

            return(View(model.ToPagedList(pageIndex)));
        }
        //
        // GET: /Admin/Desktop/

        public ActionResult Index()
        {
            ViewBag.UserId = _iUserInfo.UserId;
            IOrderedQueryable <ProjectTask> model =
                _iProjectTaskService.GetAll(a => (a.ProjectInfo == null || !a.ProjectInfo.Deleted) && !a.Finish)
                .OrderBy(a => a.EndTime);

            ViewBag.ProjectInfo = _iProjectInfoService.GetAll(a => !a.Finish);

            ViewBag.Message = _iMessageService.GetAll(a => a.SysUserId == _iUserInfo.UserId).Take(5);

            ViewBag.Plan =
                _iPlanService.GetAll(a => !a.Finish && a.UserId == _iUserInfo.UserId && a.StartDate < DateTime.Now);

            ViewBag.CustomerCount = _ICustomerService.GetAll().Count();

            return(View(model));
        }
        // 知识库
        // GET: /Platform/ProjectFinancial/

        public ActionResult Index(string keyword, string ordering, int pageIndex = 1)
        {
            //筛选项目成员中包含我的
            var model =
                _iProjectInfoService.GetAll(a => a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow))
                .Select(
                    a =>
                    new
            {
                a.ProjectName,
                Count             = a.ProjectFinancials.Count(b => !b.Deleted),
                AccountReceivable =
                    a.ProjectFinancials.Any(b => !b.Deleted)
                                        ? a.ProjectFinancials.Where(b => !b.Deleted).Sum(b => b.AccountReceivable)
                                        : 0,
                PaidIn     = a.ProjectFinancials.Where(b => !b.Deleted).Sum(b => b.PaidIn),
                Difference =
                    a.ProjectFinancials.Where(b => !b.Deleted).Sum(b => b.AccountReceivable - b.PaidIn),
                Finish = a.ProjectFinancials.All(b => b.Finish)
            }).Where(a => a.Count > 0).Search(keyword);

            model = model.OrderBy(a => a.Finish).ThenByDescending(a => a.Difference);

            if (!string.IsNullOrEmpty(ordering))
            {
                model = model.OrderBy(ordering, null);
            }

            if (!string.IsNullOrEmpty(Request["report"]))
            {
                //导出
                var reportModel = new Report(model.ToReportSource());
                return(new ReportResult(reportModel));
            }

            return(View(model.ToPagedList(pageIndex)));
        }
        public ActionResult Edit(Guid?id)
        {
            ViewBag.Id = id;

            var item = new ProjectTask();



            if (id.HasValue)
            {
                item = _iProjectTaskService.GetById(id.Value);
            }



            ViewBag.ProjectInfoId =
                new SelectList(
                    _iProjectInfoService.GetAll()
                    .Where(a => !a.Finish && a.ProjectUsers.Any(b => b.SysUserId == _iUserInfo.UserId && !b.Follow))
                    .Select(a => new { a.Id, a.ProjectName }), "Id", "ProjectName", item.ProjectInfoId);
            ViewBag.SysDepartment = _iSysDepartmentService.GetAll();

            return(View(item));
        }
        //
        // GET: /Platform/ProjectInfoCount/

        public ActionResult Index()
        {
            IQueryable <ProjectInfo> model = _IProjectInfoService.GetAll(a => a.LastProjectInfoId == null);

            return(View(model));
        }