// GET: Activity public ActionResult Index(Guid disciplineId) { if (!UserIsInRole("Professor")) { return(RedirectToAction("Index", "Home")); } var discipline = _disciplineQuery.Handle(new DisciplineInputGet { DisciplineId = disciplineId }); var result = _activityQuery.Handle(new UseCases.ActivityContext.Inputs.ActivityInputGetByDiscipline { DisciplineId = disciplineId, Semester = new UseCases.Shared.Semester() }); var activities = new ActivityListViewModel { DisciplineId = disciplineId, DisciplineName = discipline.Discipline.Name, Activities = result.Activities.Select(x => new ActivityListItem { Date = x.Date.ToShortDateString(), Id = x.Id, Name = x.Description, Value = x.Value }) }; return(View(activities)); }
public ActivityListPage() { InitializeComponent(); BindingContext = _viewModel = new ActivityListViewModel() { Navigation = Navigation }; }
public ActivityListPage(Activity activity = null) { vm = new ActivityListViewModel(this); if (activity != null) { vm.AltUserId = activity.UserId; vm.DispName = activity.FullName.ToFriendlyName(); } BindingContext = vm; InitializeComponent(); }
// 活動管理 public ActionResult ActivityList(int?page, string qry, string sort, string disable, string pDate) { ActivityListViewModel model = new ActivityListViewModel(); model.Filter.CurrentPage = page ?? 1; model.Filter.QueryString = qry == null ? string.Empty : qry.Trim(); model.Filter.SortColumn = sort ?? string.Empty; model.Filter.Disable = disable ?? string.Empty; model.Filter.PublishDate = pDate; using (ActivityModule module = new ActivityModule()) { model.Result = module.DoGetList(model.Filter); } return(View(model)); }
public ActivityListViewModel ActivityList(ActivityListSearchParameter parameter) { try { int paging = parameter.param.Paging.HasValue ? parameter.param.Paging.Value : 1; int requestCount = parameter.param.Request_Count.HasValue ? parameter.param.Request_Count.Value : 10; int startAt = requestCount * (paging - 1); var parameterDto = new ActivityListSearchParameterDto() { RequestCount = requestCount, Start = startAt }; var listDtos = this._activityService.GetActivityList(parameterDto); var viewModel = new ActivityListViewModel() { data = listDtos, message = string.Empty, platform = parameter.platform, response = parameter.request, result = _succesStatusName }; return(viewModel); } catch (Exception ex) { this._logService.WriteErrorLog("activity_list"); this._logService.WriteErrorLog(ex.Message); return(new ActivityListViewModel() { data = new List <ActivityListDto>(), message = string.Empty, platform = parameter.platform, response = parameter.request, result = _failedStatusName }); } }