public override void Dispose() { min.TextChanged -= minTextChanged; max.TextChanged -= maxTextChanged; tickPlacement.Loaded -= tickPlacement_Loaded_1; orientation.Loaded -= orientation_Loaded_1; orientation.SelectionChanged -= orientation_SelectionChanged; snapto.Loaded -= snapto_loaded; snapto.SelectionChanged -= snapsto_OnSelectionChanged; this.orientation.ItemsSource = null; this.tickPlacement.ItemsSource = null; this.snapto.ItemsSource = null; if (Departure != null) { Departure.Dispose(); Departure = null; } if (Arrival != null) { Arrival.Dispose(); Arrival = null; } this.DataContext = null; }
public async Task <IActionResult> Edit(int id, [Bind("Id,CommuneId,Date,Species,Kg,Caleta")] Arrival arrival) { if (id != arrival.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(arrival); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ArrivalExists(arrival.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["CommuneId"] = new SelectList(_context.Set <Commune>(), "Id", "Id", arrival.CommuneId); return(View(arrival)); }
/// <summary> /// Get Arrival Files By Arrival /// </summary> /// <param name="Arrival"></param> /// <returns></returns> public List <ArrivalFile> GetArrivalFilesByArrival(Arrival Arrival) { var query = from a in db.ArrivalFiles where a.Arrival.Id == Arrival.Id select a; return(query.ToList <ArrivalFile>()); }
public void AddArival(Arrival arrival) { lock (_dbContext) { _dbContext.Arrivals.Add(arrival); _dbContext.SaveChanges(); } }
internal static DbArrival ToDataEntity(this Arrival arrival) { return(new DbArrival { Id = arrival.Id, EstimatedArrivalTime = arrival.EstimatedArrivalTime }); }
public void Equals_ReturnsTrueIfDescriptionsAreTheSame_Arrival() { // Arrange, Act Arrival firstArrival = new Arrival("Mow the lawn"); Arrival secondArrival = new Arrival("Mow the lawn"); // Assert Assert.AreEqual(firstArrival, secondArrival); }
public ArrivalBundle(Arrival firstArrival) { this.Bus=firstArrival.Bus; this.Stop=firstArrival.Stop; this.Live=firstArrival.Live; Times=new List<DateTime>(); Times.Add(firstArrival.Time); this.CommonDestination=firstArrival.Destination; }
public ActionResult Indexc() { Arrival newItem = new Arrival(Request.Form["new-arrival"]); newItem.Save(); List <Arrival> allItems = Arrival.GetAll(); return(View("arrivalc", allItems)); }
//gets time of next arrival and updates UI private async Task <Arrival> ArrivalTimeAsync(int stopListIndex, int arrivalIndex) { //string stop = "4117202"; string stop; if (stopList.Count >= stopListIndex) { stop = stopList[stopListIndex].Value.StopId; } else if (stopList.Count > 0) { stop = stopList[0].Value.StopId; } else { stop = "4117202"; } agency.Replace(",", "%2C"); stop.Replace(",", "%2C"); //https://transloc-api-1-2.p.mashape.com/arrival-estimates.json?agencies=176&stops=4117206 string url = "https://transloc-api-1-2.p.mashape.com/arrival-estimates.json" + "?agencies={0}" + "&stops={1}";//json URL string queryUrl = string.Format(url, agency, stop); string translocResult = await client.GetStringAsync(queryUrl); //Result.Text = translocResult; ArrivalData apiData = JsonConvert.DeserializeObject <ArrivalData>(translocResult); if (apiData != null) { if (apiData.data.Count == 0) { return(null); } StopArrivals currentStop = null; foreach (StopArrivals stopInfo in apiData.data) { if (stopInfo.stop_id == stop) { currentStop = stopInfo; break; } } Arrival nextArrival = currentStop.arrivals[arrivalIndex % currentStop.arrivals.Count]; return(nextArrival); } return(null); }
private async void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { Geolocator locator = new Geolocator(); locator.DesiredAccuracyInMeters = 15; Result.Text = "Loading..."; stopIndex = 0; try { currentPosition = await locator.GetGeopositionAsync(TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(5));; //get current position //update routes, vehicles, and stops in range (async routeMap = await getRoutesAsync(); vehicleMap = await getVehicleStatusesAsync(); stopMap = await getStopsInRangeAsync( currentPosition.Coordinate.Latitude, currentPosition.Coordinate.Longitude, 250); stopList = stopMap.ToList();//sort stops by distance from current location stopList.Sort( delegate(KeyValuePair <string, Stop> firstPair, KeyValuePair <string, Stop> nextPair) { return(firstPair.Value.CompareTo(nextPair.Value)); }); Arrival nextArrival = await ArrivalTimeAsync(stopIndex, 0); //get next bus arrival and current stop DateTime time = DateTime.Parse(nextArrival.arrival_at); //get next arrival time //format display string string nextBus = String.Format("Next Arrival at: {0}\n" + "Route ID: {1}\n" + "Vehicle is {2}% full\n" , time.ToShortTimeString(), routeMap[nextArrival.route_id], vehicleMap[Convert.ToInt32(nextArrival.vehicle_id)].load * 100); //update UI Result.Text = nextBus; txtHeading.Text = stopList[0].Value.Name; } catch (Exception ex) { sendError(ex); Result.Text = ex.Message; } //getRoutesAsync(() => // { // UpdateTimesAsync(); // }); }
public override string ToString() { return(Id + ";" + LocationFrom?.ToString() + ";" + LocationTo?.ToString() + ";" + Departure.ToString("dd-MM-yyyy HH:mm") + ";" + Arrival.ToString("dd-MM-yyyy HH:mm") + ";" + DistanceMiles.ToString() + ";" + Price?.ToString()); }
private ArrivalDTO ConvertToDTO(Arrival arrival) { if (arrival != null) { return(new ArrivalDTO { ArrivalId = arrival.ArrivalId, PlaneNumber = arrival.PlaneNumber, Time = arrival.Time }); } return(null); }
private static void PrintArrivalTimesToConsole(IEnumerable <ArrivalPrediction> arrivalTimes) { foreach (var Arrival in arrivalTimes) { Console.WriteLine(Arrival.Id); Console.WriteLine(Arrival.StationName); Console.WriteLine("This bus is due in {0}", Arrival.GetArrivalTime()); } Console.ReadLine(); }
public void GenerateArrivalAndDeparture() { int rndtime = rnd.Next(0, 20); arrival = new Arrival { EstimatedArrivalTime = DateTime.Now.AddSeconds(rndtime) }; departure = new Departure { EstimatedDepartureTime = DateTime.Now.AddSeconds(rndtime + 30) }; }
public void LateArrival() { //Arrange Arrival arrival = new Arrival(); //Asswert Assert.AreEqual(true, arrival.LateArrival(20, 10, 60)); Assert.AreEqual(true, arrival.LateArrival(20, 20, 60)); Assert.AreEqual(false, arrival.LateArrival(40, 60, 50)); Assert.AreEqual(true, arrival.LateArrival(30, 5, 10)); }
public override string ToString() { var results = new StringBuilder(); results.AppendLine("Departs " + Departure.ToString()); results.AppendLine("Arrives " + Arrival.ToString()); results.AppendLine("Plane " + PlaneType); results.AppendLine("Buis.Class avail. " + HasBusinessClass); return(results.ToString()); }
public ArrivalEditorForm(Arrival arrival) { InitializeComponent(); initialArrival = arrival; buttonAdd.Text = "Save Arrival"; this.Text = "Edit"; textBoxFlight.Text = arrival.Flight; textBoxFrom.Text = arrival.From; dateTimePicker.Value = arrival.Time; textBoxStatus.Text = arrival.Status; }
private static void BookTaxi() { Console.WriteLine("\n"); var arrivals = new Arrivals(); var addNewParticipantCheckin = false; do { Console.WriteLine($" Nom du participant : "); string nameParticipant = Console.ReadLine(); var isArrivalHourValid = false; do { Console.WriteLine($" Heure d'arrivé à la gare du participant - le format hh : "); int arrivalHourValue; if (int.TryParse(Console.ReadLine(), out arrivalHourValue) && arrivalHourValue >= 0 && arrivalHourValue <= 23) { var arrivalHour = new ArrivalHour(arrivalHourValue); var participant = new Participant(nameParticipant); var arrival = new Arrival(arrivalHour, participant); arrivals.Add(arrival); isArrivalHourValid = true; } else { Console.WriteLine(" Heure d'arrivée incorrecte !"); } }while (isArrivalHourValid == false); Console.WriteLine("Voulez-vous ajouter un autre participant ? [O/N]"); var responseAddNewParticipant = Console.ReadLine(); if (responseAddNewParticipant.Equals("O")) { addNewParticipantCheckin = true; } else { addNewParticipantCheckin = false; } }while (addNewParticipantCheckin == true); taxiOrganizers.Add(new TaxiOrganizer(arrivals)); Console.WriteLine("\n\n\n"); }
public IActionResult Arrival([FromBody] Arrival patient) { Logger.LogDebug(nameof(Arrival)); if (!IsAuthenticated()) { return(BadRequest()); } // TODO: A patient shows up for their visit/a patient is admitted to the hospital. Not implemented, yet. return(Ok()); }
public void CreateArrival(Arrival arrival) { try { Task.Run(() => _repository.CreateArrival(arrival.ToDataEntity())); Arrivals.Add(arrival); } catch (Exception) { throw; } }
private void Awake() { steering = GetComponent <SteeringBehaviour>(); arrival = gameObject.AddComponent <Arrival>(); arrival.maxSpeed = maxSpeed; arrival.jerkiness = jerkiness; evade = gameObject.AddComponent <Evade>(); evade.maxSpeed = maxSpeed; evade.jerkiness = jerkiness; }
public async Task <IActionResult> Create([Bind("Id,CommuneId,Date,Species,Kg,Caleta")] Arrival arrival) { if (ModelState.IsValid) { _context.Add(arrival); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["CommuneId"] = new SelectList(_context.Set <Commune>(), "Id", "Id", arrival.CommuneId); return(View(arrival)); }
public void GetAll_ReturnsEmptyList_ArrivalList() { //Arrange List <Arrival> newList = new List <Arrival> { }; //Act List <Arrival> result = Arrival.GetAll(); //Assert CollectionAssert.AreEqual(newList, result); }
public void OnChunkArrival(Chunk chunk) { var id = chunk.id; var data = chunk.data; var type = GetType(id); var obj = DataToObject(data, type); if (Arrival != null) { Arrival.Invoke(obj); } }
public ActionResult Create() { Departure newItem = new Departure(Request.Form["new-departure"]); newItem.Save(); Arrival selectedarrival = Arrival.Find(int.Parse(Request.Form["arrival"])); newItem.AddArrival(selectedarrival); List <Departure> allItems = Departure.GetAll(); return(View("departures", allItems)); }
public void Move() { if (Floor == _minFloor) { _up = true; } else if (Floor == _maxFloor) { _up = false; } Floor += (_up ? 1 : -1); Arrival?.Invoke(this); }
public override string ToString() { return(string.Format("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}", Number, DepartureFrom, ArrivalIn, Departure.TimeOfDay.ToString("hh':'mm"), Departure.ToString().Split(' ')[0], Arrival.TimeOfDay.ToString("hh':'mm"), Arrival.ToString().Split(' ')[0], CountPlaces, Program.GetStopStations(StopStation))); }
public void Find_ReturnsCorrectArrivalFromDatabase_Arrival() { //Arrange Arrival testArrival = new Arrival("Mow the lawn"); testArrival.Save(); //Act Arrival foundArrival = Arrival.Find(testArrival.Id); //Assert Assert.AreEqual(testArrival, foundArrival); }
public ArrivalModel(Arrival arrival) { if (arrival == null) { return; } Id = arrival.Id; CourseId = arrival.CourseId; BusStopOnRouteId = arrival.BusStopOnRouteId; Time = arrival.Time; Course = new CourseModel(arrival.Course); BusStopOnRoute = new BusStopOnRouteModel(arrival.BusStopOnRoute); }
private void Arriv_cmbx_SelectedValueChanged(object sender, EventArgs e) { first_btn.Visible = false; previous_btn.Visible = false; next_btn.Visible = false; last_btn.Visible = false; // Case of choice is "Save" if (Choice == "Save") { Arrival_picbox.Image = null; OpenFileDialog openFileDialog = new OpenFileDialog(); if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { Image image = Image.FromFile(openFileDialog.FileName); Arrival_picbox.Image = image; ArrivalFile arrFile = new ArrivalFile(); Arrival arrival = (Arrival)Arriv_cmbx.SelectedValue; arrFile.Arrival = new ArrivalBLO(db).GetByID(arrival.Id); arrFile.File = new DepartureFileBLO(db).Convert(Arrival_picbox); new ArrivalFileBLO(db).Save(arrFile); MessageBox.Show("bien enregisteree"); } } if (Choice == "Show") { Arrival arrival = (Arrival)Arriv_cmbx.SelectedValue; List <ArrivalFile> ArrivalFiles = new ArrivalFileBLO(db).GetArrivalFilesByArrival(arrival); ArrivalFileList = ArrivalFiles; if (ArrivalFiles.Count == 1) { byte[] image = ArrivalFiles[0].File; new DepartureFileBLO(db).FromByteToImage(image, Arrival_picbox); } if (ArrivalFiles.Count <= 0) { MessageBox.Show("Aucun Fichier a affiché"); Arrival_picbox.Image = null; } if (ArrivalFiles.Count > 1) { MessageBox.Show("Ce Depart Contient plusieurs Fichiers !"); byte[] image = ArrivalFiles[0].File; new DepartureFileBLO(db).FromByteToImage(image, Arrival_picbox); first_btn.Visible = true; previous_btn.Visible = true; next_btn.Visible = true; last_btn.Visible = true; } } }
public Transport() { Driver = new Driver(); Delivery = new Delivery(); Loading = new Loading(); Truck = new Truck(); Container = new Container(); Railcar = new Railcar(); Ard = new Ard(); Arrival = new Arrival(); BillOfLading = new BillOfLading(); Carrier = new Carrier(); Weighbridge = new Weighbridge(); Seal = new Seal(); }
public List<Arrival> doFetchNow() { if (!Enabled) return null; processing = true; MonoTouch.UIKit.UIApplication.SharedApplication.NetworkActivityIndicatorVisible = true; List<Arrival> outList = new List<Arrival> (); try { string postData = "ctl00%24mainPanel%24searchbyStop%24txtStop=" + myStop.stopId + "&ctl00%24mainPanel%24btnGetRealtimeSchedule=GO"; postData += "&__VIEWSTATE=" + File.ReadAllText (VIEWSTATE_FILE); byte[] data = (new System.Text.ASCIIEncoding ()).GetBytes (postData); WebRequest request = WebRequest.Create (RTS_URL); request.Method = "POST"; request.ContentLength = data.Length; request.ContentType = "application/x-www-form-urlencoded"; Stream dataStream = request.GetRequestStream (); dataStream.Write (data, 0, data.Length); dataStream.Close (); WebResponse response = request.GetResponse (); //string responseData = (new StreamReader (response.GetResponseStream ())).ReadToEnd (); HtmlDocument doc = new HtmlDocument (); doc.Load (response.GetResponseStream ()); var table = doc.GetElementbyId ("ctl00_mainPanel_gvSearchResult"); foreach (var row in table.Elements("tr")) { var tds = row.Elements ("td"); if (row.Elements ("td").Count () == 2) {//crude test for header and general correctness var dest = tds.First (); if (dest.InnerText.Trim () == "No Service") break; var time = tds.Last (); Arrival a = new Arrival (myStop, new BusRoute (dest.InnerText), parseRtsTime (time.InnerText), true); outList.Add (a); } } response.Close (); results = outList; } catch (Exception e) { //something went wrong, fail gracefully Console.WriteLine ("Fetch error: " + e.Message); notify (true); return null; } finally { MonoTouch.UIKit.UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; processing = false; } notify (false); return outList; }