public IActionResult Turmas(PageDataViewModel <Turma> model) { IEnumerable <Turma> data = null; switch (model.FilterType) { case FilterType.ById: var id = Int64.Parse(model.FilteValue); var entity = _Service.GetTurmaById(id); if (entity != null) { data = new Turma[] { entity }; } else { data = new Turma[] { }; } break; case FilterType.ByName: data = _Service.GetTurmasBySemestre(model.AditionalFilter, model.FilteValue); break; } model.Total = data.Count(); model.Data = data; return(View(model)); }
public IActionResult AreasConhecimento(PageDataViewModel <AreaConhecimento> model) { IEnumerable <AreaConhecimento> data = null; switch (model.FilterType) { case FilterType.ById: var id = Int64.Parse(model.FilteValue); var entity = _Service.GetAreaConhecimentoById(id); if (entity != null) { data = new AreaConhecimento[] { entity }; } else { data = new AreaConhecimento[] { }; } break; case FilterType.ByName: data = _Service.GetAreasConhecimento(model.FilteValue); break; } model.Total = data.Count(); model.Data = data; return(View(model)); }
public ActionResult PageData(Site site) { if (!ModelState.IsValid) { return(View("Index", site)); } else { var pageDataViewModel = new PageDataViewModel(); //var siteHtmlAgility = new SiteHtmlAgility(); ViewBag.SiteAddress = site.Url; Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); pageDataViewModel.StreamBufferSize = _siteHtmlAgility.Load(site.Url); stopWatch.Stop(); if (pageDataViewModel.StreamBufferSize == -1) { return(RedirectToAction("Index", new { error = "The site entered is not accessible form this applicaton due to network restrictions. Please enter a different URL." })); } pageDataViewModel.TimeElapsed = stopWatch.ElapsedMilliseconds; pageDataViewModel.ImageAttributeList = _siteHtmlAgility.ExtractImages(); pageDataViewModel.SiteWordList = _siteHtmlAgility.ExtractText(); pageDataViewModel.FrequencyMap = _siteHtmlAgility.ExtractFrequencyMap(pageDataViewModel.SiteWordList); return(View(pageDataViewModel)); } }
public PageData() { InitializeComponent(); AppCopyTbx.Text = "软件版本号:" + ManagerPlant.copyManager.AppCopy; Dictionary <string, string> mydic = new Dictionary <string, string>() { { "X位移", "x" }, { "Y位移", "y" }, { "Z位移", "z" } }; DataCbx.ItemsSource = mydic; DataCbx.SelectedValuePath = "Value"; DataCbx.DisplayMemberPath = "Key"; Dictionary <string, string> mydic1 = new Dictionary <string, string>() { { "通道1", "1" }, { "通道2", "2" }, { "通道3", "4" } }; AisleCbx.ItemsSource = mydic1; AisleCbx.SelectedValuePath = "Value"; AisleCbx.DisplayMemberPath = "Key"; model = new PageDataViewModel(DataGrid); DataContext = model; model.win = this; }
public IActionResult AlunosSincronia() { AlunoCodigo[] alunoIds = (AlunoCodigo[])_Service.GetAlunosParaSincronizar(); var pageModel = new PageDataViewModel <Aluno>(); if (alunoIds?.Length == 0) { pageModel.Total = 0; pageModel.Data = new Aluno[] { }; return(View(pageModel)); } Queue <Aluno> queue = new Queue <Aluno>(alunoIds.Length); foreach (var item in alunoIds) { Aluno aluno = _ConsultaAcademicaService.GetAlunoById(item.IdAluno); queue.Enqueue(aluno); } pageModel.Total = queue.Count; pageModel.Data = queue.ToArray(); return(View(pageModel)); }
public async Task <PageDataViewModel> PageDataBuilder(PageDataViewModel model) { model.Date = DateTime.Now.Date.ToShortDateString(); model.Time = DateTime.Now.ToString("HH:mm:ss"); Pathway currentPathway = null; if (!string.IsNullOrEmpty(model.QuestionId) && model.QuestionId.Contains(".")) { var currentPathwayNo = model.QuestionId.Split('.')[0]; if (!currentPathwayNo.Equals(model.StartingPathwayNo)) { var businessApiPathwayUrl = _configuration.GetBusinessApiPathwayIdUrl(currentPathwayNo, model.Gender, new AgeCategory(model.Age).MinimumAge); var response = await _restClient.ExecuteAsync <Pathway>(new JsonRestRequest(businessApiPathwayUrl, Method.GET)); CheckResponse(response); currentPathway = response.Data; } } model.PathwayNo = (currentPathway != null) ? currentPathway.PathwayNo : string.Empty; model.PathwayTitle = (currentPathway != null) ? currentPathway.Title : string.Empty; return(model); }
public IActionResult Professores(PageDataViewModel <Professor> model) { IEnumerable <Professor> data = null; switch (model.FilterType) { case FilterType.ById: var id = Int64.Parse(model.FilteValue); var entity = _Service.GetProfessorById(id); if (entity != null) { data = new Professor[] { entity }; } else { data = new Professor[] { }; } break; case FilterType.ByName: data = _Service.GetProfessores(model.FilteValue); break; } model.Total = data.Count(); model.Data = data; return(View(model)); }
public static PageDataViewModel <TViewModel> Map <TModel, TViewModel>( IPageData <TModel> model, Func <TModel, TViewModel> map) { var viewModel = new PageDataViewModel <TViewModel>(); viewModel.Items = model.Data.Select(map).ToList(); viewModel.PageNumber = model.PageNumber; viewModel.PagesCount = model.PagesCount; viewModel.PageSize = model.PageSize; return(viewModel); }
public IActionResult AreasConhecimento() { var data = _Service.GetAreasConhecimento(); var pageable = new PageDataViewModel <AreaConhecimento>() { Total = data.Count(), Data = data }; return(View(pageable)); }
public IActionResult DisciplinasProfessor(long id) { var data = _Service.GetDisciplinasProfessor(AppConfig.ApiCurrentSemester, id); var pageable = new PageDataViewModel <Disciplina>() { Total = data.Count(), Data = data }; return(View("Disciplinas", pageable)); }
public IActionResult DisciplinasAluno(long id) { var data = _Service.GetDisciplinasAluno(id); var pageable = new PageDataViewModel <Disciplina>() { Total = data.Count(), Data = data }; return(View("Disciplinas", pageable)); }
public IActionResult Professores() { var data = _Service.GetProfessores(); var pageable = new PageDataViewModel <Professor>() { Total = data.Count(), Data = data }; return(View(pageable)); }
public IActionResult Modalidades() { var data = _Service.GetModalidades(); var pageable = new PageDataViewModel <Modalidade>() { Total = data.Count(), Data = data }; return(View(pageable)); }
public IActionResult Alunos() { var data = _Service.GetAlunosBySemestre(AppConfig.ApiCurrentSemester); var pageable = new PageDataViewModel <Aluno>() { AditionalFilter = AppConfig.ApiCurrentSemester, Total = data.Count(), Data = data }; return(View(pageable)); }
/// <summary> /// 创建一个<see cref="PageDataViewModel{TKey}"/>实例。一般用于 List Action。 /// </summary> /// <param name="pageSize">页面大小。</param> /// <param name="pageCurrent">当前页。</param> /// <param name="orderField">排序字段。</param> /// <param name="orderDirection">排序方向。</param> /// <returns></returns> public virtual async Task <PageDataViewModel <TKey> > CreateListModelAsync(int pageSize, int pageCurrent, string orderField, string orderDirection) { var queryable = GetEntityListData(orderField, orderDirection); var pageListViewModel = new PageDataViewModel <TKey>(queryable.Count(), pageCurrent, pageSize) { Items = await queryable .Skip((pageCurrent - 1) *pageSize) .Take(pageSize) .ToDtoListAsync <TDto, TEntity, TKey>() }; return(pageListViewModel); }
public ActionResult Details(int id) { var page = _pageService.GetByID(id); var pageViewModel = new PageDataViewModel() { Id = page.ID, Title = page.Title, HtmlBody = page.HtmlBody, TextBody = page.TextBody, IsPublished = page.IsPublished, CreatedDate = page.CreatedDate.ToString("f"), UpdatedDate = page.UpdatedDate.ToString("f") }; return(View(pageViewModel)); }
public ActionResult Details(PageDataViewModel page) { if (string.IsNullOrEmpty(page.TextBody) || string.IsNullOrEmpty(page.HtmlBody)) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Missing required data.")); } Mapper.CreateMap <PageDataViewModel, Page>(); var updatedPage = Mapper.Map(page, _pageService.GetByID(page.Id)); updatedPage.UpdatedDate = DateTime.UtcNow; _pageService.Update(updatedPage); return(View(page)); }
public ActionResult Create(PageDataViewModel page) { if (string.IsNullOrEmpty(page.TextBody) || string.IsNullOrEmpty(page.HtmlBody)) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "Missing required data.")); } Mapper.CreateMap <PageDataViewModel, Page>(); var newPage = Mapper.Map <PageDataViewModel, Page>(page); newPage.CreatedDate = DateTime.UtcNow; newPage.UpdatedDate = DateTime.UtcNow; _pageService.Insert(newPage); return(RedirectToAction("Details", new { id = newPage.ID }));; }
private static PageDataViewModel GetPage() { var siteMapProvider = SiteMapBase.GetCurrentProvider(); if (siteMapProvider != null && siteMapProvider.CurrentNode != null) { var pm = new PageManager(); var pageNode = pm.GetPageNode(new Guid(siteMapProvider.CurrentNode.Key)); var result = new PageDataViewModel { Title = pageNode.Page.Title, Keywords = pageNode.Page.Keywords }; return(result); } return(new PageDataViewModel()); }
public async Task <PageDataViewModel> PageDataBuilder(PageDataViewModel model) { model.Date = DateTime.Now.Date.ToShortDateString(); model.Time = DateTime.Now.ToString("HH:mm:ss"); Pathway currentPathway = null; if (!string.IsNullOrEmpty(model.QuestionId) && model.QuestionId.Contains(".")) { var currentPathwayNo = model.QuestionId.Split('.')[0]; if (!currentPathwayNo.Equals(model.StartingPathwayNo)) { var businessApiPathwayUrl = _configuration.GetBusinessApiPathwayIdUrl(currentPathwayNo, model.Gender, new AgeCategory(model.Age).MinimumAge); var response = await _restfulHelper.GetAsync(businessApiPathwayUrl); currentPathway = JsonConvert.DeserializeObject <Pathway>(response); } } model.PathwayNo = (currentPathway != null) ? currentPathway.PathwayNo : string.Empty; model.PathwayTitle = (currentPathway != null) ? currentPathway.Title : string.Empty; return(model); }
public async Task <MessageViewModel> GetByGroup(string groupId, int pageSize, int pageIndex) { if (pageIndex <= 0) { pageIndex = 1; } if (pageSize >= 200) { pageSize = 200; } else if (pageSize <= 0) { pageSize = 20; } int total; var res = await fileDataBusiness.GetByGroup(this.CurrentAuthShopId(), groupId, out total, pageSize, pageIndex); if (res != null) { foreach (var item in res) { InitFileDataUrl(item); } } PageDataViewModel pageDataViewModel = new PageDataViewModel { Total = total, Data = res }; return(new MessageViewModel { Code = MessageCode.Success, Data = pageDataViewModel, Message = "获取成功!" }); }