// GET: Enroll public ActionResult Index(string searchBy, string search, int?page, int?pagesize) { List <Student> studentl = db.Students.ToList(); List <Class> classl = db.Classes.ToList(); ViewBag.StudentList = new SelectList(studentl, "stuId", "fullname"); ViewBag.ClassList = new SelectList(classl, "classId", "classNumber"); int defaultpagesize = 6; if (pagesize != null) { defaultpagesize = (int)pagesize; } List <EnrollViewModel> l = db.Enrolls.Where(x => x.IsDeleted == false).Select(x => new EnrollViewModel { stuId = x.stuId, classId = x.classId, grade = x.grade, firstName = x.Student.firstName, lastName = x.Student.lastName, classNumber = x.Class.classNumber }).ToList(); EnrollListViewModel e = new EnrollListViewModel(); EnrollViewModel enroll = new EnrollViewModel(); if (search != null) { if (searchBy == "Student Name") { e.ipage = l.Where(x => x.fullname.ToLower().StartsWith(search.ToLower()) || search == null).ToList().ToPagedList(page ?? 1, defaultpagesize); //e.enroll = enroll; return(View(e)); } else if (searchBy == "Class Number") { e.ipage = l.Where(x => x.classNumber.ToLower().StartsWith(search.ToLower()) || search == null).ToList().ToPagedList(page ?? 1, defaultpagesize); //e.enroll = enroll; return(View(e)); } else if (searchBy == "Grade") { e.ipage = l.Where(x => x.grade.ToLower().StartsWith(search.ToLower()) || search == null).ToList().ToPagedList(page ?? 1, defaultpagesize); //e.enroll = enroll; return(View(e)); } } //else //{ e.ipage = l.ToList().ToPagedList(page ?? 1, defaultpagesize); //e.enroll = enroll; return(View(e)); //} }
protected async override void OnAppearing() { base.OnAppearing(); IsBusy = true; if (mCurrentPage == 0) { mCurrentPage = 1; } EnrollListResponseResult enrollListResponseResult = await App.EnrollManager.GetAllByPage(mCurrentPage, 10); BindingContext = new EnrollListViewModel(enrollListResponseResult, mCurrentPage); IsBusy = false; }
/// <summary> /// Return the index view of enroll /// </summary> /// <returns></returns> public ActionResult Index() { EnrollListViewModel enrollListVM = new EnrollListViewModel(); List <Enroll> enrolls = enrollBL.GetEnrolls(); List <EnrollViewModel> enrollVMs = new List <EnrollViewModel>(); foreach (Enroll enroll in enrolls) { EnrollViewModel enrollVM = new EnrollViewModel(enroll); enrollVMs.Add(enrollVM); } enrollListVM.EnrollVMs = enrollVMs; return(View("Index", enrollListVM)); }
/// <summary> /// 直报页面绑定下拉框,直接报名 /// </summary> /// <returns></returns> public ActionResult DirectEnroll() { EnrollListViewModel model = new EnrollListViewModel(); //页面模型 //分校下拉项 List <CommonEntity> ComCodeIL = CommonData.Get_SYS_Company_COMP_Code(UserSession.comcode); //分校 model.ComCodeIL = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL); model.search.ComCodeIL = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL); //来源渠道 List <CommonEntity> SourceIL = CommonData.GetDictionaryList(2);//1是字典类型值,仅供测试参考 model.SourceIL = CommonData.Instance.GetBropDownListData(SourceIL); return(View(model));//返回页面模型 }
/// <summary> /// 报名记录 /// </summary> /// <returns></returns> public ActionResult EnrollList(EnrollListSearchModel search) { EnrollListViewModel model = new EnrollListViewModel(); //页面模型 model.search = search; //页面的搜索模型 model.search.PageSize = 15; //每页显示 model.search.CurrentPage = Convert.ToInt32(Request["pageindex"]) <= 0 ? 1 : Convert.ToInt32(Request["pageindex"]); //当前页 //根据方式拉项 List <CommonEntity> FollowTypeList = CommonData.GetDictionaryList(13); //13跟进方式 model.FollowTypeIL = CommonData.Instance.GetBropDownListData(FollowTypeList); //根据方式拉项 List <CommonEntity> IntentTypeList = CommonData.GetDictionaryList(14);//13跟进方式 model.IntentTypeIL = CommonData.Instance.GetBropDownListData(IntentTypeList); List <CommonEntity> SourceIL = CommonData.GetDictionaryList(2);//1是字典类型值,仅供测试参考 model.SourceIL = CommonData.Instance.GetBropDownListData(SourceIL); //分校下拉项 List <CommonEntity> ComCodeIL = CommonData.Get_SYS_Company_COMP_Code(UserSession.comcode);//分校 model.ComCodeIL = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL); model.search.ComCodeIL = CommonData.Instance.GetBropDownListData_Choice(ComCodeIL); //资源表状态 List <CommonEntity> ApStateIL = CommonData.GetDictionaryList(12);//状态 model.search.ApStateIL = CommonData.Instance.GetBropDownListData(ApStateIL); if (UserSession.comcode != null && UserSession.comcode != "1") { search.ComCode = UserSession.comcode;//默认查询当前分校的人员 } model.AppointmentList = AppointmentData.GetAPList(search); //填充页面模型数据 return(View(model)); //返回页面模型 }