コード例 #1
0
 public ActionResult Delete(List <string> ids)
 {
     try
     {
         var objList = _projectMemberService.GetFullList(z => ids.Contains(z.Id), z => z.Id, OrderingType.Ascending);
         _projectMemberService.DeleteAll(objList);
         SetMessager(MessageType.success, "删除成功!");
     }
     catch (Exception e)
     {
         SetMessager(MessageType.danger, $"删除失败【{e.Message}!");
     }
     return(RedirectToAction("Index"));
 }
コード例 #2
0
        /// <summary>
        /// 获取项目列表
        /// </summary>
        /// <returns></returns>
        public ActionResult GetList(string session)
        {
            try
            {
                AdminUserInfo adminUser = null;
                adminUser = VerifySession(session, adminUser, _adminUserInfoService);

                if (adminUser == null)
                {
                    return(Json(new
                    {
                        code = -1,
                        msg = "请先登录",
                        data = new
                        {
                        }
                    }));
                }

                var curactivity = _senparcEntities.Activities.Where(x => x.IsPublish).OrderByDescending(x => x.IssueTime).FirstOrDefault();
                // _activityService.GetFullList(x => x.IsPublish, x => x.IssueTime, Core.Enums.OrderingType.Descending).FirstOrDefault();
                if (curactivity == null)
                {
                    return(Json(new
                    {
                        code = -1,
                        msg = "暂时没有活动可参与",
                        data = new
                        {
                        }
                    }));
                }
                // var scheduleList = _scheduleService.GetFullList(x => x.ActivityId == curactivity.Id, x => x.StartTime, Core.Enums.OrderingType.Ascending).Select(x => x.Id);

                var scheduleList = _senparcEntities.Schedules.Where(x => x.ActivityId == curactivity.Id).OrderBy(x => x.StartTime).Select(x => x.Id).ToList();
                if (scheduleList.Count() == 0)
                {
                    if (curactivity == null)
                    {
                        return(Json(new
                        {
                            code = -1,
                            msg = "主办方未安排赛程",
                            data = new
                            {
                            }
                        }));
                    }
                }

                var i   = 0;
                var cpc = _competitionProgramService.GetFullList(x => scheduleList.Contains(x.ScheduleId) && x.ControlId == adminUser.UserName, x => x.Status, Core.Enums.OrderingType.Ascending)
                          .GroupBy(x => x.Cate).Select(x => new CompetitionProgramViewModel
                {
                    Cate = x.Key,
                    List = x.Where(c => c.Cate == x.Key).Select(c =>
                    {
                        var addrName = string.Empty;
                        if (c.Schedule == null && !string.IsNullOrEmpty(c.ScheduleId))
                        {
                            var schedule = _scheduleService.GetObject(s => s.Id == c.ScheduleId);

                            if (schedule != null)
                            {
                                addrName = schedule.Address;
                            }
                        }
                        else if (c.Schedule != null)
                        {
                            addrName = c.Schedule.Address;
                        }
                        var mlist = _projectMemberService.GetFullList(m => m.ProjectId == c.Id, m => m.Sort, OrderingType.Ascending).ToList();

                        return(new CompetitionProgramVM
                        {
                            Id = c.Id,
                            Name = c.Name,
                            Address = addrName,
                            SignNum = c.SignNum,
                            Sort = i++,
                            Status = c.Status,
                            BdImgUrl = c.BdImgUrl,
                            BdImgUrlPwd = c.BdImgUrlPwd,
                            IsSign = !string.IsNullOrEmpty(c.SignNum),
                            ProjectMembers = mlist.Select(mm => new MemberModel
                            {
                                Id = mm.Id ?? "",
                                IdCard = mm.IdCard ?? "",
                                ProjectId = mm.ProjectId ?? "",
                                IdCardImgUrl = mm.IdCardImgUrl ?? "",
                                Name = mm.Name ?? "",
                                Phone = mm.Phone ?? "",
                                Company = mm.Company ?? "",
                                Nation = mm.Nation ?? "",
                                Duty = mm.Duty ?? ""
                            }).ToList()
                        });
                    }).ToList()
                }).ToList();

                //var cpc = _senparcEntities.CompetitionPrograms.Where(x=>scheduleList.Contains(x.ScheduleId) && x.ControlId == adminUser.UserName).OrderBy(x=>x.Status)
                //    .GroupBy(x => x.Cate).Select(x=> {
                //    })

                return(Json(new
                {
                    code = 0,
                    msg = "成功获取数据",
                    data = cpc
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    code = -1,
                    msg = "服务器异常:" + ex.Message,
                    data = new
                    {
                    }
                }));
            }
        }
コード例 #3
0
        public ActionResult GetComposeList(string session)
        {
            try
            {
                AdminUserInfo adminUser = null;
                adminUser = VerifySession(session, adminUser, _adminUserInfoService);
                if (adminUser == null)
                {
                    return(Json(new
                    {
                        code = -1,
                        msg = "请先登录",
                        data = new
                        {
                        }
                    }));
                }


                //return Json(new
                //{
                //    code =0,
                //    msg = "ok",
                //    data = list
                //});

                var curactivity = _activityService.GetFullList(x => x.IsPublish, x => x.IssueTime, Core.Enums.OrderingType.Descending).FirstOrDefault();
                if (curactivity == null)
                {
                    return(Json(new
                    {
                        code = -1,
                        msg = "暂时没有活动可参与",
                        data = new
                        {
                        }
                    }));
                }
                var scheduleList = _scheduleService.GetFullList(x => x.ActivityId == curactivity.Id, x => x.StartTime, Core.Enums.OrderingType.Ascending).Select(x => x).ToList();
                if (scheduleList.Count() == 0)
                {
                    if (curactivity == null)
                    {
                        return(Json(new
                        {
                            code = -1,
                            msg = "主办方未安排赛程",
                            data = new
                            {
                            }
                        }));
                    }
                }
                // var modelList = _scheduleService;
                //var vd = new Schedule_IndexVD()
                //{
                //    ScheduleList = modelList,
                //    kw = kw
                //};
                return(Json(new
                {
                    code = 0,
                    msg = "获取数据成功",
                    data = scheduleList.Select(x =>
                    {
                        var i = 0;

                        var list = _competitionProgramService.GetFullList(c => x.Id == (c.ScheduleId) && c.ControlId == adminUser.UserName, c => c.Status, Core.Enums.OrderingType.Ascending)
                                   .GroupBy(c => c.Cate).Select(c => new CompetitionProgramViewModel
                        {
                            Cate = c.Key,
                            List = c.Where(y => y.Cate == c.Key).Select(v =>
                            {
                                var addrName = string.Empty;
                                if (v.Schedule == null && !string.IsNullOrEmpty(v.ScheduleId))
                                {
                                    var schedule = _scheduleService.GetObject(s => s.Id == v.ScheduleId);

                                    if (schedule != null)
                                    {
                                        addrName = schedule.Address;
                                    }
                                }
                                else if (v.Schedule != null)
                                {
                                    addrName = v.Schedule.Address;
                                }
                                var mlist = _projectMemberService.GetFullList(m => m.ProjectId == v.Id, m => m.Sort, OrderingType.Ascending).ToList();

                                return new CompetitionProgramVM
                                {
                                    Id = v.Id,
                                    Name = v.Name,
                                    Address = addrName,
                                    SignNum = v.SignNum,

                                    Sort = i++,
                                    Status = v.Status,
                                    IsSign = !string.IsNullOrEmpty(v.SignNum),
                                    BdImgUrl = v.BdImgUrl,
                                    BdImgUrlPwd = v.BdImgUrlPwd,
                                    ProjectMembers = mlist.Select(mm => new MemberModel
                                    {
                                        Id = mm.Id ?? "",
                                        IdCard = mm.IdCard ?? "",
                                        ProjectId = mm.ProjectId ?? "",
                                        IdCardImgUrl = mm.IdCardImgUrl ?? "",
                                        Name = mm.Name ?? "",
                                        Phone = mm.Phone ?? "",
                                        Company = mm.Company ?? "",
                                        Nation = mm.Nation ?? "",
                                        Duty = mm.Duty ?? ""
                                    }).ToList()
                                };
                            }).ToList()
                        }).ToList();


                        return new
                        {
                            x.Id,
                            x.ActivityId,
                            ActivityTitle = x.Activity.Title,
                            ActivityRemark = x.Activity.Summary,
                            ActivityDesc = x.Activity.Description,
                            x.Activity.ScheduleStatus,
                            x.Activity.IsPublish,
                            x.Name,
                            x.Address,
                            x.StartTime,
                            x.EndTime,
                            x.Sort,
                            x.Remark,
                            x.SignNumber,
                            x.Desc,
                            x.CreateTime,
                            x.Flag,
                            CompetitionPrograms = list
                        };
                    })
                }));
            }
            catch (Exception ex)
            {
                return(Json(new
                {
                    code = -1,
                    msg = "服务器异常:" + ex.Message,
                    data = new { }
                }));
            }
        }