public ActionResult Index(FlightTime fp) { FlightDal fd = new FlightDal(); FlightDetails f = new FlightDetails(); f.Arrival_Airport = fp.ArrivalAirport; f.Depart_Airport = fp.DepartureAirport; f.Depart_Time = fp.FlightDate; List <FlightDetails> mylist = new List <FlightDetails>(); List <FlightModel> flist = new List <FlightModel>(); mylist = fd.FindFlights(f); foreach (var item in mylist) { FlightModel fm = new FlightModel(); fm.Amount = item.Amount; fm.Arrival_Airport = item.Arrival_Airport; fm.Depart_Airport = item.Depart_Airport; fm.Arrival_Time = item.Arrival_Time; fm.Depart_Time = item.Depart_Time; fm.Flightno = item.Flightno; fm.Seating_Capacity = item.Seating_Capacity; fm.Availaible_Seat = fd.FindSeat(item.Flightno); flist.Add(fm); } TempData["FP"] = flist; return(RedirectToAction("ShowFlights")); }
public async Task <JsonResult> OnGetDateTimes(string arrdate, string routeid) { // ListRoutes = await _routeServices.getAllRouteAsync(); if (arrdate.Count() != 0) { DateTime Date = DateTime.ParseExact(arrdate, "dd-MM-yyyy hh:mm tt", null); FlightTime timeDTO = new FlightTime(0, 30); DateTime depDate = await _services.calArrDate(Date, timeDTO); var routedto = await _routeServices.getRouteAsync(routeid); var Listrou = await _routeServices.getRouteByOriginAsync(routedto.Destination); routedto = Listrou.ElementAt(0); Route route = new Route(); _routeServices.convertDtoToEntity(routedto, route); DateTime arrDate = await _services.calArrDate(Date, route.FlightTime); Dictionary <string, object> Result = new Dictionary <string, object>(); Result.Add("arrDate", arrDate.ToString("dd-MM-yyyy hh:mm tt")); Result.Add("depDate", depDate.ToString("dd-MM-yyyy hh:mm tt")); return(new JsonResult(Result)); } return(new JsonResult("null")); }
public async Task <FlightTimeDTO> getTotalFlightTime(string flight_id) { var dets = await unitOfWork.Flights.getAllFlightDetails(flight_id); var time = new FlightTime(0); foreach (FlightDetail det in dets) { var route = await unitOfWork.Routes.GetByAsync(det.RouteId); time += route.FlightTime; } return(mapper.Map <FlightTime, FlightTimeDTO>(time)); }
public void ChangeFlight(string oldFlight, string newFlight) { try { DateTime t = FlightTime[oldFlight]; FlightTime.Remove(oldFlight); FlightTime.Add(newFlight, t); } catch { MessageBox.Show("更改航班号失败!"); return; } }
public bool Equals(Stats other) { if (other == null) { return(false); } return(PeopleKilledByPlayer.Equals(other.PeopleKilledByPlayer) && PeopleKilledByOthers.Equals(other.PeopleKilledByOthers) && CarsExploded.Equals(other.CarsExploded) && BoatsExploded.Equals(other.BoatsExploded) && TyresPopped.Equals(other.TyresPopped) && RoundsFiredByPlayer.Equals(other.RoundsFiredByPlayer) && PedsKilledOfThisType.SequenceEqual(other.PedsKilledOfThisType) && HelisDestroyed.Equals(other.HelisDestroyed) && ProgressMade.Equals(other.ProgressMade) && TotalProgressInGame.Equals(other.TotalProgressInGame) && KgsOfExplosivesUsed.Equals(other.KgsOfExplosivesUsed) && BulletsThatHit.Equals(other.BulletsThatHit) && HeadsPopped.Equals(other.HeadsPopped) && WantedStarsAttained.Equals(other.WantedStarsAttained) && WantedStarsEvaded.Equals(other.WantedStarsEvaded) && TimesArrested.Equals(other.TimesArrested) && TimesDied.Equals(other.TimesDied) && DaysPassed.Equals(other.DaysPassed) && SafeHouseVisits.Equals(other.SafeHouseVisits) && Sprayings.Equals(other.Sprayings) && MaximumJumpDistance.Equals(other.MaximumJumpDistance) && MaximumJumpHeight.Equals(other.MaximumJumpHeight) && MaximumJumpFlips.Equals(other.MaximumJumpFlips) && MaximumJumpSpins.Equals(other.MaximumJumpSpins) && BestStuntJump.Equals(other.BestStuntJump) && NumberOfUniqueJumpsFound.Equals(other.NumberOfUniqueJumpsFound) && TotalNumberOfUniqueJumps.Equals(other.TotalNumberOfUniqueJumps) && MissionsGiven.Equals(other.MissionsGiven) && PassengersDroppedOffWithTaxi.Equals(other.PassengersDroppedOffWithTaxi) && MoneyMadeWithTaxi.Equals(other.MoneyMadeWithTaxi) && IndustrialPassed.Equals(other.IndustrialPassed) && CommercialPassed.Equals(other.CommercialPassed) && SuburbanPassed.Equals(other.SuburbanPassed) && PamphletMissionPassed.Equals(other.PamphletMissionPassed) && NoMoreHurricanes.Equals(other.NoMoreHurricanes) && DistanceTravelledOnFoot.Equals(other.DistanceTravelledOnFoot) && DistanceTravelledByCar.Equals(other.DistanceTravelledByCar) && DistanceTravelledByBike.Equals(other.DistanceTravelledByBike) && DistanceTravelledByBoat.Equals(other.DistanceTravelledByBoat) && DistanceTravelledByGolfCart.Equals(other.DistanceTravelledByGolfCart) && DistanceTravelledByHelicopter.Equals(other.DistanceTravelledByHelicopter) && DistanceTravelledByPlane.Equals(other.DistanceTravelledByPlane) && LivesSavedWithAmbulance.Equals(other.LivesSavedWithAmbulance) && CriminalsCaught.Equals(other.CriminalsCaught) && FiresExtinguished.Equals(other.FiresExtinguished) && HighestLevelVigilanteMission.Equals(other.HighestLevelVigilanteMission) && HighestLevelAmbulanceMission.Equals(other.HighestLevelAmbulanceMission) && HighestLevelFireMission.Equals(other.HighestLevelFireMission) && PhotosTaken.Equals(other.PhotosTaken) && NumberKillFrenziesPassed.Equals(other.NumberKillFrenziesPassed) && TotalNumberKillFrenzies.Equals(other.TotalNumberKillFrenzies) && TotalNumberMissions.Equals(other.TotalNumberMissions) && FlightTime.Equals(other.FlightTime) && TimesDrowned.Equals(other.TimesDrowned) && SeagullsKilled.Equals(other.SeagullsKilled) && WeaponBudget.Equals(other.WeaponBudget) && FashionBudget.Equals(other.FashionBudget) && LoanSharks.Equals(other.LoanSharks) && StoresKnockedOff.Equals(other.StoresKnockedOff) && MovieStunts.Equals(other.MovieStunts) && Assassinations.Equals(other.Assassinations) && PizzasDelivered.Equals(other.PizzasDelivered) && GarbagePickups.Equals(other.GarbagePickups) && IceCreamSold.Equals(other.IceCreamSold) && TopShootingRangeScore.Equals(other.TopShootingRangeScore) && ShootingRank.Equals(other.ShootingRank) && LongestWheelie.Equals(other.LongestWheelie) && LongestStoppie.Equals(other.LongestStoppie) && Longest2Wheel.Equals(other.Longest2Wheel) && LongestWheelieDist.Equals(other.LongestWheelieDist) && LongestStoppieDist.Equals(other.LongestStoppieDist) && Longest2WheelDist.Equals(other.Longest2WheelDist) && PropertyBudget.Equals(other.PropertyBudget) && AutoPaintingBudget.Equals(other.AutoPaintingBudget) && PropertyDestroyed.Equals(other.PropertyDestroyed) && NumPropertyOwned.Equals(other.NumPropertyOwned) && BloodRingKills.Equals(other.BloodRingKills) && BloodRingTime.Equals(other.BloodRingTime) && PropertyOwned.SequenceEqual(other.PropertyOwned) && HighestChaseValue.Equals(other.HighestChaseValue) && FastestTimes.SequenceEqual(other.FastestTimes) && HighestScores.SequenceEqual(other.HighestScores) && BestPositions.SequenceEqual(other.BestPositions) && KillsSinceLastCheckpoint.Equals(other.KillsSinceLastCheckpoint) && TotalLegitimateKills.Equals(other.TotalLegitimateKills) && LastMissionPassedName.Equals(other.LastMissionPassedName) && CheatedCount.Equals(other.CheatedCount) && FavoriteRadioStationList.SequenceEqual(other.FavoriteRadioStationList)); }
public override string ToString() { String sReturn = "RouteID - " + RouteID + " => FlightName: " + FlightName + ", StartCity: " + StartCityName + "(" + StartCityCode + "), Destination: " + EndCityName + " (" + EndCityCode + "), Departure Time: " + FlightTime.ToString("dd MMM yyyy HH:mm") + ", Rate(A/C): " + AdultRate + "/" + ChildRate + ", NumSeats: " + NumSeatsAvailable; return(sReturn); }
private void button1_Click(object sender, EventArgs e) { String day = dateTimePicker1.Value.DayOfWeek.ToString().Substring(0, 2); String dayReturn = dateTimePicker2.Value.DayOfWeek.ToString().Substring(0, 2); String origin = comboBox1.SelectedValue.ToString(); String dest = comboBox2.SelectedValue.ToString(); FlightTime start = new FlightTime(dateTimePicker1.Value.Hour, dateTimePicker1.Value.Minute, false); FlightTime returnTime = new FlightTime(dateTimePicker2.Value.Hour, dateTimePicker2.Value.Minute, false); int tolerance = (int)numericUpDown1.Value; toolStripComboBox1.Items.Clear(); result.Text = ""; ArrayList flights = tt.flightsForOriginDest(origin, dest, start, day, tolerance); if (checkBox1.Checked) { ArrayList returnFlights = tt.flightsForOriginDest(dest, origin, returnTime, dayReturn, tolerance); flights.AddRange(returnFlights); } bindingSource1.DataSource = flights; result.Text = bindingSource1.Count + " path(s) found"; ArrayList routesForFlightPath = new ArrayList(0); String[] flightPath; String merged; for (int i = 0; i < bindingSource1.Count; i++) { routesForFlightPath.Clear(); merged = ""; for (int q = 0; q < ((Flight[])bindingSource1[i]).Length; q++) { routesForFlightPath.Add(((Flight[])bindingSource1[i])[q].Route); } flightPath = Timetable.destinationsForRoute((Route[])routesForFlightPath.ToArray(typeof(Route))); for (int z = 0; z < flightPath.Length; z++) { merged += flightPath[z]; if (z != flightPath.Length - 1) { merged += "-"; } } toolStripComboBox1.Items.Add(merged); } if (bindingSource1.Count > 0) { toggleFlightDetails(true); toolStripComboBox1.SelectedIndex = 0; } else { flightsBindingSource.DataSource = typeof(Flight); toggleFlightDetails(false); } }
public DateTime calArrDate(DateTime depDate, FlightTime time) { return(depDate.AddMinutes(time.toMinutes())); }
private List <Flight> CreateFlights(string fname, DateTime dtBegin, DateTime dtEnd) { List <Flight> flights = new List <Flight>(); string beginDate = dtBegin.ToString("yyyy/MM/dd HH:mm"); string endDate = dtEnd.ToString("yyyy/MM/dd HH:mm"); using (var fs = new FileStream(fname, FileMode.Open, FileAccess.Read)) { using (var sr = new StreamReader(fs, Encoding.UTF8)) { string line; int rowCount = 0; ; while ((line = sr.ReadLine()) != null)// && rowCount < 6) { if (rowCount % 2 == 1) { Flight flight = new Flight(); string[] cols = line.Split('\t'); flight.commercialFlightNumber = cols[0]; string commercialFlightNumber = cols[0]; string airline = "FL"; string strFlightNumber = string.Format("{0:000}", cols[0].Substring(2)); if (cols[0].Substring(0, 2).Equals("ME")) { airline = "ME"; strFlightNumber = string.Format("{0:000}", cols[0].Substring(3)); } //fflightAirline = airline; ushort flightNumber = Convert.ToUInt16(strFlightNumber); // Aircraft Type string aircraftType = cols[13]; string aircraftATCType = cols[13]; // Get FROM and TO string from = cols[1].Substring(0, 4); string to = cols[4].Substring(0, 4); // Departure and arrival time FlightTime depTime = new FlightTime( Convert.ToInt32(cols[1].Substring(6, 2)), Convert.ToInt32(cols[1].Substring(8, 2))); FlightTime arrTime = new FlightTime( Convert.ToInt32(cols[4].Substring(6, 2)), Convert.ToInt32(cols[4].Substring(8, 2))); DateTime depDate = DateTime.Today; DateTime arrDate = depDate; if (depTime > arrTime) { // Add one day to arrival date arrDate = arrDate.AddDays(1.0); } // Format the dates so that they can be stored in STD and STA string std = depDate.ToString("yyyy/MM/dd") + " " + depTime.ToString(); string sta = arrDate.ToString("yyyy/MM/dd") + " " + arrTime.ToString(); // add the begin date and end date of the schedule string BeginDate = dtBegin.ToString("yyyy/MM/dd HH:mm"); string EndDate = dtEnd.ToString("yyyy/MM/dd HH:mm"); int randomPayload = 1; int repetative = 1; // Get days of operation uint days = GetDaysOfOperation(cols); int isMaster = 1; int adults = -1; int females = -1; int children = -1; int infants = -1; int baggage = -1; //int baggage = -1; int cargo = -1; int payload = -1; string aircraft = null; // Misc. fields int maxPax = -1; int maxCargo = -1; flight = new Flight(airline, flightNumber, commercialFlightNumber, from, to, aircraft, aircraftType, aircraftATCType, std, sta, maxPax, maxCargo, randomPayload, repetative, isMaster, beginDate, endDate, days, adults, females, children, infants, baggage, cargo, payload); flights.Add(flight); } rowCount++; } } } return(flights); }
public async Task <DateTime> calArrDate(DateTime depDate, FlightTime time) { await Task.Run(() => true); return(depDate.AddMinutes(time.toMinutes())); }