From 4b61aff1dd6b46fae74ca855a44a85c6eafee80c Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Sun, 19 Aug 2018 14:31:58 +0200 Subject: [PATCH] add the solutions --- AirlineServer/AirlineServer.sln | 25 ++ .../AirlineServer/AirlineServer.csproj | 142 ++++++++++ .../AirlineServer/AirlineService.svc | 1 + .../AirlineServer/AirlineService.svc.cs | 157 +++++++++++ AirlineServer/AirlineServer/Global.asax | 1 + AirlineServer/AirlineServer/Global.asax.cs | 16 ++ .../AirlineServer/Helper/FindFlight.cs | 69 +++++ .../AirlineServer/IAirlineService.cs | 27 ++ AirlineServer/AirlineServer/Models/Airline.cs | 13 + AirlineServer/AirlineServer/Models/Airport.cs | 15 + AirlineServer/AirlineServer/Models/City.cs | 15 + AirlineServer/AirlineServer/Models/Flight.cs | 26 ++ .../AirlineServer/Properties/AssemblyInfo.cs | 35 +++ AirlineServer/AirlineServer/Web.Debug.config | 30 ++ .../AirlineServer/Web.Release.config | 31 ++ AirlineServer/AirlineServer/Web.config | 34 +++ AirlineServer/AirlineServer/packages.config | 5 + .../AirlineService/AirlineService.disco | 4 + .../AirlineService/AirlineService.wsdl | 39 +++ .../AirlineService/AirlineService.xsd | 16 ++ .../AirlineService/AirlineService1.xsd | 42 +++ .../AirlineService/AirlineService2.xsd | 28 ++ ...Plattform.AirlineService.Flight.datasource | 10 + .../AirlineService/Reference.cs | 264 ++++++++++++++++++ .../AirlineService/Reference.svcmap | 35 +++ .../AirlineService/configuration.svcinfo | 10 + .../AirlineService/configuration91.svcinfo | 201 +++++++++++++ Plattform/Plattform/DB/AirlineDB.cs | 73 +++++ Plattform/Plattform/DB/AvailabiltyDB.cs | 74 +++++ Plattform/Plattform/DB/CityDB.cs | 74 +++++ Plattform/Plattform/DB/Context.cs | 61 ++++ Plattform/Plattform/DB/FlightDB.cs | 73 +++++ Plattform/Plattform/DB/HotelDB.cs | 74 +++++ Plattform/Plattform/DB/RoomDB.cs | 73 +++++ Plattform/Plattform/DB/RoomTypeDB.cs | 74 +++++ Plattform/Plattform/Global.asax | 1 + Plattform/Plattform/Global.asax.cs | 16 ++ .../Helper/EntitiesContextInitializer.cs | 24 ++ Plattform/Plattform/Helper/GenerateData.cs | 37 +++ .../Plattform/Helper/MappingExtensions.cs | 14 + Plattform/Plattform/IPlattformService.cs | 17 ++ Plattform/Plattform/Models/Airline.cs | 22 ++ Plattform/Plattform/Models/Availability.cs | 22 ++ Plattform/Plattform/Models/City.cs | 24 ++ Plattform/Plattform/Models/Customer.cs | 24 ++ Plattform/Plattform/Models/Flight.cs | 34 +++ Plattform/Plattform/Models/Gender.cs | 17 ++ Plattform/Plattform/Models/Hotel.cs | 15 + Plattform/Plattform/Models/Person.cs | 41 +++ Plattform/Plattform/Models/Room.cs | 18 ++ .../Plattform/Models/RoomAvailability.cs | 15 + Plattform/Plattform/Models/RoomType.cs | 18 ++ Plattform/Plattform/Models/Saluation.cs | 17 ++ Plattform/Plattform/Plattform.csproj | 204 ++++++++++++++ Plattform/Plattform/PlattformService.svc | 1 + Plattform/Plattform/PlattformService.svc.cs | 18 ++ .../Plattform/Properties/AssemblyInfo.cs | 35 +++ Plattform/Plattform/Web.Debug.config | 30 ++ Plattform/Plattform/Web.Release.config | 31 ++ Plattform/Plattform/Web.config | 54 ++++ Plattform/Plattform/home.aspx | 34 +++ Plattform/Plattform/home.aspx.cs | 39 +++ Plattform/Plattform/home.aspx.designer.cs | 78 ++++++ Plattform/Plattform/packages.config | 7 + Plattform/Plattfrom.sln | 25 ++ WPFClient/WPFClient/App.config | 6 + WPFClient/WPFClient/App.xaml | 9 + WPFClient/WPFClient/App.xaml.cs | 17 ++ WPFClient/WPFClient/MainWindow.xaml | 12 + WPFClient/WPFClient/MainWindow.xaml.cs | 28 ++ .../WPFClient/Properties/AssemblyInfo.cs | 55 ++++ .../Properties/Resources.Designer.cs | 71 +++++ WPFClient/WPFClient/Properties/Resources.resx | 117 ++++++++ .../WPFClient/Properties/Settings.Designer.cs | 30 ++ .../WPFClient/Properties/Settings.settings | 7 + WPFClient/WPFClient/WPFClient.csproj | 97 +++++++ 76 files changed, 3248 insertions(+) create mode 100644 AirlineServer/AirlineServer.sln create mode 100644 AirlineServer/AirlineServer/AirlineServer.csproj create mode 100644 AirlineServer/AirlineServer/AirlineService.svc create mode 100644 AirlineServer/AirlineServer/AirlineService.svc.cs create mode 100644 AirlineServer/AirlineServer/Global.asax create mode 100644 AirlineServer/AirlineServer/Global.asax.cs create mode 100644 AirlineServer/AirlineServer/Helper/FindFlight.cs create mode 100644 AirlineServer/AirlineServer/IAirlineService.cs create mode 100644 AirlineServer/AirlineServer/Models/Airline.cs create mode 100644 AirlineServer/AirlineServer/Models/Airport.cs create mode 100644 AirlineServer/AirlineServer/Models/City.cs create mode 100644 AirlineServer/AirlineServer/Models/Flight.cs create mode 100644 AirlineServer/AirlineServer/Properties/AssemblyInfo.cs create mode 100644 AirlineServer/AirlineServer/Web.Debug.config create mode 100644 AirlineServer/AirlineServer/Web.Release.config create mode 100644 AirlineServer/AirlineServer/Web.config create mode 100644 AirlineServer/AirlineServer/packages.config create mode 100644 Plattform/Plattform/Connected Services/AirlineService/AirlineService.disco create mode 100644 Plattform/Plattform/Connected Services/AirlineService/AirlineService.wsdl create mode 100644 Plattform/Plattform/Connected Services/AirlineService/AirlineService.xsd create mode 100644 Plattform/Plattform/Connected Services/AirlineService/AirlineService1.xsd create mode 100644 Plattform/Plattform/Connected Services/AirlineService/AirlineService2.xsd create mode 100644 Plattform/Plattform/Connected Services/AirlineService/Plattform.AirlineService.Flight.datasource create mode 100644 Plattform/Plattform/Connected Services/AirlineService/Reference.cs create mode 100644 Plattform/Plattform/Connected Services/AirlineService/Reference.svcmap create mode 100644 Plattform/Plattform/Connected Services/AirlineService/configuration.svcinfo create mode 100644 Plattform/Plattform/Connected Services/AirlineService/configuration91.svcinfo create mode 100644 Plattform/Plattform/DB/AirlineDB.cs create mode 100644 Plattform/Plattform/DB/AvailabiltyDB.cs create mode 100644 Plattform/Plattform/DB/CityDB.cs create mode 100644 Plattform/Plattform/DB/Context.cs create mode 100644 Plattform/Plattform/DB/FlightDB.cs create mode 100644 Plattform/Plattform/DB/HotelDB.cs create mode 100644 Plattform/Plattform/DB/RoomDB.cs create mode 100644 Plattform/Plattform/DB/RoomTypeDB.cs create mode 100644 Plattform/Plattform/Global.asax create mode 100644 Plattform/Plattform/Global.asax.cs create mode 100644 Plattform/Plattform/Helper/EntitiesContextInitializer.cs create mode 100644 Plattform/Plattform/Helper/GenerateData.cs create mode 100644 Plattform/Plattform/Helper/MappingExtensions.cs create mode 100644 Plattform/Plattform/IPlattformService.cs create mode 100644 Plattform/Plattform/Models/Airline.cs create mode 100644 Plattform/Plattform/Models/Availability.cs create mode 100644 Plattform/Plattform/Models/City.cs create mode 100644 Plattform/Plattform/Models/Customer.cs create mode 100644 Plattform/Plattform/Models/Flight.cs create mode 100644 Plattform/Plattform/Models/Gender.cs create mode 100644 Plattform/Plattform/Models/Hotel.cs create mode 100644 Plattform/Plattform/Models/Person.cs create mode 100644 Plattform/Plattform/Models/Room.cs create mode 100644 Plattform/Plattform/Models/RoomAvailability.cs create mode 100644 Plattform/Plattform/Models/RoomType.cs create mode 100644 Plattform/Plattform/Models/Saluation.cs create mode 100644 Plattform/Plattform/Plattform.csproj create mode 100644 Plattform/Plattform/PlattformService.svc create mode 100644 Plattform/Plattform/PlattformService.svc.cs create mode 100644 Plattform/Plattform/Properties/AssemblyInfo.cs create mode 100644 Plattform/Plattform/Web.Debug.config create mode 100644 Plattform/Plattform/Web.Release.config create mode 100644 Plattform/Plattform/Web.config create mode 100644 Plattform/Plattform/home.aspx create mode 100644 Plattform/Plattform/home.aspx.cs create mode 100644 Plattform/Plattform/home.aspx.designer.cs create mode 100644 Plattform/Plattform/packages.config create mode 100644 Plattform/Plattfrom.sln create mode 100644 WPFClient/WPFClient/App.config create mode 100644 WPFClient/WPFClient/App.xaml create mode 100644 WPFClient/WPFClient/App.xaml.cs create mode 100644 WPFClient/WPFClient/MainWindow.xaml create mode 100644 WPFClient/WPFClient/MainWindow.xaml.cs create mode 100644 WPFClient/WPFClient/Properties/AssemblyInfo.cs create mode 100644 WPFClient/WPFClient/Properties/Resources.Designer.cs create mode 100644 WPFClient/WPFClient/Properties/Resources.resx create mode 100644 WPFClient/WPFClient/Properties/Settings.Designer.cs create mode 100644 WPFClient/WPFClient/Properties/Settings.settings create mode 100644 WPFClient/WPFClient/WPFClient.csproj diff --git a/AirlineServer/AirlineServer.sln b/AirlineServer/AirlineServer.sln new file mode 100644 index 0000000..e396b23 --- /dev/null +++ b/AirlineServer/AirlineServer.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2042 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AirlineServer", "AirlineServer\AirlineServer.csproj", "{78131D71-501C-45B5-B3EE-3A14CFB609F9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {78131D71-501C-45B5-B3EE-3A14CFB609F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78131D71-501C-45B5-B3EE-3A14CFB609F9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78131D71-501C-45B5-B3EE-3A14CFB609F9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78131D71-501C-45B5-B3EE-3A14CFB609F9}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {526CF61C-F64D-4C2E-BA9A-A7AAD03B7337} + EndGlobalSection +EndGlobal diff --git a/AirlineServer/AirlineServer/AirlineServer.csproj b/AirlineServer/AirlineServer/AirlineServer.csproj new file mode 100644 index 0000000..4ae28eb --- /dev/null +++ b/AirlineServer/AirlineServer/AirlineServer.csproj @@ -0,0 +1,142 @@ + + + + + + Debug + AnyCPU + + + 2.0 + {78131D71-501C-45B5-B3EE-3A14CFB609F9} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + AirlineServer + AirlineServer + v4.6.1 + true + + + + + + + + + True + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + + + + + + + + + + + + + + + + + + + + Web.config + + + Web.config + + + + + + + + + + AirlineService.svc + + + + Global.asax + + + + + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 49949 + / + http://localhost:49949/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/AirlineServer/AirlineServer/AirlineService.svc b/AirlineServer/AirlineServer/AirlineService.svc new file mode 100644 index 0000000..b99a9be --- /dev/null +++ b/AirlineServer/AirlineServer/AirlineService.svc @@ -0,0 +1 @@ +<%@ ServiceHost Language="C#" Debug="true" Service="AirlineServer.AirlineService" CodeBehind="AirlineService.svc.cs" %> diff --git a/AirlineServer/AirlineServer/AirlineService.svc.cs b/AirlineServer/AirlineServer/AirlineService.svc.cs new file mode 100644 index 0000000..db6cb60 --- /dev/null +++ b/AirlineServer/AirlineServer/AirlineService.svc.cs @@ -0,0 +1,157 @@ +using System; +using System.Linq; +using System.Collections.Generic; +using AirlineServer.Models; +using AirlineServer.Helper; + +namespace AirlineServer +{ + // NOTE: You can use the "Rename" command on the "Refactor" menu to change + // the class name "AirlineService" in code, svc and config file together. + // NOTE: In order to launch WCF Test Client for testing this service, please + // select AirlineService.svc or AirlineService.svc.cs at the Solution + // Explorer and start debugging. + public class AirlineService : IAirlineService + { + + public List flights = new List(); + + public Flight BookFlight(Flight flight, + int numberOfSeats) + { + Flight flightToBook = this.flights.Single(f => f == flight); + if (flightToBook != null) + { + flightToBook.BookedSeats += numberOfSeats; + return flightToBook; + } + else + { + return flight; + } + } + public Flight CancelFlight(Flight flight, int numberOfSeats) + { + Flight flightToBook = this.flights.Single(f => f == flight); + if (flightToBook != null) + { + flightToBook.BookedSeats -= numberOfSeats; + return flightToBook; + } + else + { + return flight; + } + } + public ICollection> GetFlights(DateTime startTime, + DateTime endTime, + string origin, + string destination, + int numberOfSeats) + { + ICollection> freeFlights = new List>(); + freeFlights = FindFlight.Search(this.flights, startTime, + endTime, origin, + destination, numberOfSeats); + return freeFlights; + } + + public AirlineService(){ + List flights = new List(); + + Airline lufthansa = new Airline { Name = "Lufthansa" }; + Airline easyjet = new Airline { Name = "Easyjet" }; + + City zurich = new City { Name = "Zurich", ZipCode = 9000 }; + City basel = new City { Name = "Basel", ZipCode = 3000 }; + City genf = new City { Name = "Genf", ZipCode = 1000 }; + City belp = new City { Name = "Belp", ZipCode = 5000 }; + + Airport azurich = new Airport + { + ShortName = "ZRH", + Name = "Zurich Airport", + City = zurich + }; + + Airport abasel = new Airport + { + ShortName = "BSL", + Name = "Basel Airport", + City = basel + }; + + Airport agenf = new Airport + { + ShortName = "GNF", + Name = "Geneva Airport", + City = genf + }; + + Airport abelp = new Airport + { + ShortName = "BLP", + Name = "Belp Airport", + City = belp + }; + + DateTime zurichStartDate = new DateTime(2018, 08, 15, 12, 00, + 00, 00); + DateTime baselStartDate = new DateTime(2018, 08, 15, 12, 00, + 00, 00); + DateTime genfStartDate = new DateTime(2018, 08, 19, 12, 00, + 00, 00); + DateTime belpStartDate = new DateTime(2018, 08, 09, 12, 00, + 00, 00); + + Flight zurich_basel = new Flight + { + Airline = lufthansa, + Name = "LFH1206", + StartTime = zurichStartDate, + Duration = 2.50F, + Origin = azurich, + Destination = abasel, + MaxSeats = 10, + BookedSeats = 0 + }; + Flight basel_zurich = new Flight + { + Airline = easyjet, + Name = "ESZ666", + StartTime = baselStartDate, + Duration = 7.20F, + Origin = abasel, + Destination = azurich, + MaxSeats = 10, + BookedSeats = 0 + }; + Flight genf_zurich = new Flight + { + Airline = easyjet, + Name = "ESZ666", + StartTime = genfStartDate, + Duration = 7.20F, + Origin = agenf, + Destination = azurich, + MaxSeats = 10, + BookedSeats = 0 + }; + Flight belp_zurich = new Flight + { + Airline = easyjet, + Name = "ESZ666", + StartTime = belpStartDate, + Duration = 7.20F, + Origin = abelp, + Destination = azurich, + MaxSeats = 10, + BookedSeats = 0 + }; + this.flights.Add(zurich_basel); + this.flights.Add(basel_zurich); + this.flights.Add(genf_zurich); + this.flights.Add(belp_zurich); + } + } +} diff --git a/AirlineServer/AirlineServer/Global.asax b/AirlineServer/AirlineServer/Global.asax new file mode 100644 index 0000000..cdd796e --- /dev/null +++ b/AirlineServer/AirlineServer/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="AirlineServer.Global" Language="C#" %> diff --git a/AirlineServer/AirlineServer/Global.asax.cs b/AirlineServer/AirlineServer/Global.asax.cs new file mode 100644 index 0000000..296c722 --- /dev/null +++ b/AirlineServer/AirlineServer/Global.asax.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.SessionState; + +namespace AirlineServer +{ + public class Global : System.Web.HttpApplication + { + protected void Application_Start(object sender, EventArgs e) + { + } + } +} \ No newline at end of file diff --git a/AirlineServer/AirlineServer/Helper/FindFlight.cs b/AirlineServer/AirlineServer/Helper/FindFlight.cs new file mode 100644 index 0000000..649a3f2 --- /dev/null +++ b/AirlineServer/AirlineServer/Helper/FindFlight.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using AirlineServer.Models; + +namespace AirlineServer.Helper +{ + public static class FindFlight + { + public static ICollection> Search( + ICollection flights, + DateTime startTime, + DateTime endTime, + string destination, + string origin, + int numberOfSeats) + { + ICollection> free_flights = + new List>(); + + var flightsWithSeats = FindFlight + .FlightsWithSeats(flights, numberOfSeats); + var flightsTo= FindFlight + .FlightsTo(flightsWithSeats, destination, origin, startTime); + var flightsBack = FindFlight + .FlightsBack(flightsWithSeats, destination, origin, endTime); + + free_flights.Add(flightsTo); + free_flights.Add(flightsBack); + return free_flights; + } + public static IEnumerable FlightsWithSeats( + ICollection raw_flights, + int numberOfSeats) + { + IEnumerable flights = new List(); + flights = raw_flights.Where(f => (f.MaxSeats - f.BookedSeats) + > numberOfSeats); + return flights; + } + public static IEnumerable FlightsTo(IEnumerable raw_flights, + string destination, + string origin, + DateTime startTime) + { + IEnumerable flights = new List(); + flights = raw_flights.Where(f => + f.Destination.City.Name == destination + & f.Origin.City.Name == origin + & f.StartTime == startTime); + return flights; + } + // Since this function searches for a flight back the arguments + // destination and origin get used in reverse. + public static IEnumerable FlightsBack(IEnumerable raw_flights, + string destination, + string origin, + DateTime endTime) + { + IEnumerable flights = new List(); + flights = raw_flights.Where(f => + f.Destination.City.Name == origin + & f.Origin.City.Name == destination + & f.StartTime == endTime); + return flights; + } + } +} diff --git a/AirlineServer/AirlineServer/IAirlineService.cs b/AirlineServer/AirlineServer/IAirlineService.cs new file mode 100644 index 0000000..d2c3c73 --- /dev/null +++ b/AirlineServer/AirlineServer/IAirlineService.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.Text; +using AirlineServer.Models; + +namespace AirlineServer +{ + // NOTE: You can use the "Rename" command on the "Refactor" menu to change + // the interface name "IAirlineService" in both code and config file + // together. + [ServiceContract] + public interface IAirlineService + { + [OperationContract] + ICollection> GetFlights(DateTime startTime, + DateTime endTime, + string origin, + string destination, + int numberOfSeats); + [OperationContract] + Flight BookFlight(Flight flight, int numberOfSeats); + Flight CancelFlight(Flight flight, int numberOfSeats); + } +} diff --git a/AirlineServer/AirlineServer/Models/Airline.cs b/AirlineServer/AirlineServer/Models/Airline.cs new file mode 100644 index 0000000..c4e97a1 --- /dev/null +++ b/AirlineServer/AirlineServer/Models/Airline.cs @@ -0,0 +1,13 @@ +using System.Runtime.Serialization; + +namespace AirlineServer.Models +{ + [DataContract] + public class Airline + { + [DataMember] + public int AirlineID { get; set; } + [DataMember] + public string Name { get; set; } + } +} diff --git a/AirlineServer/AirlineServer/Models/Airport.cs b/AirlineServer/AirlineServer/Models/Airport.cs new file mode 100644 index 0000000..878c2a6 --- /dev/null +++ b/AirlineServer/AirlineServer/Models/Airport.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace AirlineServer.Models +{ + [DataContract] + public class Airport + { + [DataMember] + public string ShortName { get; set; } + [DataMember] + public string Name { get; set; } + [DataMember] + public City City { get; set; } + } +} diff --git a/AirlineServer/AirlineServer/Models/City.cs b/AirlineServer/AirlineServer/Models/City.cs new file mode 100644 index 0000000..1e68f8c --- /dev/null +++ b/AirlineServer/AirlineServer/Models/City.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace AirlineServer.Models +{ + [DataContract] + public class City + { + [DataMember] + public int CityID { get; set; } + [DataMember] + public string Name { get; set; } + [DataMember] + public int ZipCode { get; set; } + } +} diff --git a/AirlineServer/AirlineServer/Models/Flight.cs b/AirlineServer/AirlineServer/Models/Flight.cs new file mode 100644 index 0000000..12d42ac --- /dev/null +++ b/AirlineServer/AirlineServer/Models/Flight.cs @@ -0,0 +1,26 @@ +using System; +using System.Runtime.Serialization; + +namespace AirlineServer.Models +{ + [DataContract] + public class Flight + { + [DataMember] + public int FlightID { get; set; } + [DataMember] + public Airline Airline { get; set; } + [DataMember] + public string Name { get; set; } + [DataMember] + public DateTime StartTime { get; set; } + [DataMember] + public float Duration { get; set; } + [DataMember] + public Airport Origin { get; set; } + [DataMember] + public Airport Destination { get; set; } + public int MaxSeats { get; set; } + public int BookedSeats { get; set; } + } +} diff --git a/AirlineServer/AirlineServer/Properties/AssemblyInfo.cs b/AirlineServer/AirlineServer/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..eab62fa --- /dev/null +++ b/AirlineServer/AirlineServer/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("AirlineServer")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("AirlineServer")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("78131d71-501c-45b5-b3ee-3a14cfb609f9")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/AirlineServer/AirlineServer/Web.Debug.config b/AirlineServer/AirlineServer/Web.Debug.config new file mode 100644 index 0000000..fae9cfe --- /dev/null +++ b/AirlineServer/AirlineServer/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/AirlineServer/AirlineServer/Web.Release.config b/AirlineServer/AirlineServer/Web.Release.config new file mode 100644 index 0000000..da6e960 --- /dev/null +++ b/AirlineServer/AirlineServer/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/AirlineServer/AirlineServer/Web.config b/AirlineServer/AirlineServer/Web.config new file mode 100644 index 0000000..874e4e4 --- /dev/null +++ b/AirlineServer/AirlineServer/Web.config @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/AirlineServer/AirlineServer/packages.config b/AirlineServer/AirlineServer/packages.config new file mode 100644 index 0000000..66649ac --- /dev/null +++ b/AirlineServer/AirlineServer/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/AirlineService.disco b/Plattform/Plattform/Connected Services/AirlineService/AirlineService.disco new file mode 100644 index 0000000..93ba4dd --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/AirlineService.disco @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/AirlineService.wsdl b/Plattform/Plattform/Connected Services/AirlineService/AirlineService.wsdl new file mode 100644 index 0000000..4f8176b --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/AirlineService.wsdl @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/AirlineService.xsd b/Plattform/Plattform/Connected Services/AirlineService/AirlineService.xsd new file mode 100644 index 0000000..980e393 --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/AirlineService.xsd @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/AirlineService1.xsd b/Plattform/Plattform/Connected Services/AirlineService/AirlineService1.xsd new file mode 100644 index 0000000..d58e7f3 --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/AirlineService1.xsd @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/AirlineService2.xsd b/Plattform/Plattform/Connected Services/AirlineService/AirlineService2.xsd new file mode 100644 index 0000000..459027b --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/AirlineService2.xsd @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/Plattform.AirlineService.Flight.datasource b/Plattform/Plattform/Connected Services/AirlineService/Plattform.AirlineService.Flight.datasource new file mode 100644 index 0000000..3795b0c --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/Plattform.AirlineService.Flight.datasource @@ -0,0 +1,10 @@ + + + + Plattform.AirlineService.Flight, Connected Services.AirlineService.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/Reference.cs b/Plattform/Plattform/Connected Services/AirlineService/Reference.cs new file mode 100644 index 0000000..11e3297 --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/Reference.cs @@ -0,0 +1,264 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Plattform.AirlineService { + using System.Runtime.Serialization; + using System; + + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name="Flight", Namespace="http://schemas.datacontract.org/2004/07/AirlineServer.Models")] + [System.SerializableAttribute()] + public partial class Flight : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { + + [System.NonSerializedAttribute()] + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private Plattform.AirlineService.Airline AirlineField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private float DurationField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private int FlightIDField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string FromCityShortNameField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string NameField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private System.DateTime StartTimeField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string ToCityShortNameField; + + [global::System.ComponentModel.BrowsableAttribute(false)] + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { + get { + return this.extensionDataField; + } + set { + this.extensionDataField = value; + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public Plattform.AirlineService.Airline Airline { + get { + return this.AirlineField; + } + set { + if ((object.ReferenceEquals(this.AirlineField, value) != true)) { + this.AirlineField = value; + this.RaisePropertyChanged("Airline"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public float Duration { + get { + return this.DurationField; + } + set { + if ((this.DurationField.Equals(value) != true)) { + this.DurationField = value; + this.RaisePropertyChanged("Duration"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public int FlightID { + get { + return this.FlightIDField; + } + set { + if ((this.FlightIDField.Equals(value) != true)) { + this.FlightIDField = value; + this.RaisePropertyChanged("FlightID"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string FromCityShortName { + get { + return this.FromCityShortNameField; + } + set { + if ((object.ReferenceEquals(this.FromCityShortNameField, value) != true)) { + this.FromCityShortNameField = value; + this.RaisePropertyChanged("FromCityShortName"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string Name { + get { + return this.NameField; + } + set { + if ((object.ReferenceEquals(this.NameField, value) != true)) { + this.NameField = value; + this.RaisePropertyChanged("Name"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public System.DateTime StartTime { + get { + return this.StartTimeField; + } + set { + if ((this.StartTimeField.Equals(value) != true)) { + this.StartTimeField = value; + this.RaisePropertyChanged("StartTime"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string ToCityShortName { + get { + return this.ToCityShortNameField; + } + set { + if ((object.ReferenceEquals(this.ToCityShortNameField, value) != true)) { + this.ToCityShortNameField = value; + this.RaisePropertyChanged("ToCityShortName"); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected void RaisePropertyChanged(string propertyName) { + System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; + if ((propertyChanged != null)) { + propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")] + [System.Runtime.Serialization.DataContractAttribute(Name="Airline", Namespace="http://schemas.datacontract.org/2004/07/AirlineServer.Models")] + [System.SerializableAttribute()] + public partial class Airline : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged { + + [System.NonSerializedAttribute()] + private System.Runtime.Serialization.ExtensionDataObject extensionDataField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private int AirlineIDField; + + [System.Runtime.Serialization.OptionalFieldAttribute()] + private string NameField; + + [global::System.ComponentModel.BrowsableAttribute(false)] + public System.Runtime.Serialization.ExtensionDataObject ExtensionData { + get { + return this.extensionDataField; + } + set { + this.extensionDataField = value; + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public int AirlineID { + get { + return this.AirlineIDField; + } + set { + if ((this.AirlineIDField.Equals(value) != true)) { + this.AirlineIDField = value; + this.RaisePropertyChanged("AirlineID"); + } + } + } + + [System.Runtime.Serialization.DataMemberAttribute()] + public string Name { + get { + return this.NameField; + } + set { + if ((object.ReferenceEquals(this.NameField, value) != true)) { + this.NameField = value; + this.RaisePropertyChanged("Name"); + } + } + } + + public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged; + + protected void RaisePropertyChanged(string propertyName) { + System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged; + if ((propertyChanged != null)) { + propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName)); + } + } + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + [System.ServiceModel.ServiceContractAttribute(ConfigurationName="AirlineService.IAirlineService")] + public interface IAirlineService { + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAirlineService/GetFreeFlights", ReplyAction="http://tempuri.org/IAirlineService/GetFreeFlightsResponse")] + Plattform.AirlineService.Flight[] GetFreeFlights(); + + [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAirlineService/GetFreeFlights", ReplyAction="http://tempuri.org/IAirlineService/GetFreeFlightsResponse")] + System.Threading.Tasks.Task GetFreeFlightsAsync(); + } + + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public interface IAirlineServiceChannel : Plattform.AirlineService.IAirlineService, System.ServiceModel.IClientChannel { + } + + [System.Diagnostics.DebuggerStepThroughAttribute()] + [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")] + public partial class AirlineServiceClient : System.ServiceModel.ClientBase, Plattform.AirlineService.IAirlineService { + + public AirlineServiceClient() { + } + + public AirlineServiceClient(string endpointConfigurationName) : + base(endpointConfigurationName) { + } + + public AirlineServiceClient(string endpointConfigurationName, string remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public AirlineServiceClient(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) : + base(endpointConfigurationName, remoteAddress) { + } + + public AirlineServiceClient(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) : + base(binding, remoteAddress) { + } + + public Plattform.AirlineService.Flight[] GetFreeFlights() { + return base.Channel.GetFreeFlights(); + } + + public System.Threading.Tasks.Task GetFreeFlightsAsync() { + return base.Channel.GetFreeFlightsAsync(); + } + } +} diff --git a/Plattform/Plattform/Connected Services/AirlineService/Reference.svcmap b/Plattform/Plattform/Connected Services/AirlineService/Reference.svcmap new file mode 100644 index 0000000..9fe885c --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/Reference.svcmap @@ -0,0 +1,35 @@ + + + + false + true + true + + false + false + false + + + true + Auto + true + true + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/configuration.svcinfo b/Plattform/Plattform/Connected Services/AirlineService/configuration.svcinfo new file mode 100644 index 0000000..b0d9809 --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/configuration.svcinfo @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Connected Services/AirlineService/configuration91.svcinfo b/Plattform/Plattform/Connected Services/AirlineService/configuration91.svcinfo new file mode 100644 index 0000000..e532f9e --- /dev/null +++ b/Plattform/Plattform/Connected Services/AirlineService/configuration91.svcinfo @@ -0,0 +1,201 @@ + + + + + + + BasicHttpBinding_IAirlineService + + + + + + + + + + + + + + + + + + + + + StrongWildcard + + + + + + 65536 + + + + + + + + + System.ServiceModel.Configuration.XmlDictionaryReaderQuotasElement + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + System.Text.UTF8Encoding + + + Buffered + + + + + + Text + + + System.ServiceModel.Configuration.BasicHttpSecurityElement + + + None + + + System.ServiceModel.Configuration.HttpTransportSecurityElement + + + None + + + None + + + System.Security.Authentication.ExtendedProtection.Configuration.ExtendedProtectionPolicyElement + + + Never + + + TransportSelected + + + (Collection) + + + + + + System.ServiceModel.Configuration.BasicHttpMessageSecurityElement + + + UserName + + + Default + + + + + + + + + http://localhost:49949/AirlineService.svc + + + + + + basicHttpBinding + + + BasicHttpBinding_IAirlineService + + + AirlineService.IAirlineService + + + System.ServiceModel.Configuration.AddressHeaderCollectionElement + + + <Header /> + + + System.ServiceModel.Configuration.IdentityElement + + + System.ServiceModel.Configuration.UserPrincipalNameElement + + + + + + System.ServiceModel.Configuration.ServicePrincipalNameElement + + + + + + System.ServiceModel.Configuration.DnsElement + + + + + + System.ServiceModel.Configuration.RsaElement + + + + + + System.ServiceModel.Configuration.CertificateElement + + + + + + System.ServiceModel.Configuration.CertificateReferenceElement + + + My + + + LocalMachine + + + FindBySubjectDistinguishedName + + + + + + False + + + BasicHttpBinding_IAirlineService + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/DB/AirlineDB.cs b/Plattform/Plattform/DB/AirlineDB.cs new file mode 100644 index 0000000..e4f83f2 --- /dev/null +++ b/Plattform/Plattform/DB/AirlineDB.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; + +namespace Plattform.DB +{ + public class AirlineDB + { + public ICollection GetAllAirlines() + { + using (Context ctx = new Context()) + { + return ctx.Airlines.ToList(); + } + } + public bool CreateAirline(Airline airline) + { + try + { + using (Context ctx = new Context()) + { + ctx.Airlines.Add(airline); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateAirline(Airline airline) + { + try + { + using (Context ctx = new Context()) + { + ctx.Airlines.Attach(airline); + ctx.Entry(airline).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteAirline(Airline airline) + { + try + { + using (Context ctx = new Context()) + { + ctx.Airlines.Attach(airline); + ctx.Airlines.Remove(airline); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/DB/AvailabiltyDB.cs b/Plattform/Plattform/DB/AvailabiltyDB.cs new file mode 100644 index 0000000..e8a56f3 --- /dev/null +++ b/Plattform/Plattform/DB/AvailabiltyDB.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; +using Plattform.AirlineService; + +namespace Plattform.DB +{ + public class AvailabilityDB + { + public ICollection GetAllAvailabilities() + { + using (Context ctx = new Context()) + { + return ctx.Availabilities.ToList(); + } + } + public bool CreateAvailability(Availability city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Availabilities.Add(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateAvailability(Availability city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Availabilities.Attach(city); + ctx.Entry(city).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteAvailability(Availability city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Availabilities.Attach(city); + ctx.Availabilities.Remove(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/DB/CityDB.cs b/Plattform/Plattform/DB/CityDB.cs new file mode 100644 index 0000000..126d1ef --- /dev/null +++ b/Plattform/Plattform/DB/CityDB.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; +using Plattform.AirlineService; + +namespace Plattform.DB +{ + public class CityDB + { + public ICollection GetAllCities() + { + using (Context ctx = new Context()) + { + return ctx.Cities.ToList(); + } + } + public bool CreateCity(City city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Cities.Add(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateCity(City city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Cities.Attach(city); + ctx.Entry(city).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteCity(City city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Cities.Attach(city); + ctx.Cities.Remove(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/DB/Context.cs b/Plattform/Plattform/DB/Context.cs new file mode 100644 index 0000000..057de8b --- /dev/null +++ b/Plattform/Plattform/DB/Context.cs @@ -0,0 +1,61 @@ +using System.Data.Entity; +using Plattform.Models; +using Plattform.Helper; + +namespace Plattform.DB +{ + public class Context : DbContext + { + public Context() : base("PlattformDB") { } + + public DbSet Cities { get; set; } + public DbSet Airlines { get; set; } + public DbSet Flights { get; set; } + public DbSet Hotels { get; set; } + public DbSet Rooms { get; set; } + public DbSet RoomTypes { get; set; } + public DbSet Availabilities { get; set; } + + protected override void OnModelCreating(DbModelBuilder modelBuilder) + { + modelBuilder.Entity() + .Property(c => c.Name) + .HasMaxLength(50) + .IsRequired(); + + modelBuilder.Entity() + .Property(c => c.ZipCode) + .IsRequired() + .IsUnique(); + + modelBuilder.Entity() + .Property(a => a.AirlineID) + .IsRequired() + .IsUnique(); + + modelBuilder.Entity() + .Property(a => a.Name) + .IsRequired(); + + modelBuilder.Entity() + .Property(f => f.Name) + .IsRequired(); + + modelBuilder.Entity() + .Property(f => f.Duration) + .IsRequired(); + + modelBuilder.Entity() + .Property(f => f.FromCityShortName) + .IsRequired(); + + modelBuilder.Entity() + .Property(f => f.StartTime) + .IsRequired(); + + modelBuilder.Entity() + .Property(f => f.ToCityShortName) + .IsRequired(); + } + } +} \ No newline at end of file diff --git a/Plattform/Plattform/DB/FlightDB.cs b/Plattform/Plattform/DB/FlightDB.cs new file mode 100644 index 0000000..35c9e26 --- /dev/null +++ b/Plattform/Plattform/DB/FlightDB.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; + +namespace Plattform.DB +{ + public class FlightDB + { + public ICollection GetAllFlights() + { + using (Context ctx = new Context()) + { + return ctx.Flights.ToList(); + } + } + public bool CreateFlight(Flight flight) + { + try + { + using (Context ctx = new Context()) + { + ctx.Flights.Add(flight); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateFlight(Flight city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Flights.Attach(city); + ctx.Entry(city).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteFlight(Flight flight) + { + try + { + using (Context ctx = new Context()) + { + ctx.Flights.Attach(flight); + ctx.Flights.Remove(flight); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/DB/HotelDB.cs b/Plattform/Plattform/DB/HotelDB.cs new file mode 100644 index 0000000..f95281f --- /dev/null +++ b/Plattform/Plattform/DB/HotelDB.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; +using Plattform.AirlineService; + +namespace Plattform.DB +{ + public class HotelDB + { + public ICollection GetAllHotels() + { + using (Context ctx = new Context()) + { + return ctx.Hotels.ToList(); + } + } + public bool CreateHotel(Hotel city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Hotels.Add(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateHotel(Hotel city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Hotels.Attach(city); + ctx.Entry(city).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteHotel(Hotel city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Hotels.Attach(city); + ctx.Hotels.Remove(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/DB/RoomDB.cs b/Plattform/Plattform/DB/RoomDB.cs new file mode 100644 index 0000000..306e5f9 --- /dev/null +++ b/Plattform/Plattform/DB/RoomDB.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; + +namespace Plattform.DB +{ + public class RoomDB + { + public ICollection GetAllRooms() + { + using (Context ctx = new Context()) + { + return ctx.Rooms.ToList(); + } + } + public bool CreateRoom(Room city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Rooms.Add(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateRoom(Room city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Rooms.Attach(city); + ctx.Entry(city).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteRoom(Room city) + { + try + { + using (Context ctx = new Context()) + { + ctx.Rooms.Attach(city); + ctx.Rooms.Remove(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/DB/RoomTypeDB.cs b/Plattform/Plattform/DB/RoomTypeDB.cs new file mode 100644 index 0000000..6c3d8ea --- /dev/null +++ b/Plattform/Plattform/DB/RoomTypeDB.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; +using System.Diagnostics; + +namespace Plattform.DB +{ + public class RoomTypeDB + { + public ICollection GetAllRoomTypes() + { + using (Context ctx = new Context()) + { + return ctx.RoomTypes.ToList(); + } + } + public bool CreateRoomType(RoomType city) + { + try + { + using (Context ctx = new Context()) + { + ctx.RoomTypes.Add(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + + public bool UpdateRoomType(RoomType city) + { + try + { + using (Context ctx = new Context()) + { + ctx.RoomTypes.Attach(city); + ctx.Entry(city).State = System.Data.Entity.EntityState.Modified; + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + + } + public bool DeleteRoomType(RoomType city) + { + try + { + using (Context ctx = new Context()) + { + ctx.RoomTypes.Attach(city); + ctx.RoomTypes.Remove(city); + ctx.SaveChanges(); + } + return true; + } + catch (Exception e) + { + System.Diagnostics.Trace.WriteLine(e); + return false; + } + } + } +} diff --git a/Plattform/Plattform/Global.asax b/Plattform/Plattform/Global.asax new file mode 100644 index 0000000..6534cda --- /dev/null +++ b/Plattform/Plattform/Global.asax @@ -0,0 +1 @@ +<%@ Application Codebehind="Global.asax.cs" Inherits="Plattform.Global" Language="C#" %> diff --git a/Plattform/Plattform/Global.asax.cs b/Plattform/Plattform/Global.asax.cs new file mode 100644 index 0000000..9781390 --- /dev/null +++ b/Plattform/Plattform/Global.asax.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.Security; +using System.Web.SessionState; + +namespace Plattform +{ + public class Global : System.Web.HttpApplication + { + protected void Application_Start(object sender, EventArgs e) + { + } + } +} \ No newline at end of file diff --git a/Plattform/Plattform/Helper/EntitiesContextInitializer.cs b/Plattform/Plattform/Helper/EntitiesContextInitializer.cs new file mode 100644 index 0000000..913b1de --- /dev/null +++ b/Plattform/Plattform/Helper/EntitiesContextInitializer.cs @@ -0,0 +1,24 @@ +using System.Data.Entity; +using Plattform.DB; + +namespace Plattform.Helper +{ + public class EntitiesContextInitializer : DropCreateDatabaseIfModelChanges + { + protected override void Seed(Context context) + { + //var cities = GenerateData.CreateCities(); + var types = GenerateData.CreateRoomTypes(); + + //foreach (var c in cities) + //{ + // context.Cities.Add(c); + //} + foreach (var t in types) + { + context.RoomTypes.Add(t); + } + context.SaveChanges(); + } + } +} \ No newline at end of file diff --git a/Plattform/Plattform/Helper/GenerateData.cs b/Plattform/Plattform/Helper/GenerateData.cs new file mode 100644 index 0000000..86fa81d --- /dev/null +++ b/Plattform/Plattform/Helper/GenerateData.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Plattform.Models; + +namespace Plattform.Helper +{ + public static class GenerateData + { + private static List Cities = new List(); + private static List RoomTypes = new List(); + private static List ListRoomTypes = new List(new string[] + { + "Single Bed", "Double Bed", "Suite" + }); + private static List ListCities = new List(new string[] + { + "Bern" + }); + public static List CreateRoomTypes() + { + foreach (var item in ListRoomTypes) + { + RoomTypes.Add(new RoomType(item)); + } + return RoomTypes; + } + public static List CreateCities() + { + foreach (var item in ListCities) + { + Cities.Add(new City(item, 3300, "xtz")); + } + return Cities; + } + } +} \ No newline at end of file diff --git a/Plattform/Plattform/Helper/MappingExtensions.cs b/Plattform/Plattform/Helper/MappingExtensions.cs new file mode 100644 index 0000000..59b4b04 --- /dev/null +++ b/Plattform/Plattform/Helper/MappingExtensions.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.Data.Entity.Infrastructure.Annotations; +using System.Data.Entity.ModelConfiguration.Configuration; + +namespace Plattform.Helper +{ + public static class MappingExtensions + { + public static PrimitivePropertyConfiguration IsUnique(this PrimitivePropertyConfiguration configuration) + { + return configuration.HasColumnAnnotation("Index", new IndexAnnotation(new IndexAttribute { IsUnique = true })); + } + } +} \ No newline at end of file diff --git a/Plattform/Plattform/IPlattformService.cs b/Plattform/Plattform/IPlattformService.cs new file mode 100644 index 0000000..b7856d5 --- /dev/null +++ b/Plattform/Plattform/IPlattformService.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.Text; + +namespace Plattform +{ + // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IPlattformService" in both code and config file together. + [ServiceContract] + public interface IPlattformService + { + [OperationContract] + void DoWork(); + } +} diff --git a/Plattform/Plattform/Models/Airline.cs b/Plattform/Plattform/Models/Airline.cs new file mode 100644 index 0000000..21b481f --- /dev/null +++ b/Plattform/Plattform/Models/Airline.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Runtime.Serialization; +using Plattform; + +namespace Plattform.Models +{ + [DataContract] + public class Airline + { + [DataMember] + public int AirlineID { get; set; } + [DataMember] + public string Name { get; set; } + public Airline(AirlineService.Airline airline) + { + this.Name = airline.Name; + } + } +} diff --git a/Plattform/Plattform/Models/Availability.cs b/Plattform/Plattform/Models/Availability.cs new file mode 100644 index 0000000..cec46a4 --- /dev/null +++ b/Plattform/Plattform/Models/Availability.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class Availability + { + [DataMember] + public int AvailabilityID { get; set; } + [DataMember] + public DateTime From { get; set; } + [DataMember] + public DateTime To { get; set; } + [DataMember] + bool Reserved { get; set; } + [DataMember] + bool Booked { get; set; } + public ICollection Rooms { get; set; } + } +} diff --git a/Plattform/Plattform/Models/City.cs b/Plattform/Plattform/Models/City.cs new file mode 100644 index 0000000..ededc14 --- /dev/null +++ b/Plattform/Plattform/Models/City.cs @@ -0,0 +1,24 @@ +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class City + { + [DataMember] + public int CityID { get; set; } + [DataMember] + public string Name { get; set; } + [DataMember] + public int ZipCode { get; set; } + [DataMember] + public string ShortName { get; set; } + public City() { } + public City(string name, int zipCode, string shortName) + { + this.Name = name; + this.ZipCode = zipCode; + this.ShortName = shortName; + } + } +} diff --git a/Plattform/Plattform/Models/Customer.cs b/Plattform/Plattform/Models/Customer.cs new file mode 100644 index 0000000..aebc1c2 --- /dev/null +++ b/Plattform/Plattform/Models/Customer.cs @@ -0,0 +1,24 @@ +using System.Runtime.Serialization; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Plattform.Models +{ + [Table("Customers")] + [DataContract] + public class Customer : Person + { + public Customer() { } + public Customer(string firstName, string lastName, Gender gender, + Salutation salutation, string streetName, string + streetNumber, City city) + { + this.FirstName = firstName; + this.LastName = lastName; + this.Gender = gender; + this.Salutation = salutation; + this.StreetName = streetName; + this.StreetNumber = streetNumber; + this.City = city; + } + } +} diff --git a/Plattform/Plattform/Models/Flight.cs b/Plattform/Plattform/Models/Flight.cs new file mode 100644 index 0000000..ec7876d --- /dev/null +++ b/Plattform/Plattform/Models/Flight.cs @@ -0,0 +1,34 @@ +using System; +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class Flight + { + [DataMember] + public int FlightID { get; set; } + [DataMember] + public Airline Airline { get; set; } + [DataMember] + public string Name { get; set; } + [DataMember] + public DateTime StartTime { get; set; } + [DataMember] + public float Duration { get; set; } + [DataMember] + public string FromCityShortName { get; set; } + [DataMember] + public string ToCityShortName { get; set; } + + public Flight (AirlineService.Flight flight) + { + this.Airline = new Airline(flight.Airline); + this.Name = flight.Name; + this.StartTime = flight.StartTime; + this.Duration = flight.Duration; + this.FromCityShortName = flight.FromCityShortName; + this.ToCityShortName = flight.ToCityShortName; + } + } +} diff --git a/Plattform/Plattform/Models/Gender.cs b/Plattform/Plattform/Models/Gender.cs new file mode 100644 index 0000000..7e88b11 --- /dev/null +++ b/Plattform/Plattform/Models/Gender.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class Gender + { + [DataMember] + public int GenderID { get; set; } + [DataMember] + public string Name { get; set; } + public Gender(string name) + { + this.Name = name; + } + } +} diff --git a/Plattform/Plattform/Models/Hotel.cs b/Plattform/Plattform/Models/Hotel.cs new file mode 100644 index 0000000..8fa77a2 --- /dev/null +++ b/Plattform/Plattform/Models/Hotel.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class Hotel + { + [DataMember] + public int HotelID { get; set; } + [DataMember] + public int Name { get; set; } + [DataMember] + public City City { get; set; } + } +} diff --git a/Plattform/Plattform/Models/Person.cs b/Plattform/Plattform/Models/Person.cs new file mode 100644 index 0000000..a82c20e --- /dev/null +++ b/Plattform/Plattform/Models/Person.cs @@ -0,0 +1,41 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + [KnownType(typeof(Customer))] + public class Person + { + [DataMember] + public int PersonID { get; set; } + [DataMember] + public string FirstName { get; set; } + [DataMember] + public string LastName { get; set; } + [DataMember] + public virtual Gender Gender { get; set; } + [DataMember] + public virtual Salutation Salutation { get; set; } + [DataMember] + public string StreetName { get; set; } + [DataMember] + public string StreetNumber { get; set; } + [DataMember] + public virtual City City { get; set; } + + public Person() { } + public Person (string firstName, string lastName, Gender gender, + Salutation salutation, string streetName, string + streetNumber, City city) + { + this.FirstName = firstName; + this.LastName = lastName; + this.Gender = gender; + this.Salutation = salutation; + this.StreetName = streetName; + this.StreetNumber = streetNumber; + this.City = city; + } + } +} diff --git a/Plattform/Plattform/Models/Room.cs b/Plattform/Plattform/Models/Room.cs new file mode 100644 index 0000000..f91910f --- /dev/null +++ b/Plattform/Plattform/Models/Room.cs @@ -0,0 +1,18 @@ +using System.Collections.Generic; +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class Room + { + [DataMember] + public int RoomID { get; set; } + [DataMember] + public RoomType RoomType { get; set; } + [DataMember] + public Hotel Hotel { get; set; } + [DataMember] + public ICollection Availability { get; set; } + } +} diff --git a/Plattform/Plattform/Models/RoomAvailability.cs b/Plattform/Plattform/Models/RoomAvailability.cs new file mode 100644 index 0000000..412350c --- /dev/null +++ b/Plattform/Plattform/Models/RoomAvailability.cs @@ -0,0 +1,15 @@ +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class RoomAvailability + { + [DataMember] + public Room Room; + [DataMember] + public Availability Availability; + [DataMember] + public Customer Customer; + } +} diff --git a/Plattform/Plattform/Models/RoomType.cs b/Plattform/Plattform/Models/RoomType.cs new file mode 100644 index 0000000..733b683 --- /dev/null +++ b/Plattform/Plattform/Models/RoomType.cs @@ -0,0 +1,18 @@ +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class RoomType + { + [DataMember] + public int RoomTypeID { get; set; } + [DataMember] + public string Name { get; set; } + public RoomType() { } + public RoomType(string name) + { + this.Name = name; + } + } +} diff --git a/Plattform/Plattform/Models/Saluation.cs b/Plattform/Plattform/Models/Saluation.cs new file mode 100644 index 0000000..0d781dd --- /dev/null +++ b/Plattform/Plattform/Models/Saluation.cs @@ -0,0 +1,17 @@ +using System.Runtime.Serialization; + +namespace Plattform.Models +{ + [DataContract] + public class Salutation + { + [DataMember] + public int SalutationID { get; set; } + public string Name { get; set; } + + public Salutation(string name) + { + this.Name = name; + } + } +} diff --git a/Plattform/Plattform/Plattform.csproj b/Plattform/Plattform/Plattform.csproj new file mode 100644 index 0000000..d149628 --- /dev/null +++ b/Plattform/Plattform/Plattform.csproj @@ -0,0 +1,204 @@ + + + + + + Debug + AnyCPU + + + 2.0 + {CD441758-DC02-42F1-92BF-9A335B85B4A4} + {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + Plattform + Plattform + v4.6.1 + true + + + + + + + + + True + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + + + true + pdbonly + true + bin\ + TRACE + prompt + 4 + + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll + + + ..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll + + + ..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.2.0.0\lib\net45\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll + + + + + + ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll + + + + + + + + + + + + + + + + + + + + + + Designer + + + Designer + + + Designer + + + Reference.svcmap + + + + Web.config + + + Web.config + + + + + + + + WCF Proxy Generator + Reference.cs + + + + + + + + + True + True + Reference.svcmap + + + + + + + + + + + Global.asax + + + + + + home.aspx + ASPXCodeBehind + + + home.aspx + + + + + + + + + + + + PlattformService.svc + + + + + + + + + + + + + + 10.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + + + + + + True + True + 49742 + / + http://localhost:8000/ + False + False + + + False + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/PlattformService.svc b/Plattform/Plattform/PlattformService.svc new file mode 100644 index 0000000..59e4dd3 --- /dev/null +++ b/Plattform/Plattform/PlattformService.svc @@ -0,0 +1 @@ +<%@ ServiceHost Language="C#" Debug="true" Service="NormfallStudie.PlattformService" CodeBehind="PlattformService.svc.cs" %> diff --git a/Plattform/Plattform/PlattformService.svc.cs b/Plattform/Plattform/PlattformService.svc.cs new file mode 100644 index 0000000..1cfafa8 --- /dev/null +++ b/Plattform/Plattform/PlattformService.svc.cs @@ -0,0 +1,18 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.ServiceModel; +using System.Text; + +namespace Plattform +{ + // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "PlattformService" in code, svc and config file together. + // NOTE: In order to launch WCF Test Client for testing this service, please select PlattformService.svc or PlattformService.svc.cs at the Solution Explorer and start debugging. + public class PlattformService : IPlattformService + { + public void DoWork() + { + } + } +} diff --git a/Plattform/Plattform/Properties/AssemblyInfo.cs b/Plattform/Plattform/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..d93c7b9 --- /dev/null +++ b/Plattform/Plattform/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Plattform")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Plattform")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("cd441758-dc02-42f1-92bf-9a335b85b4a4")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Plattform/Plattform/Web.Debug.config b/Plattform/Plattform/Web.Debug.config new file mode 100644 index 0000000..fae9cfe --- /dev/null +++ b/Plattform/Plattform/Web.Debug.config @@ -0,0 +1,30 @@ + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Web.Release.config b/Plattform/Plattform/Web.Release.config new file mode 100644 index 0000000..da6e960 --- /dev/null +++ b/Plattform/Plattform/Web.Release.config @@ -0,0 +1,31 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/Web.config b/Plattform/Plattform/Web.config new file mode 100644 index 0000000..05b2624 --- /dev/null +++ b/Plattform/Plattform/Web.config @@ -0,0 +1,54 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattform/home.aspx b/Plattform/Plattform/home.aspx new file mode 100644 index 0000000..fa2913a --- /dev/null +++ b/Plattform/Plattform/home.aspx @@ -0,0 +1,34 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="home.aspx.cs" Inherits="Plattform.home" %> + + + + + + + + +
+
+
+ +
+
+ RoomType
+ + +
+
+ Hotel
+ +
+
+ Availability
+ From +
+ To +
+ +
+ + + diff --git a/Plattform/Plattform/home.aspx.cs b/Plattform/Plattform/home.aspx.cs new file mode 100644 index 0000000..99225dc --- /dev/null +++ b/Plattform/Plattform/home.aspx.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; +using Plattform.Models; +using Plattform.DB; +using Plattform; + +namespace Plattform +{ + public partial class home : System.Web.UI.Page + { + public Plattform.AirlineService.AirlineServiceClient service = new Plattform.AirlineService.AirlineServiceClient(); + + protected void Page_Load(object sender, EventArgs e) + { + RoomTypeDB typeDB = new RoomTypeDB(); + var types = typeDB.GetAllRoomTypes(); + DropDownRoomType.Items.Add(types.ToString()); + } + + protected void ButtonGetFlights_Click(object sender, EventArgs e) + { + FlightDB dataccess = new FlightDB(); + var flights = this.service.GetFreeFlights(); + foreach (var item in flights) + { + dataccess.CreateFlight(new Flight(item)); + } + } + + protected void ButtonAddRoom_Click(object sender, EventArgs e) + { + + } + } +} \ No newline at end of file diff --git a/Plattform/Plattform/home.aspx.designer.cs b/Plattform/Plattform/home.aspx.designer.cs new file mode 100644 index 0000000..40f836a --- /dev/null +++ b/Plattform/Plattform/home.aspx.designer.cs @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Plattform { + + + public partial class home { + + /// + /// form1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlForm form1; + + /// + /// ButtonGetFlights control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button ButtonGetFlights; + + /// + /// DropDownRoomType control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.DropDownList DropDownRoomType; + + /// + /// TextBoxHotel control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.TextBox TextBoxHotel; + + /// + /// CalendarFrom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Calendar CalendarFrom; + + /// + /// CalendarTo control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Calendar CalendarTo; + + /// + /// ButtonAddRoom control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button ButtonAddRoom; + } +} diff --git a/Plattform/Plattform/packages.config b/Plattform/Plattform/packages.config new file mode 100644 index 0000000..6535d00 --- /dev/null +++ b/Plattform/Plattform/packages.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/Plattform/Plattfrom.sln b/Plattform/Plattfrom.sln new file mode 100644 index 0000000..c44f75d --- /dev/null +++ b/Plattform/Plattfrom.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Plattform", "Plattform\Plattform.csproj", "{CD441758-DC02-42F1-92BF-9A335B85B4A4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CD441758-DC02-42F1-92BF-9A335B85B4A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CD441758-DC02-42F1-92BF-9A335B85B4A4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CD441758-DC02-42F1-92BF-9A335B85B4A4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CD441758-DC02-42F1-92BF-9A335B85B4A4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {579E495D-7171-4236-91AF-9F2FA4F8E508} + EndGlobalSection +EndGlobal diff --git a/WPFClient/WPFClient/App.config b/WPFClient/WPFClient/App.config new file mode 100644 index 0000000..731f6de --- /dev/null +++ b/WPFClient/WPFClient/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/WPFClient/WPFClient/App.xaml b/WPFClient/WPFClient/App.xaml new file mode 100644 index 0000000..f63d388 --- /dev/null +++ b/WPFClient/WPFClient/App.xaml @@ -0,0 +1,9 @@ + + + + + diff --git a/WPFClient/WPFClient/App.xaml.cs b/WPFClient/WPFClient/App.xaml.cs new file mode 100644 index 0000000..4122d91 --- /dev/null +++ b/WPFClient/WPFClient/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace WPFClient +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App : Application + { + } +} diff --git a/WPFClient/WPFClient/MainWindow.xaml b/WPFClient/WPFClient/MainWindow.xaml new file mode 100644 index 0000000..ba4d4ef --- /dev/null +++ b/WPFClient/WPFClient/MainWindow.xaml @@ -0,0 +1,12 @@ + + + + + diff --git a/WPFClient/WPFClient/MainWindow.xaml.cs b/WPFClient/WPFClient/MainWindow.xaml.cs new file mode 100644 index 0000000..9570038 --- /dev/null +++ b/WPFClient/WPFClient/MainWindow.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace WPFClient +{ + /// + /// Interaction logic for MainWindow.xaml + /// + public partial class MainWindow : Window + { + public MainWindow() + { + InitializeComponent(); + } + } +} diff --git a/WPFClient/WPFClient/Properties/AssemblyInfo.cs b/WPFClient/WPFClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..6901d9b --- /dev/null +++ b/WPFClient/WPFClient/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("WPFClient")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("WPFClient")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/WPFClient/WPFClient/Properties/Resources.Designer.cs b/WPFClient/WPFClient/Properties/Resources.Designer.cs new file mode 100644 index 0000000..335f0fa --- /dev/null +++ b/WPFClient/WPFClient/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WPFClient.Properties +{ + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources + { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() + { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager + { + get + { + if ((resourceMan == null)) + { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WPFClient.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture + { + get + { + return resourceCulture; + } + set + { + resourceCulture = value; + } + } + } +} diff --git a/WPFClient/WPFClient/Properties/Resources.resx b/WPFClient/WPFClient/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/WPFClient/WPFClient/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/WPFClient/WPFClient/Properties/Settings.Designer.cs b/WPFClient/WPFClient/Properties/Settings.Designer.cs new file mode 100644 index 0000000..cfff569 --- /dev/null +++ b/WPFClient/WPFClient/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace WPFClient.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/WPFClient/WPFClient/Properties/Settings.settings b/WPFClient/WPFClient/Properties/Settings.settings new file mode 100644 index 0000000..033d7a5 --- /dev/null +++ b/WPFClient/WPFClient/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/WPFClient/WPFClient/WPFClient.csproj b/WPFClient/WPFClient/WPFClient.csproj new file mode 100644 index 0000000..dcd87e2 --- /dev/null +++ b/WPFClient/WPFClient/WPFClient.csproj @@ -0,0 +1,97 @@ + + + + + Debug + AnyCPU + {D1BD059D-BFA9-4087-A8FB-08F2422D66DD} + WinExe + WPFClient + WPFClient + v4.6.1 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + MainWindow.xaml + Code + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + \ No newline at end of file