public void SetUp() { _driver = new ChromeDriver();; _routesPage = new RoutesPage(); _driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(15); _driver.Navigate().GoToUrl("https://poezd.rw.by/wps/portal/home/rp/schedule/"); PageFactory.InitElements(_driver, _routesPage); }
public void CorrectLogIn(string login, string password) { var rulesPage = new RulesPage(); var routesPage = new RoutesPage(); PageFactory.InitElements(_driver, rulesPage); PageFactory.InitElements(_driver, routesPage); _loginPage.EnterLogin(login); _loginPage.EnterPassword(password); _loginPage.ClickLogInButton(); rulesPage.ClickRadioButton(); Assert.IsFalse(string.IsNullOrEmpty(routesPage.LogoutLink.Text)); }
// GET: Routes public async Task <IActionResult> Index() { using (var context = _context) { var RouteNumbers = context.Routes.Select(x => new { Text = "Route: " + x.RouteId.ToString(), Value = x.RouteId }); var model = new RoutesPage(); List <SelectListItem> routes = new List <SelectListItem>(); foreach (var route in RouteNumbers) { routes.Add(new SelectListItem { Text = route.Value.ToString(), Value = route.Text }); } model.RouteList = new SelectList(routes, "Text", "Value"); var studentQuery = context.Students.AsNoTracking().ToList(); model.StudentList = studentQuery; var RouteStopsQuery = context.RouteStops.AsNoTracking().ToList(); model.RouteStopsList = RouteStopsQuery; var RoutesQuery = context.Routes.AsNoTracking().ToList(); model.RoutesList = RoutesQuery; var BusesQuery = context.Buses.AsNoTracking().ToList(); model.BusList = BusesQuery; var unassignedStudentsQuery = context.Students.AsNoTracking() .Where(x => x.StopId == 0) .ToList(); var UnassignedStudents = unassignedStudentsQuery.Count; model.unAssignedStudents = UnassignedStudents; var unassignedBusesQuery = context.Routes.AsNoTracking() .Where(x => x.RouteId == 0) .ToList(); var UnassignedBuses = unassignedBusesQuery.Count; model.unAssignedBuses = UnassignedBuses; return(View(model)); } }
public ActionResult GetStudentsOnRoute(int id, List <Routes> routeList) { List <RoutesPageTable> routesPageTable = new List <RoutesPageTable>(); if (id == 0) { using (var context = _context) { var routeStopIds = context.RouteStops.AsNoTracking() .Select(x => x.StopId) .ToList(); var studentList = context.Students.AsNoTracking() .Where(x => routeStopIds.Contains(x.StopId)) .ToList(); foreach (Students student in studentList) { var studentStop = context.RouteStops.AsNoTracking().Where(x => x.StopId == student.StopId).Select(x => x.StopNumber).FirstOrDefault(); var studentRoute = context.RouteStops.AsNoTracking().Where(x => x.StopId == student.StopId).Select(x => x.RouteId).FirstOrDefault(); var studentBus = context.Buses.AsNoTracking().Where(x => x.RouteId == studentRoute).Select(x => x.BusNumb).FirstOrDefault(); RoutesPageTable row = new RoutesPageTable(); row.FirstName = student.FirstName; row.LastName = student.LastName; row.StreetAddress = student.StreetAddress; row.StopNumber = studentStop; row.BusNumber = studentBus; routesPageTable.Add(row); } return(Json(studentList)); } } else { using (var context = _context) { var model = new RoutesPage(); var routeStopIds = context.RouteStops.AsNoTracking() .Where(x => x.RouteId == id) .Select(x => x.StopId) .ToList(); var studentList = context.Students.AsNoTracking() .Where(x => routeStopIds.Contains(x.StopId)) .ToList(); foreach (Students student in studentList) { var studentStop = context.RouteStops.AsNoTracking().Where(x => x.StopId == student.StopId).Select(x => x.StopNumber).FirstOrDefault(); var studentRoute = context.RouteStops.AsNoTracking().Where(x => x.StopId == student.StopId).Select(x => x.RouteId).FirstOrDefault(); var studentBus = context.Buses.AsNoTracking().Where(x => x.RouteId == studentRoute).Select(x => x.BusNumb).FirstOrDefault(); RoutesPageTable row = new RoutesPageTable(); row.FirstName = student.FirstName; row.LastName = student.LastName; row.StreetAddress = student.StreetAddress; row.StopNumber = studentStop; row.BusNumber = studentBus; routesPageTable.Add(row); } return(Json(routesPageTable)); } } }