public async Task <ActionResult> Search(MemberSearchViewModel model)
        {
            model.Items = await _itemClient.QueryAsync(User.Identity.Name, model.Filters);

            model.Filters = "";
            return(View(model));
        }
Beispiel #2
0
        public ActionResult Index(MemberSearchViewModel model)
        {
            SysUser user = Session[SessionKey.USER] as SysUser;

            model = this.memberService.searchNPagging(model, user);

            ViewBag.stepList       = DropDownListHelper.getApplyStepListWithAll();
            ViewBag.groupList      = DropDownListHelper.getAppraiseGroupNameList(true);
            ViewBag.enrollTypeList = DropDownListHelper.getEnrollTypeList(true);
            ViewBag.andOrList      = DropDownListHelper.getAndOrList();
            return(View("Index", model));
        }
Beispiel #3
0
        public ActionResult Search(MemberSearchViewModel model)
        {
            if (string.IsNullOrEmpty(model.SearchButton) && !model.Page.HasValue)
            {
                model.Results = CreatePagedListOfMembers(this.memberService.All(), model);
                return(View(model));
            }

            var searchResults = this.memberService.Search(model.Name, model.PostCode, model.Reference);

            model.Results = CreatePagedListOfMembers(searchResults, model);

            return(View(model));
        }
        public async Task <_ListViewModel <MemberListViewModel> > Get(int startRowIndex, int numberOfRows, string firstName, string lastName, string email, string phone, int organizationId, string catchAll
                                                                      , string sortColumn = "DEFAULT", string sortDirection = "ASC"
                                                                      , bool exactMatch   = true, string clubReference      = "BRIO")
        {
            var model = new _ListViewModel <MemberListViewModel>();

            try
            {
                MemberSearchViewModel search = new MemberSearchViewModel()
                {
                    CatchAll       = catchAll,
                    Email          = email,
                    ExactMatch     = exactMatch,
                    FistName       = firstName,
                    LastName       = lastName,
                    NumberOfRows   = numberOfRows,
                    OrganizationId = organizationId,
                    Phone          = phone,
                    SortColumn     = sortColumn,
                    SortDirection  = sortDirection,
                    StartRowIndex  = startRowIndex,
                    ClubReference  = clubReference
                };

                model = await _context.GetMembersAsync(search);
            }
            catch (Exception ex)
            {
                if (model == null)
                {
                    model = new _ListViewModel <MemberListViewModel>();
                }

                if (model.Message.Length > 0)
                {
                    model.Message += " | ";
                }
                else
                {
                    model.Message = "Error: ";
                }

                model.Message += ex.Message;
            }

            return(model);
        }
Beispiel #5
0
        public ActionResult DownloadReport(MemberSearchViewModel model)
        {
            SysUser      user         = Session[SessionKey.USER] as SysUser;
            MemoryStream memoryStream = new MemoryStream();

            try
            {
                List <Member> memberList = this.memberService.search(model, user);
                MemberReport  report     = new MemberReport();
                IWorkbook     wb         = report.create(memberList);
                wb.Write(memoryStream);
            }
            catch (Exception e)
            {
                ViewBag.ErrorMessage = e.Message;
            }

            return(File(memoryStream.ToArray(), "application/vnd.ms-excel", "會員資料.xls"));
        }
Beispiel #6
0
        public ActionResult Index()
        {
            SysUser user = Session[SessionKey.USER] as SysUser;
            MemberSearchViewModel model = new MemberSearchViewModel();

            if (user.role == 1 || user.role == 3)
            {
                model.memberTypeNo = 1;
                model.step         = null;
                model.searchText   = null;
            }
            else if (user.role == 2)
            {
                model.memberTypeNo = 1;
                model.step         = 1;
                model.searchText   = null;
                model.group        = user.group;
            }

            return(Index(model));
        }
Beispiel #7
0
 private PagedMemberListViewModel CreatePagedListOfMembers(IEnumerable <Member> memberList, MemberSearchViewModel viewModel)
 {
     return(new PagedMemberListViewModel(memberList.ToPagedList(viewModel.Page ?? 1, DefaultPageSize),
                                         page => Url.Action("Index", new RouteValueDictionary
     {
         { "Page", page },
         { "Name", viewModel.Name },
         { "PostCode", viewModel.PostCode },
         { "Reference", viewModel.Reference }
     })));
 }
Beispiel #8
0
        public MemberSearchViewModel searchNPagging(MemberSearchViewModel model, SysUser user)
        {
            IQueryable <Member> memberQuery = db.Member.Where(m => m.mrMemberTypesqno == model.memberTypeNo && m.mrIsActive == "Y" && m.mrIsFinish == "Y");

            #region 經紀仲介學員
            if (model.memberTypeNo == 1)
            {
                if (model.searchText != null && model.searchText.Trim().Length > 0)  //只要這內容不為空就忽略其他條件
                {
                    memberQuery           = queryByText(memberQuery, model.searchText, model.operate, model.searchText2);
                    model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
                }
                else
                {
                    memberQuery = queryProAndSkill(memberQuery, model.searchText2);
                    if (model.step == null) // 全部階段
                    {
                        model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 0) // 待審核
                    {
                        memberQuery           = queryMemberAtStep0(memberQuery);
                        model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 1)  // 通過資格審
                    {
                        memberQuery           = queryMemberAtStep1(memberQuery, user);
                        memberQuery           = queryFirstAssignGroup(memberQuery, model.group);
                        model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 2) // 完成初審
                    {
                        memberQuery           = queryMemberAtStep2(memberQuery, user);
                        memberQuery           = queryFirstAssignGroup(memberQuery, model.group);
                        model.memberPagedList = memberQuery
                                                .OrderByDescending(m => m.MemberGroupResult.Where(res => res.AppraiseStep == 2).Average(res => res.AppraiseScore)) // 依初審平均分數由高到低排序
                                                .ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 3) // 進行複審
                    {
                        memberQuery           = queryMemberAtStep3(memberQuery, user);
                        model.memberPagedList = memberQuery
                                                .OrderByDescending(m => m.MemberGroupResult.Where(res => res.AppraiseStep == 2).Average(res => res.AppraiseScore)) // 依初審平均分數由高到低排序
                                                .ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 4) // 完成複審
                    {
                        memberQuery           = queryMemberAtStep4(memberQuery, user);
                        memberQuery           = queryFirstAssignGroup(memberQuery, model.group);
                        model.memberPagedList = memberQuery
                                                .OrderByDescending(m => m.MemberGroupResult.Where(res => res.AppraiseStep == 4).Average(res => res.AppraiseScore)) // 依複審平均分數由高到低排序
                                                .ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 5) // 正/備取名單
                    {
                        memberQuery           = queryMemberAtStep5(memberQuery);
                        memberQuery           = queryFinalGroup(memberQuery, model.group);
                        memberQuery           = queryMemberEnrollType(memberQuery, model.enrollType);
                        model.memberPagedList = memberQuery
                                                .OrderByDescending(m => m.MemberGroupResult.Where(res => res.AppraiseStep == 4).Average(res => res.AppraiseScore)) // 依複審平均分數由高到低排序
                                                .ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 6) //已通過
                    {
                        memberQuery           = queryMemberAtStep6(memberQuery);
                        memberQuery           = queryFinalGroup(memberQuery, model.group);
                        memberQuery           = queryMemberEnrollType(memberQuery, model.enrollType);
                        model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                    else if (model.step == 7) //未通過
                    {
                        memberQuery           = queryMemberAtStep7(memberQuery);
                        model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
                    }
                }

                // 重新排序各會員的歷史審查紀錄
                foreach (Member m in model.memberPagedList)
                {
                    m.MemberGroupResult = m.MemberGroupResult.OrderBy(r => r.AppraiseStep).ToList();
                }
            }
            #endregion
            #region 歷屆會員 or 一般會員
            else if (model.memberTypeNo == 2 || model.memberTypeNo == 3)
            {
                if (String.IsNullOrWhiteSpace(model.searchText) == false)
                {
                    memberQuery = queryByText(memberQuery, model.searchText, model.operate, model.searchText2);
                }
                else
                {
                    memberQuery = queryProAndSkill(memberQuery, model.searchText2);
                }
                model.memberPagedList = memberQuery.OrderBy(m => m.mrNumber).ToPagedList(model.pageNumber - 1, model.pageSize);
            }
            #endregion

            return(model);
        }
        public ActionResult Search()
        {
            var model = new MemberSearchViewModel();

            return(View(model));
        }