public void Save(XmlTextWriter writer) { writer.WriteElementString("plots", Plots.ToString()); writer.WriteElementString("travelTime", TravelTime.ToString()); writer.WriteElementString("foodRate", FoodRate.ToString()); writer.WriteElementString("gameSeconds", GameSeconds.ToString()); if (PlotProbabilities.Count > 0) { writer.WriteStartElement("plot-probabilities"); foreach (var probabilitySet in PlotProbabilities) { writer.WriteElementString("probability-set", CLIObject.ToArrayString(probabilitySet)); } // plot-probabilities writer.WriteEndElement(); } if (ProbabilityShiftTimes.Count > 0) { writer.WriteElementString("probability-shift-times", CLIObject.ToArrayString(ProbabilityShiftTimes)); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Transportation != null) { hashCode = hashCode * 59 + Transportation.GetHashCode(); } hashCode = hashCode * 59 + TravelTime.GetHashCode(); if (DepartureTime != null) { hashCode = hashCode * 59 + DepartureTime.GetHashCode(); } if (Properties != null) { hashCode = hashCode * 59 + Properties.GetHashCode(); } if (Range != null) { hashCode = hashCode * 59 + Range.GetHashCode(); } return(hashCode); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + TravelTime.GetHashCode(); hashCode = hashCode * 59 + Distance.GetHashCode(); if (DistanceBreakdown != null) { hashCode = hashCode * 59 + DistanceBreakdown.GetHashCode(); } if (Fares != null) { hashCode = hashCode * 59 + Fares.GetHashCode(); } if (Route != null) { hashCode = hashCode * 59 + Route.GetHashCode(); } return(hashCode); } }
/// <summary> /// Returns true if ResponseRoutesProperties instances are equal /// </summary> /// <param name="other">Instance of ResponseRoutesProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseRoutesProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( Distance == other.Distance || Distance.Equals(other.Distance) ) && ( Fares == other.Fares || Fares != null && Fares.Equals(other.Fares) ) && ( Route == other.Route || Route != null && Route.Equals(other.Route) )); }
/// <summary> /// Returns true if RequestTimeFilterDepartureSearch instances are equal /// </summary> /// <param name="other">Instance of RequestTimeFilterDepartureSearch to be compared</param> /// <returns>Boolean</returns> public bool Equals(RequestTimeFilterDepartureSearch other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( DepartureLocationId == other.DepartureLocationId || DepartureLocationId != null && DepartureLocationId.Equals(other.DepartureLocationId) ) && ( ArrivalLocationIds == other.ArrivalLocationIds || ArrivalLocationIds != null && other.ArrivalLocationIds != null && ArrivalLocationIds.SequenceEqual(other.ArrivalLocationIds) ) && ( Transportation == other.Transportation || Transportation != null && Transportation.Equals(other.Transportation) ) && ( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( DepartureTime == other.DepartureTime || DepartureTime != null && DepartureTime.Equals(other.DepartureTime) ) && ( Properties == other.Properties || Properties != null && other.Properties != null && Properties.SequenceEqual(other.Properties) ) && ( Range == other.Range || Range != null && Range.Equals(other.Range) )); }
public IDictionary <string, string> GetArguments() { var arguments = new Dictionary <string, string>(); arguments["plots"] = Plots.ToString(); arguments["travel-time"] = TravelTime.ToString(); arguments["food-rate"] = FoodRate.ToString(); arguments["game-duration"] = GameSeconds.ToString(); arguments["plot-probabilities"] = CLIObject.ToMultiArrayString(PlotProbabilities.Cast <IEnumerable <int> >()); arguments["probability-shift-times"] = CLIObject.ToArrayString(ProbabilityShiftTimes); return(arguments); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) hashCode = hashCode * 59 + TravelTime.GetHashCode(); hashCode = hashCode * 59 + Distance.GetHashCode(); return(hashCode); } }
private void showTravelDetails(StackPanel traveltimedetailsbox, TunnelListItem tunnelListItem) { if (tunnelListItem == null) { return; } traveltimedetailsbox.Visibility = System.Windows.Visibility.Visible; TravelTime item = (TravelTime)tunnelListItem; travelSectionID.Text = item.SectionID.ToString(); travelSectiontime.Text = item.SectionTravelTime.ToString(); travelDirection.Text = item.Direction; travelSectionDescription.Text = item.SectionDescription; }
public ActionResult Delete(int id) { try { TravelTime travelTimeToDelete = _db.TravelTimes.Find(id); _db.TravelTimes.Remove(travelTimeToDelete); _db.SaveChanges(); return(RedirectToAction("Index")); } catch { return(View()); } }
/// <summary> /// Returns true if RequestTimeFilterPostcodeDistrictsArrivalSearch instances are equal /// </summary> /// <param name="other">Instance of RequestTimeFilterPostcodeDistrictsArrivalSearch to be compared</param> /// <returns>Boolean</returns> public bool Equals(RequestTimeFilterPostcodeDistrictsArrivalSearch other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Transportation == other.Transportation || Transportation != null && Transportation.Equals(other.Transportation) ) && ( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( ArrivalTime == other.ArrivalTime || ArrivalTime != null && ArrivalTime.Equals(other.ArrivalTime) ) && ( ReachablePostcodesThreshold == other.ReachablePostcodesThreshold || ReachablePostcodesThreshold.Equals(other.ReachablePostcodesThreshold) ) && ( Properties == other.Properties || Properties != null && other.Properties != null && Properties.SequenceEqual(other.Properties) ) && ( Range == other.Range || Range != null && Range.Equals(other.Range) )); }
public ActionResult Create([Bind(Exclude = "ID")] TravelTime travelTimetoCreate) { if (!ModelState.IsValid) { return(View()); } _db.TravelTimes.Add(travelTimetoCreate); _db.SaveChanges(); return(RedirectToAction("Index")); }
public static bool ShouldGoToWork(this Citizen citizen, uint citizenId) { if (citizen.ValidWorkBuilding() && (citizen.ShouldBeAtWork(citizenId) || citizen.ShouldBeAtWork(citizenId, TimeSpan.FromHours(6)))) { var currentBuildingInstance = citizen.GetBuildingInstance(); var workBuildingInstance = citizen.WorkBuildingInstance(); if (currentBuildingInstance.HasValue) { var travelTime = TravelTime.EstimateTravelTime(currentBuildingInstance.Value, workBuildingInstance.Value); return(citizen.ShouldBeAtWork(citizenId, travelTime)); } else { return(citizen.ShouldBeAtWork(citizenId, TimeSpan.FromHours(2))); } } return(false); }
public ActionResult Edit(TravelTime travelTimeToEdit) { var originalTravelTime = (from m in _db.TravelTimes where m.ID == travelTimeToEdit.ID select m).First(); if (!ModelState.IsValid) { return(View(originalTravelTime)); } _db.Entry(originalTravelTime).CurrentValues.SetValues(travelTimeToEdit); _db.SaveChanges(); return(RedirectToAction("Index")); }
public static bool ShouldGoHome(this Citizen citizen) { if (citizen.ValidHomeBuilding() && citizen.Tired(TimeSpan.FromHours(6))) { var currentBuildingInstance = citizen.GetBuildingInstance(); var homeBuildingInstance = citizen.HomeBuildingInstance(); if (currentBuildingInstance.HasValue) { var travelTime = TravelTime.EstimateTravelTime(currentBuildingInstance.Value, homeBuildingInstance.Value); return(citizen.Tired(travelTime)); } else { return(citizen.Tired(TimeSpan.FromHours(2))); } } return(false); }
/// <summary> /// Returns true if ResponseTimeFilterFastProperties instances are equal /// </summary> /// <param name="other">Instance of ResponseTimeFilterFastProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseTimeFilterFastProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( Fares == other.Fares || Fares != null && Fares.Equals(other.Fares) )); }
/// <summary> /// Returns true if ResponseTimeFilterPostcodesProperties instances are equal /// </summary> /// <param name="other">Instance of ResponseTimeFilterPostcodesProperties to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseTimeFilterPostcodesProperties other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( Distance == other.Distance || Distance.Equals(other.Distance) )); }
/// <summary> /// Returns true if ResponseRoutePart instances are equal /// </summary> /// <param name="other">Instance of ResponseRoutePart to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseRoutePart other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( Id == other.Id || Id != null && Id.Equals(other.Id) ) && ( Type == other.Type || Type.Equals(other.Type) ) && ( Mode == other.Mode || Mode.Equals(other.Mode) ) && ( Directions == other.Directions || Directions != null && Directions.Equals(other.Directions) ) && ( Distance == other.Distance || Distance.Equals(other.Distance) ) && ( TravelTime == other.TravelTime || TravelTime.Equals(other.TravelTime) ) && ( Coords == other.Coords || Coords != null && other.Coords != null && Coords.SequenceEqual(other.Coords) ) && ( Direction == other.Direction || Direction != null && Direction.Equals(other.Direction) ) && ( Road == other.Road || Road != null && Road.Equals(other.Road) ) && ( Turn == other.Turn || Turn != null && Turn.Equals(other.Turn) ) && ( Line == other.Line || Line != null && Line.Equals(other.Line) ) && ( DepartureStation == other.DepartureStation || DepartureStation != null && DepartureStation.Equals(other.DepartureStation) ) && ( ArrivalStation == other.ArrivalStation || ArrivalStation != null && ArrivalStation.Equals(other.ArrivalStation) ) && ( DepartsAt == other.DepartsAt || DepartsAt != null && DepartsAt.Equals(other.DepartsAt) ) && ( ArrivesAt == other.ArrivesAt || ArrivesAt != null && ArrivesAt.Equals(other.ArrivesAt) ) && ( NumStops == other.NumStops || NumStops.Equals(other.NumStops) )); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } hashCode = hashCode * 59 + Type.GetHashCode(); hashCode = hashCode * 59 + Mode.GetHashCode(); if (Directions != null) { hashCode = hashCode * 59 + Directions.GetHashCode(); } hashCode = hashCode * 59 + Distance.GetHashCode(); hashCode = hashCode * 59 + TravelTime.GetHashCode(); if (Coords != null) { hashCode = hashCode * 59 + Coords.GetHashCode(); } if (Direction != null) { hashCode = hashCode * 59 + Direction.GetHashCode(); } if (Road != null) { hashCode = hashCode * 59 + Road.GetHashCode(); } if (Turn != null) { hashCode = hashCode * 59 + Turn.GetHashCode(); } if (Line != null) { hashCode = hashCode * 59 + Line.GetHashCode(); } if (DepartureStation != null) { hashCode = hashCode * 59 + DepartureStation.GetHashCode(); } if (ArrivalStation != null) { hashCode = hashCode * 59 + ArrivalStation.GetHashCode(); } if (DepartsAt != null) { hashCode = hashCode * 59 + DepartsAt.GetHashCode(); } if (ArrivesAt != null) { hashCode = hashCode * 59 + ArrivesAt.GetHashCode(); } hashCode = hashCode * 59 + NumStops.GetHashCode(); return(hashCode); } }
public TravelPanelMessage(object sender, TravelTime travelTime, int numberOfReachedPoints, string travelPanelVisibility) : base(sender) { TravelTime = travelTime; NumberOfReachedPoints = numberOfReachedPoints; TravelPanelVisibility = travelPanelVisibility; }
public void VisitTravelSearchPage() { _driver.Navigate().GoToUrl(_configuration.TravelTimeUrl); _travelTimePage = new TravelTime(); PageFactory.InitElements(_driver, _travelTimePage); }
public override string ToString() { return("Offer number: " + OfferNumber.ToString() + Environment.NewLine + "Travel destination: " + TravelDestination + Environment.NewLine + "Feeding: " + Feeding + Environment.NewLine + "Price per person: €" + Price.ToString() + Environment.NewLine + "Travel time: " + TravelTime.ToString() + " days" + Environment.NewLine + "Hotel ranking: " + HotelRanking); }