mirror of
https://dev.azure.com/TeilRad/sharee.bike%20App/_git/Code
synced 2025-06-21 21:46:27 +02:00
Version 3.0.381
This commit is contained in:
parent
f963c0a219
commit
3a363acf3a
1525 changed files with 60589 additions and 125098 deletions
38
SharedBusinessLogic/Model/Stations/StationNS/IStation.cs
Normal file
38
SharedBusinessLogic/Model/Stations/StationNS/IStation.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ShareeBike.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds station information, i.e. static information like station name, station position and dynamic information like bikes available.
|
||||
/// </summary>
|
||||
public interface IStation
|
||||
{
|
||||
/// <summary> Holds the unique id of the station.c</summary>
|
||||
string Id { get; }
|
||||
|
||||
/// <summary> Holds the group to which the station belongs.</summary>
|
||||
IEnumerable<string> Group { get; }
|
||||
|
||||
/// <summary> Gets the name of the station.</summary>
|
||||
string StationName { get; }
|
||||
|
||||
/// <summary> Uri of the operator or null. </summary>
|
||||
Uri OperatorUri { get; }
|
||||
|
||||
/// <summary> Holds the gps- position of the station.</summary>
|
||||
IPosition Position { get; }
|
||||
|
||||
/// <summary> Holds operator related data.</summary>
|
||||
IData OperatorData { get; }
|
||||
|
||||
/// <summary> Gets the count of bikes available at station. </summary>
|
||||
int? AvailableBikesCount { get; }
|
||||
|
||||
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
|
||||
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
|
||||
IBikeGroupCol BikeGroups { get; }
|
||||
|
||||
}
|
||||
}
|
35
SharedBusinessLogic/Model/Stations/StationNS/NullStation.cs
Normal file
35
SharedBusinessLogic/Model/Stations/StationNS/NullStation.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ShareeBike.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS
|
||||
{
|
||||
/// <summary> Holds object representing null station.</summary>
|
||||
public class NullStation : IStation
|
||||
{
|
||||
/// <summary> Holds the unique id of the station.c</summary>
|
||||
public string Id => null;
|
||||
|
||||
/// <summary> Holds the group to which the station belongs.</summary>
|
||||
public IEnumerable<string> Group => new List<string>();
|
||||
|
||||
/// <summary> Gets the name of the station.</summary>
|
||||
public string StationName => string.Empty;
|
||||
|
||||
/// <summary> Uri of the operator or null. </summary>
|
||||
public Uri OperatorUri => null;
|
||||
|
||||
/// <summary> Holds the gps- position of the station.</summary>
|
||||
public IPosition Position => PositionFactory.Create();
|
||||
|
||||
/// <summary> Holds operator related data.</summary>
|
||||
public IData OperatorData => new Data();
|
||||
|
||||
/// <summary> Gets the count of bikes available at station. </summary>
|
||||
public int? AvailableBikesCount => null;
|
||||
|
||||
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
|
||||
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
|
||||
public IBikeGroupCol BikeGroups => null;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS.Operator
|
||||
{
|
||||
public class BikeGroupCol : List<BikeGroupCol.Entry> , IBikeGroupCol
|
||||
{
|
||||
/// <summary>
|
||||
/// Holds a group of bikes at a station.
|
||||
/// </summary>
|
||||
public class Entry
|
||||
{
|
||||
/// <summary>
|
||||
/// Bike group entry.
|
||||
/// </summary>
|
||||
/// <param name="name">Name of the group, either "Citybikes" or "Cargobikes".</param>
|
||||
/// <param name="availableCount"></param>
|
||||
/// <param name="group"></param>
|
||||
public Entry(string name, int? availableCount = null, string group = null)
|
||||
{
|
||||
Name = name;
|
||||
AvailableCount = availableCount ?? 0;
|
||||
Group = group ?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Name of the group, either "Citybikes" or "Cargobikes".
|
||||
/// </summary>
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary> Holds the count of bikes available of given type at station. </summary>
|
||||
public int AvailableCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Holds the group of the bikes. Citybike separates cargo and city bikes by group.
|
||||
/// </summary>
|
||||
public string Group { get; }
|
||||
}
|
||||
|
||||
public BikeGroupCol() : base() { }
|
||||
|
||||
public BikeGroupCol(IEnumerable<Entry> source) : base(source) { }
|
||||
|
||||
/// <summary> Holds the count of bikes available of any type at station. </summary>
|
||||
public int AvailableCount => this.Select(x => x.AvailableCount).Sum();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using Xamarin.Forms;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS.Operator
|
||||
{
|
||||
/// <summary> Holds operator related data.</summary>
|
||||
public class Data : IData
|
||||
{
|
||||
public Data(
|
||||
string name = null,
|
||||
string phoneNumberText = null,
|
||||
string hours = null,
|
||||
string mailAddressText = null, Color? color = null)
|
||||
{
|
||||
Name = name ?? string.Empty;
|
||||
PhoneNumberText = phoneNumberText ?? string.Empty;
|
||||
Hours = hours ?? string.Empty;
|
||||
MailAddressText = mailAddressText ?? string.Empty;
|
||||
Color = color;
|
||||
}
|
||||
|
||||
/// <summary> Name of the operator.</summary>
|
||||
public string Name { get; private set; }
|
||||
|
||||
/// <summary> Support phone number of the operator.</summary>
|
||||
public string PhoneNumberText { get; private set; }
|
||||
|
||||
/// <summary> Office times when support is available.</summary>
|
||||
public string Hours { get; private set; }
|
||||
|
||||
/// <summary> Support mails address of the operator.</summary>
|
||||
public string MailAddressText { get; private set; }
|
||||
|
||||
/// <summary> Color of the operator (operator specific skin)</summary>
|
||||
public Color? Color { get; private set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS.Operator
|
||||
{
|
||||
public interface IBikeGroupCol : IEnumerable<BikeGroupCol.Entry>
|
||||
{
|
||||
/// <summary> Holds the count of bikes available of given type at station. </summary>
|
||||
int AvailableCount { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
using Xamarin.Forms;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS.Operator
|
||||
{
|
||||
public interface IData
|
||||
{
|
||||
/// <summary> Name of the operator.</summary>
|
||||
string Name { get; }
|
||||
|
||||
/// <summary> Support phone number of the operator.</summary>
|
||||
string PhoneNumberText { get; }
|
||||
|
||||
/// <summary> Office times when support is available.</summary>
|
||||
string Hours { get; }
|
||||
|
||||
/// <summary> Support mails address of the operator.</summary>
|
||||
string MailAddressText { get; }
|
||||
|
||||
/// <summary> Color of the operator (operator specific skin)</summary>
|
||||
Color? Color { get; }
|
||||
}
|
||||
}
|
59
SharedBusinessLogic/Model/Stations/StationNS/Station.cs
Normal file
59
SharedBusinessLogic/Model/Stations/StationNS/Station.cs
Normal file
|
@ -0,0 +1,59 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using ShareeBike.Model.Stations.StationNS.Operator;
|
||||
|
||||
namespace ShareeBike.Model.Stations.StationNS
|
||||
{
|
||||
/// <summary> Holds station info. </summary>
|
||||
public class Station : IStation
|
||||
{
|
||||
/// <summary> Constructs a station object.</summary>
|
||||
/// <param name="id">Id of the station.</param>
|
||||
/// <param name="group">Group (ShareeBike, Citybike) to which station is related.</param>
|
||||
/// <param name="position">GPS- position of the station.</param>
|
||||
/// <param name="stationName">Name of the station.</param>
|
||||
/// <param name="operatorUri">Uri of the operator or null.</param>
|
||||
public Station(
|
||||
string id,
|
||||
IEnumerable<string> group = null,
|
||||
IPosition position = null,
|
||||
string stationName = "",
|
||||
Uri operatorUri = null,
|
||||
IData operatorData = null,
|
||||
IBikeGroupCol bikeGropCol = null)
|
||||
{
|
||||
Id = id;
|
||||
Group = group ?? throw new ArgumentException("Can not construct station object. Group of stations must not be null.");
|
||||
Position = position;
|
||||
StationName = stationName ?? string.Empty;
|
||||
OperatorData = operatorData ?? new Data();
|
||||
BikeGroups = bikeGropCol ?? new BikeGroupCol();
|
||||
OperatorUri = operatorUri;
|
||||
}
|
||||
|
||||
/// <summary> Holds the unique id of the station.c</summary>
|
||||
public string Id { get; }
|
||||
|
||||
/// <summary> Holds the group to which the station belongs.</summary>
|
||||
public IEnumerable<string> Group { get; }
|
||||
|
||||
/// <summary> Gets the name of the station.</summary>
|
||||
public string StationName { get; }
|
||||
|
||||
/// <summary> Holds the gps- position of the station.</summary>
|
||||
public IPosition Position { get; }
|
||||
|
||||
/// <summary> Holds operator related info.</summary>
|
||||
public IData OperatorData { get; }
|
||||
|
||||
/// <summary> Gets the count of bikes available at station. </summary>
|
||||
public int? AvailableBikesCount => BikeGroups.AvailableCount;
|
||||
|
||||
/// <summary> Gets bike <see cref="BikeGroupCol.Entry"/> objects. </summary>
|
||||
/// <remarks> Each entry has a name, holds the count of available bikes at station and the group value. /// </remarks>
|
||||
public IBikeGroupCol BikeGroups { get; }
|
||||
|
||||
/// <summary> Uri of the operator or null. </summary>
|
||||
public Uri OperatorUri { get; }
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue