Esempio n. 1
0
        /// <summary>
        /// 得到当前正在执行的项目
        /// </summary>
        /// <returns></returns>
        public JArray GetActive()
        {
            //所有的可报名的
            var projects = new ProjectBLL().GetAll().Where(item => item.IsActive == true);

            //得到 当前此人参加的项目,并且是激活状态的项目id ,(可报名的)
            ProjectBLL projectBll   = new ProjectBLL();
            var        projectInfos = projectBll.GetEnterProject(this.Request);

            if (projectInfos.Any())
            {
                //所有的可报名的。并且已经报名的
                var infos = projectInfos.Where(item => item.IsActive == true);
                if (infos.Any())
                {
                    //已经参加的项目,并且在可报名利表中的
                    var ids       = infos.Select(item => item.ID);
                    var _projects = projects.Select(item => new
                    {
                        Entered     = ids.Contains(item.ID),
                        ID          = item.ID,
                        DisplayName = item.DisplayName,
                        Remark      = item.Remark,
                        CreateTime  = item.CreateTime,
                        IsActive    = item.IsActive,
                        IsDisplay   = item.IsDisplay
                    });
                    return(JArray.Parse(JsonConvert.SerializeObject(_projects)));
                }
            }
            return(JArray.Parse(JsonConvert.SerializeObject(projects)));
        }
Esempio n. 2
0
        /// <summary>
        /// 得到当前这个人之前参加过的项目列表,并且已经关闭的
        /// </summary>
        /// <returns></returns>
        public JArray GetAttended()
        {
            ProjectBLL projectBll   = new ProjectBLL();
            var        projectInfos = projectBll.GetEnterProject(this.Request);

            if (projectInfos.Any())
            {
                var infos = projectInfos.Where(item => item.IsActive == false);
                if (infos.Any())
                {
                    return(JArray.Parse(JsonConvert.SerializeObject(infos)));
                }
            }
            return(new JArray());
        }