// // GET: /Advise/ public ActionResult Index(int?id) { string categoryCode = string.IsNullOrEmpty(Request.QueryString["CategoryCode"]) ? SystemConst.CategoryCode.Train : Request.QueryString["CategoryCode"]; string order = string.IsNullOrEmpty(Request.QueryString["order"]) ? "default" : Request.QueryString["order"]; string categoryName = EnterRepository.GetRepositoryEnter().CategoryRepository.LoadEntities(m => m.Code == categoryCode).FirstOrDefault().Name; Pagination pagination = new Pagination(); int page = 1; if (id != null) { page = int.Parse(id.ToString()); } int totalCount = 0; pagination.ActionUrl = "train/index"; pagination.CurrentPageIndex = page; var mytrains = TrainServices.GetTrains(categoryCode, order, page, pagination.Size, out totalCount); pagination.TotalCount = totalCount; pagination.Order = order; pagination.CategoryCode = categoryCode; pagination.CategoryName = categoryName; ViewBag.mytrains = mytrains; ViewBag.mine = false; ViewBag.Pagination = pagination; return(View()); }
/// <summary> /// 浏览文章 /// </summary> /// <param name="id"></param> /// <returns></returns> public ActionResult View(int id) { var train = TrainServices.GetTrain(id); train.ViewCount++; EnterRepository.GetRepositoryEnter().TrainRepository.EditEntity(train, new string[] { "ViewCount" }); EnterRepository.GetRepositoryEnter().SaveChange(); var next = EnterRepository.GetRepositoryEnter().TrainRepository.LoadEntities(m => m.ModifyTime > train.ModifyTime).FirstOrDefault(); var pre = EnterRepository.GetRepositoryEnter().TrainRepository.LoadEntities(m => m.ModifyTime < train.ModifyTime).FirstOrDefault(); ViewBag.Next = next; ViewBag.Pre = pre; return(View(train)); }
static void _nmsConnection_FeedDataRecieved(object sender, Pport e) { switch (e.ItemElementName) { case ItemChoiceType1.uR: var ur = (DataResponse)e.Item; if (ur.alarm != null && ur.alarm.Any()) { } if (ur.association != null && ur.association.Any()) { } if (ur.deactivated != null && ur.deactivated.Any()) { foreach (var ts in ur.deactivated) { TrainServices.Deactivate(ts.rid); } } if (ur.OW != null && ur.OW.Any()) { } if (ur.schedule != null && ur.schedule.Any()) { } if (ur.trackingID != null && ur.trackingID.Any()) { } if (ur.trainAlert != null && ur.trainAlert.Any()) { } if (ur.trainOrder != null && ur.trainOrder.Any()) { } if (ur.TS != null && ur.TS.Any()) { foreach (var ts in ur.TS) { TrainServices.AddOrUpdate(ts); } } break; case ItemChoiceType1.sR: break; } }
// // GET: /Home/ public ActionResult Index() { int totalCount = 0; string order = "latest"; ViewBag.NewsGonggao = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsGongGao, order, 1, 10, out totalCount); ViewBag.NewsExamData = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsExamData, order, 1, 10, out totalCount); ViewBag.NewsReview = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsReview, order, 1, 10, out totalCount); ViewBag.NewsScore = ArticleServices.GetArticles(SystemConst.CategoryCode.NewsScore, order, 1, 10, out totalCount); ViewBag.Book = BookServices.GetBooks(SystemConst.CategoryCode.Book, order, 1, 10, out totalCount); ViewBag.Train = TrainServices.GetTrains(SystemConst.CategoryCode.Train, order, 1, 8, out totalCount); ViewBag.Hotel = HotelServices.GetHotels(SystemConst.CategoryCode.Hotel, order, 1, 20, out totalCount); ViewBag.Blog = BlogServices.GetBlogs(null, 0, SystemConst.CategoryCode.Blog, order, 1, 10, out totalCount); return(View()); }
static void Main(string[] args) { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Darwin Console Reader"); Console.WriteLine("Powered by National Rail Enquiries"); Console.ForegroundColor = ConsoleColor.White; TrainServices.Init(); _nmsConnection.FeedDataRecieved += _nmsConnection_FeedDataRecieved; _nmsConnection.Start(); Console.WriteLine("Press ESC key to exit"); while (Console.ReadKey().Key != ConsoleKey.Escape) { } _nmsConnection.Stop(); }