public ActionResult TrainSearch(long?statusId, DateTime?startTime, DateTime?endTime, string keyWord, int pageIndex = 1) { TrainSearchResult result = trainService.Search(statusId, startTime, endTime, keyWord, (pageIndex - 1) * 20, 20); TrainListViewModel model = new TrainListViewModel(); model.Trains = result.Trains; //分页 Pagination pager = new Pagination(); pager.PageIndex = pageIndex; pager.PageSize = 20; pager.TotalCount = result.TotalCount; if (result.TotalCount <= 20) { model.Page = ""; } else { model.Page = pager.GetPagerHtml(); } return(Json(new AjaxResult { Status = "1", Data = model })); }
void createResultSet(RootTrainObject rootStationObj) { TRAINRESULTS trainResults = rootStationObj.RESULTS; TRAINQUERY trainQuery = rootStationObj.QUERY; DirectTrains directTrains = trainResults.directTrains; ConnectingTrains connectingTrains = trainResults.connectingTrains; List <TrainsList> directTrainsList = directTrains.trainsList; List <TrainsList2> connectedTrainsList = connectingTrains.trainsList; foreach (TrainsList value in directTrainsList) { TrainListViewModel list = new TrainListViewModel(); list.depatureTime = value.depatureTime; list.arrivalTime = value.arrivalTimeEndStation; list.trainType = AppUtility.ToCamelCase(value.trainType); list.trainTypeFlag = 1; list.scheduleDetail = getScheduleDetailObj(trainQuery, value); formatLitNode(list); combinedTrainList.Add(list); } foreach (TrainsList2 value in connectedTrainsList) { TrainListViewModel list = new TrainListViewModel(); list.depatureTime = value.recordHeader[0].startArrivalTime; list.arrivalTime = value.recordHeader[0].endArrivalTime; list.trainType = APPCONTEXT.globalConnectedTrain; list.trainTypeFlag = 2; list.scheduleDetail = getScheduleDetailObj(trainQuery, value); formatLitNode(list); combinedTrainList.Add(list); } }
public ActionResult List() { TrainListViewModel model = new TrainListViewModel(); model.Trains = trainService.GetDisplay(); model.Link = settingService.GetValue("前端奖品图片地址"); return(View(model)); }
public ActionResult UserTrainList(string mobile) { TrainListViewModel model = new TrainListViewModel(); TrainDTO[] dtos = trainService.GetByUserId(mobile); model.Trains = dtos; return(View(model)); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { TrainListViewModel trainViewModel = (sender as MenuItem).DataContext as TrainListViewModel; string[] args = { trainViewModel.scheduleDetail.startStationName, trainViewModel.scheduleDetail.endStationName, trainViewModel.scheduleDetail.departureTime, trainViewModel.scheduleDetail.arrivalTimeEndStation, trainViewModel.scheduleDetail.travelTime, trainViewModel.scheduleDetail.trainFrequncy }; string shareMessage = string.Format(APPCONTEXT.scheduleDetailShareMessage, args); AppUtility.shareStatusTask(shareMessage); }
private void lsSearchResult_Tap(object sender, System.Windows.Input.GestureEventArgs e) { TrainListViewModel trainList = (TrainListViewModel)(lsSearchResult.SelectedItem); if (trainList != null) { ScheduleDetailViewModel scheduleDetailObj = trainList.scheduleDetail; lsSearchResult.SelectedItem = null; if (trainList.trainTypeFlag == 1) { NavigationService.Navigate(new Uri("/ScheduleDetailPage.xaml", UriKind.Relative), scheduleDetailObj); } else { NavigationService.Navigate(new Uri("/ConnectedScheduleDetailPage.xaml", UriKind.Relative), scheduleDetailObj); } } }
void formatLitNode(TrainListViewModel list) { DateTime departureTime = DateTime.ParseExact(list.depatureTime, "HH:mm:ss", CultureInfo.InvariantCulture); DateTime arrivalTime = DateTime.ParseExact(list.arrivalTime, "HH:mm:ss", CultureInfo.InvariantCulture); if (departureTime > arrivalTime) { arrivalTime = arrivalTime.AddDays(1.0); } TimeSpan ts = arrivalTime.Subtract(departureTime).Duration(); list.depatureTime = departureTime.ToString("hh:mm", CultureInfo.CurrentCulture); list.arrivalTime = arrivalTime.ToString("hh:mm", CultureInfo.CurrentCulture); list.depZone = departureTime.ToString("tt", CultureInfo.CurrentCulture); list.arriveZone = arrivalTime.ToString("tt", CultureInfo.CurrentCulture); list.duration = String.Format(APPCONTEXT.sheduleListDuration, ts.ToString(@"hh\:mm")); list.depTime = departureTime; }
/// <summary> /// Gets the train models. /// </summary> /// <param name="locationData">Location data.</param> public void GetTrainModels(Location locationData) { if (locationData != null) { var LocationDescription = DescribeLocation(locationData); Report("GetTrainModels: " + LocationDescription, 0); if (trainLVM == null) { trainLVM = new TrainListViewModel(locationData.Latitude, locationData.Longitude); // listen to property changes trainLVM.PropertyChanged += delegate { SetNextTrains("Property changed."); }; } trainLVM.SetLocation(locationData.Latitude, locationData.Longitude); Report("UseNet: " + Settings.UseInternetServices, 1); if (IsConnected() && Settings.UseInternetServices) { // Get trains asynchonously from remote api Report("Getting trains async...", 0); Task.Run(() => trainLVM.GetTrainsAsync()); } else { // get the trains from schedule Report("Getting train synchronously...", 0); Task.Run(() => trainLVM.GetTrains(NearestApp)); } } else { Report("Location missing", 2); } }
public ActionResult List(int pageIndex = 1) { TrainSearchResult result = trainService.Search(null, null, null, null, (pageIndex - 1) * 20, 20); TrainListViewModel model = new TrainListViewModel(); model.Trains = result.Trains; //分页 Pagination pager = new Pagination(); pager.PageIndex = pageIndex; pager.PageSize = 20; pager.TotalCount = result.TotalCount; if (result.TotalCount <= 20) { model.Page = ""; } else { model.Page = pager.GetPagerHtml(); } return(View(model)); }