private void GetDetails() { parkedVehicle_ = PMSService.GetbyId(RegistrationNo); if (parkedVehicle_ != null) { RegistrationNo = parkedVehicle_.RegistrationId; string[] temp = { parkedVehicle_.Floor, parkedVehicle_.SlotId.ToString() }; SlotId = string.Join("-", temp); //parkedVehicle_.SlotId.ToString(); VehicleType = parkedVehicle_.VehicleType; ArrivalTime = Convert.ToDateTime(parkedVehicle_.ArrivalTime).ToString(@"hh\:mm\ tt"); var timeSpan = (DepartureTime.Subtract(Convert.ToDateTime(parkedVehicle_.ArrivalTime))); ElapsedTime = timeSpan.ToString(@"hh\:mm"); // - res.ArrivalTime).ToString(); if (parkedVehicle_.VehicleType == AppConstant.MyEnum.Fourwheeler.ToString()) { ParkingCharges = Math.Round((timeSpan.TotalHours * ChargesPerHrs_FourWheeler), 2); } else { ParkingCharges = Math.Round((timeSpan.TotalHours * ChargesPerHrs_TwoWheeler), 2); } BorderVisibility = Visibility.Visible; } else { MessageBoxResult messageBoxResult = MessageBox.Show("This Vehicle does not exist in the Parking Area!", "Sorry!", MessageBoxButton.OK); if (messageBoxResult == MessageBoxResult.OK) { RegistrationNo = string.Empty; } } }
private static void InitTimeTableProperty() { _departureTimeTableControl = new GenericTableRowControl <DepartureTime>() { TitleValue = "Время отправления", TitleToolTip = "Представляет собой расписание отправлений по данному маршруту", OnAdd = timeTable => { var addDialog = new AddDepartureTimeDialog(); if (addDialog.ShowDialog() != true) { return(null); } return(new List <DepartureTime>() { addDialog.DepartureTime() }); } }; _departureTimeTableControl.AddColumns(DepartureTime.PropertyMatcher()); _dialog.AddProperty( _departureTimeTableControl.GetUiElement, () => _departureTimeTableControl.Value = new List <DepartureTime>(), r => _departureTimeTableControl.Value = r.DepartureTimes); }
/// <summary> /// Create URI for quering /// </summary> /// <returns></returns> public override Uri ToUri() { var qsb = new Internal.QueryStringBuilder() .Append("origins", WaypointsToUri(_waypointsOrigin)) .Append("destinations", WaypointsToUri(_waypointsDestination)) .Append("mode", Mode.ToString()) .Append("language", Language) .Append("units", Units.ToString()) .Append("avoid", AvoidHelper.MakeAvoidString(Avoid)) .Append("departure_time", DepartureTime.ToString()); if (DepartureTime == null) { qsb.Append("arrival_time", ArrivalTime.ToString()); } if (DepartureTime != null && Mode.Equals(TravelMode.driving)) { qsb.Append("traffic_model ", TrafficModel.ToString()); } if (Mode.Equals(TravelMode.transit)) { qsb.Append("transit_mode", TransitMode.ToString()); qsb.Append("transit_routing_preference ", TransitRoutingPreference.ToString()); } var url = "json?" + qsb.ToString(); return(new Uri(url, UriKind.Relative)); }
public void TestInitialize() { try { StreamReader testFileReader = new StreamReader(filePath, System.Text.Encoding.Default); data = testFileReader.ReadToEnd(); testFileReader.Close(); } catch (Exception) { //TODO } deserializer = new JavaScriptSerializer(); response = deserializer.Deserialize <Response>(data); List <Monitor> monitors = response.Data.Monitors; Monitor firstMonitor = monitors.First(); List <Line> lines = firstMonitor.Lines; firstLine = lines.First(); Departures departures = firstLine.Departures; List <Departure> departure = departures.Departure; Departure firstDeparture = departure.First(); Departure secondDeparture = departure.ElementAt(1); departureTime1 = firstDeparture.DepartureTime; departureTime2 = secondDeparture.DepartureTime; }
/// <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> /// Returns true if ResponseRoute instances are equal /// </summary> /// <param name="other">Instance of ResponseRoute to be compared</param> /// <returns>Boolean</returns> public bool Equals(ResponseRoute other) { if (other is null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return (( DepartureTime == other.DepartureTime || DepartureTime != null && DepartureTime.Equals(other.DepartureTime) ) && ( ArrivalTime == other.ArrivalTime || ArrivalTime != null && ArrivalTime.Equals(other.ArrivalTime) ) && ( Parts == other.Parts || Parts != null && other.Parts != null && Parts.SequenceEqual(other.Parts) )); }
public override int GetHashCode() { unchecked { return((Aircraft.ToUpper().GetHashCode() * 3) + (CruisingSpeed.ToUpper().GetHashCode() * 3) + (DepartureAerodrome.GetHashCode() * 3) + (CruisingLevel.ToUpper().GetHashCode() * 3) + (DestinationAerodrome.GetHashCode() * 3) + (DepartureTime.GetHashCode() * 3) + (ActualDepartureTime.GetHashCode() * 3) + (EETHours.GetHashCode() * 3) + (EETMinutess.GetHashCode() * 3) + (EnduranceHours.GetHashCode() * 3) + (EnduranceMinutes.GetHashCode() * 3) + (AlternateAerodrome.GetHashCode() * 3) + (SecondAlternateAerodrome.GetHashCode() * 3) + (OtherInfo.ToUpper().GetHashCode() * 3) + (Route.ToUpper().GetHashCode() * 3) + (TypeOfFlight.GetHashCode() * 3) + (PersonsOnBoard.GetHashCode() * 3) + (Revision.GetHashCode() * 3) + (FlightRules.GetHashCode() * 3) * 17); } }
private string CreateCode() { Random rnd = new Random(); int rndNumber = rnd.Next(1000, 9999); return(string.Format("{0}{1}-{2}-{3}", Route.DepartureLocation.Substring(0, 1), DepartureTime.ToString("yy:AA:dd"), (this.Bus is StandardBus) ? "ST" : "LX", rndNumber)); }
/// <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) )); }
/// <summary> /// Attempt to populate the <see cref="Location"/> property, and any timing point footnote properties, by looking their values up in dictionaries. /// </summary> /// <param name="locationMap">A dictionary of valid locations.</param> /// <param name="allFootnotes">A dictionary of valid footnotes.</param> public void ResolveAll(IDictionary <string, Location> locationMap, IDictionary <string, Note> allFootnotes) { ResolveLocation(locationMap); if (ArrivalTime != null) { ArrivalTime.ResolveFootnotes(allFootnotes); } if (DepartureTime != null) { DepartureTime.ResolveFootnotes(allFootnotes); } }
public bool Equals(Flight other) { if (other != null) { return(Origin.Equals(other.Origin) && Destination.Equals(other.Destination) && DepartureTime.Equals(other.DepartureTime) && DestinationTime.Equals(other.DestinationTime) && Price.Equals(other.Price)); } return(false); }
public override bool Equals(Object obj) { if (obj.GetType() != typeof(FlightDetails)) { return(false); } FlightDetails fd = (obj as FlightDetails); return(Origin.Equals(fd.Origin) && Destination.Equals(fd.Destination) && Price == fd.Price && DepartureTime.Equals(fd.DepartureTime) && DestinationTime.Equals(fd.DestinationTime)); }
public override int GetHashCode() { int hOrigin = Origin != null?Origin.GetHashCode() : 0; int hDestination = Destination != null?Destination.GetHashCode() : 0; int hDepartureTime = DepartureTime != null?DepartureTime.GetHashCode() : 0; int hDestinationTime = DestinationTime != null?DestinationTime.GetHashCode() : 0; int hPrice = Price != 0 ? Price.GetHashCode() : 0; return(hOrigin ^ hDestination ^ hDepartureTime ^ hDestinationTime ^ hPrice); }
public Route(DepartureTime departureTime, Identity driverID, Distance estimatedDistance, Duration estimatedDuration, Status status, Weight weight, Address addressDepot, ArrivalTime arrivalTime, List <Customer> customers) { DepartureTime = departureTime; DriverID = driverID; EstimatedDistance = estimatedDistance; EstimatedDuration = estimatedDuration; Status = status; Weight = weight; AddressDepot = addressDepot; Customers = customers; ArrivalTime = arrivalTime; }
/// <summary> /// Returns true if RequestTimeFilterPostcodeSectorsDepartureSearch instances are equal /// </summary> /// <param name="other">Instance of RequestTimeFilterPostcodeSectorsDepartureSearch to be compared</param> /// <returns>Boolean</returns> public bool Equals(RequestTimeFilterPostcodeSectorsDepartureSearch 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) ) && ( DepartureTime == other.DepartureTime || DepartureTime != null && DepartureTime.Equals(other.DepartureTime) ) && ( 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 virtual int _GetUniqueIdentifier() { var hashCode = 399326290; hashCode = hashCode * -1521134295 + (Id?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Owner?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (DepartureTime?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (CurrentStatus?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (Temperature?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (LoadPercentage?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (TotalVolume?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (AverageVolume?.GetHashCode() ?? 0); hashCode = hashCode * -1521134295 + (MaxTravelTime?.GetHashCode() ?? 0); return(hashCode); }
public override int GetHashCode() { var hashCode = -1474620316; hashCode = hashCode * -1521134295 + Id.GetHashCode(); hashCode = hashCode * -1521134295 + EqualityComparer <string> .Default.GetHashCode(RouteCode); hashCode = hashCode * -1521134295 + EqualityComparer <Airport> .Default.GetHashCode(OriginAirport); hashCode = hashCode * -1521134295 + EqualityComparer <Airport> .Default.GetHashCode(DestinationAirport); hashCode = hashCode * -1521134295 + DepartureTime.GetHashCode(); hashCode = hashCode * -1521134295 + ArrivalTime.GetHashCode(); hashCode = hashCode * -1521134295 + DayOfWeek.GetHashCode(); return(hashCode); }
public override int GetHashCode() { unchecked { var hashCode = (Company != null ? Company.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (From != null ? From.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (To != null ? To.GetHashCode() : 0); hashCode = (hashCode * 397) ^ RequestedDate.GetHashCode(); hashCode = (hashCode * 397) ^ DepartureDate.GetHashCode(); hashCode = (hashCode * 397) ^ ArrivalDate.GetHashCode(); hashCode = (hashCode * 397) ^ DepartureTime.GetHashCode(); hashCode = (hashCode * 397) ^ ArrivalTime.GetHashCode(); hashCode = (hashCode * 397) ^ Price.GetHashCode(); return(hashCode); } }
/// <summary> /// Change the times of this <see cref="TrainLocationTime" /> by reflecting them over another time. In other words, if beforehand the train arrives ten minutes before and departs five /// minutes before the reflection time, then afterwards, the train will arrive five minutes after and depart ten minutes after the reflection time. /// </summary> /// <param name="aroundTime">The time to reflect about.</param> /// <param name="alwaysSwap">If this parameter is false (the default), if the object only has a <see cref="DepartureTime" />, the reflected time will still be the /// <see cref="DepartureTime" />. If it is true, then if the object only has a <see cref="DepartureTime" /> it will become the <see cref="ArrivalTime" />.</param> public void Reflect(TimeOfDay aroundTime, bool alwaysSwap = false) { TrainTime newArrivalTime = DepartureTime?.CopyAndReflect(aroundTime); TrainTime newDepartureTime = ArrivalTime?.CopyAndReflect(aroundTime); if (newDepartureTime?.Time == null && newArrivalTime?.Time != null && !alwaysSwap) { DepartureTime = newArrivalTime; ArrivalTime = newDepartureTime; } else { DepartureTime = newDepartureTime; ArrivalTime = newArrivalTime; } }
/// <summary> /// Create a copy of this instance. The <see cref="ArrivalTime"/> and <see cref="DepartureTime"/> properties are deep copies, the others shallow copies. /// </summary> /// <returns>A <see cref="TrainLocationTime"/> object whose properties are equal to this instance.</returns> public TrainLocationTime Copy() { TrainLocationTime tlt = new TrainLocationTime { ArrivalTime = ArrivalTime.Copy(), DepartureTime = DepartureTime.Copy(), Location = Location, Pass = Pass, Path = Path, Platform = Platform, Line = Line, FormattingStrings = FormattingStrings, }; return(tlt); }
public string BusCodeGenerator() { String result = ""; result = this.Route.DepartureLocation[0] + DepartureTime.ToString("yyyyMMdd") + "-"; if (this.Bus is LuxuryBus) { result += "LX-"; } else if (this.Bus is StandartBus) { result += "ST-"; } result += this._code; return(result); }
public async Task <int> CreateBus(BusBindingModel busBindingModel) { var bus = new Bus() { BusName = busBindingModel.BusName }; bus = Context.Busses.Add(bus).Entity; int result = await Context.SaveChangesAsync(); foreach (var busStop in busBindingModel.BusStops) { StopOrdered stopOrdered = new StopOrdered() { BusId = bus.Id, BusStopId = busStop.StopId, }; stopOrdered.Delay = DelaysUtlility.ParseDelay(busStop.Delay, "00:00:00"); Context.StopsOrdered.Add(stopOrdered); } for (int i = 0; i < busBindingModel.BusStops.Length - 1; i++) { var c = busBindingModel.BusStops[i]; for (int j = i + 1; j < busBindingModel.BusStops.Length; j++) { var c1 = busBindingModel.BusStops[j]; StopAccessibility stopAccessibility = new StopAccessibility() { BusId = bus.Id, InitialStopId = c.StopId, DestStopId = c1.StopId }; Context.StopsAccessibility.Add(stopAccessibility); } } DepartureTime departureTime = new DepartureTime(); foreach (var time in busBindingModel.DepartureTimes) { departureTime.Departuretime = DelaysUtlility.ParseDelay(time, "00:00"); departureTime.BusId = bus.Id; Context.DepartureTimes.Add(departureTime); } await Context.SaveChangesAsync(); return(bus.Id); }
public bool Equals(SearchFlightsQuery other) { return(other != null && OriginIATACode == other.OriginIATACode && DestinationIATACode == other.DestinationIATACode && DepartureTime.Equals(other.DepartureTime) && NumberOfAdults == other.NumberOfAdults && EqualityComparer <DateTimeOffset?> .Default.Equals(ReturnDate, other.ReturnDate) && NumberOfChildren == other.NumberOfChildren && NumberOfInfants == other.NumberOfInfants && TravelClass == other.TravelClass && IncludedAirlineCodes == other.IncludedAirlineCodes && ExcludedAirlineCodes == other.ExcludedAirlineCodes && NoStops == other.NoStops && CurrencyCode == other.CurrencyCode && MaxPrice == other.MaxPrice && Max == other.Max); }
/// <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 (DepartureTime != null) { hashCode = hashCode * 59 + DepartureTime.GetHashCode(); } if (ArrivalTime != null) { hashCode = hashCode * 59 + ArrivalTime.GetHashCode(); } if (Parts != null) { hashCode = hashCode * 59 + Parts.GetHashCode(); } return(hashCode); } }
protected void departon_SelectedIndexChanged(object sender, EventArgs e) { if (departon.SelectedIndex == 0) { DepartureTime.Enabled = false; } else { DepartureTime.Enabled = true; } string connStr = ConfigurationManager.ConnectionStrings["BusTicketingConnectionString"].ConnectionString; DepartureTime.Items.Clear(); DataTable dtime = new DataTable(); using (SqlConnection con = new SqlConnection(connStr)) { try { SqlDataAdapter adapter = new SqlDataAdapter("SELECT departTime FROM dbo.Schedule WHERE departureDate='" + departon.SelectedValue + "'", con); adapter.Fill(dtime); DepartureTime.DataSource = dtime; DepartureTime.DataTextField = "departTime"; DepartureTime.DataValueField = "departTime"; DepartureTime.DataBind(); } catch (Exception ex) { // Handle the error } } }
/// <summary> /// Serialize this object's properties to XML. /// </summary> /// <param name="writer">Destination to write XML to.</param> public void WriteXml(XmlWriter writer) { if (writer is null) { throw new ArgumentNullException(nameof(writer)); } if (ArrivalTime != null) { writer.WriteStartElement("ArrivalTime"); ArrivalTime.WriteXml(writer); writer.WriteEndElement(); } if (DepartureTime != null) { writer.WriteStartElement("DepartureTime"); DepartureTime.WriteXml(writer); writer.WriteEndElement(); } writer.WriteElementString("Pass", Pass ? "true" : "false"); if (LocationId != null) { writer.WriteElementString("LocationId", LocationId); } if (Path != null) { writer.WriteElementString("Path", Path); } if (Platform != null) { writer.WriteElementString("Platform", Platform); } if (Line != null) { writer.WriteElementString("Line", Line); } }
public override double CalculateTravelTime(int distance) { double vehicleTravelTime = _deliveryVehicle.CalculateTravelTime(distance); return(Math.Round(DepartureTime.GetTimeInHours() + vehicleTravelTime, 2)); }
public override string ToString() { return(DepartureTime.ToString("hh:mm") + " " + Route.ToString()); }
public void DelayFlight(TimeSpan timeSpan) { DepartureTime.Add(timeSpan); }
protected override QueryStringParametersList GetQueryStringParameters() { if (Origins == null || !Origins.Any()) { throw new ArgumentException("Must specify an Origins"); } if (Destinations == null || !Destinations.Any()) { throw new ArgumentException("Must specify a Destinations"); } if (DepartureTime != null && ArrivalTime != null) { throw new ArgumentException("Must not specify both an ArrivalTime and a DepartureTime"); } if (Mode != DistanceMatrixTravelModes.transit && ArrivalTime != null) { throw new ArgumentException("Must not specify ArrivalTime for modes other than Transit"); } if (Mode != DistanceMatrixTravelModes.transit && TransitRoutingPreference != null) { throw new ArgumentException("Must not specify TransitRoutingPreference for modes other than Transit"); } if (Mode != DistanceMatrixTravelModes.transit && TransitModes != null && TransitModes.Length > 0) { throw new ArgumentException("Must not specify TransitModes for modes other than Transit"); } if ((!(Mode == null || Mode == DistanceMatrixTravelModes.driving) || DepartureTime == null) && TrafficModel != null) { throw new ArgumentException("A TrafficModel must not be specified unless the Mode is Driving and a DepartureTime is provided"); } var parameters = base.GetQueryStringParameters(); parameters.Add("origins", string.Join("|", Origins)); parameters.Add("destinations", string.Join("|", Destinations)); if (DepartureTime != null) { parameters.Add("departure_time", DepartureTime.ToString()); } if (ArrivalTime != null) { parameters.Add("arrival_time", ArrivalTime.ToString()); } if (Mode != null) { parameters.Add("mode", Mode.ToString()); } if (TrafficModel != null) { parameters.Add("traffic_model", TrafficModel.ToString()); } if (TransitRoutingPreference != null) { parameters.Add("transit_routing_preference", TransitRoutingPreference.ToString()); } if (TransitModes != null && TransitModes.Length > 0) { parameters.Add("transit_mode", string.Join("|", TransitModes.Select(a => a.ToString()))); } if (Avoid != null) { parameters.Add("avoid", Avoid.ToString()); } if (Units != null) { parameters.Add("units", Units.ToString()); } if (!string.IsNullOrWhiteSpace(Language)) { parameters.Add("language", Language); } return(parameters); }