WIP
This commit is contained in:
parent
8108dc824c
commit
353baf8e01
|
@ -12,11 +12,11 @@ namespace AirlineServer
|
|||
// 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<Flight> GetFreeFlights()
|
||||
public ICollection<Flight> GetFreeFlights()
|
||||
{
|
||||
List<Flight> free_flights = new List<Flight>();
|
||||
Airline lufthansa = new Airline { name = "Lufthansa" };
|
||||
Airline easyjet = new Airline { name = "Easyjet" };
|
||||
Airline lufthansa = new Airline { Name = "Lufthansa" };
|
||||
Airline easyjet = new Airline { Name = "Easyjet" };
|
||||
DateTime lufthansa_startdate = new DateTime(2018, 06, 15, 12, 00, 00, 00);
|
||||
DateTime easyjet_startdate = new DateTime(2018, 06, 11, 16, 00, 00, 00);
|
||||
|
||||
|
|
|
@ -13,6 +13,6 @@ namespace AirlineServer
|
|||
public interface IAirlineService
|
||||
{
|
||||
[OperationContract]
|
||||
List<Flight> GetFreeFlights();
|
||||
ICollection<Flight> GetFreeFlights();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,8 @@ namespace AirlineServer.Models
|
|||
public class Airline
|
||||
{
|
||||
[DataMember]
|
||||
public int ID { get; set; }
|
||||
public int AirlineID { get; set; }
|
||||
[DataMember]
|
||||
public string name { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
|
@ -10,7 +10,7 @@ namespace AirlineServer.Models
|
|||
public class Flight
|
||||
{
|
||||
[DataMember]
|
||||
public int ID { get; set; }
|
||||
public int FlightID { get; set; }
|
||||
[DataMember]
|
||||
public Airline Airline { get; set; }
|
||||
[DataMember]
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="Airline" nillable="true" type="tns:Airline" />
|
||||
<xs:element minOccurs="0" name="Duration" type="xs:float" />
|
||||
<xs:element minOccurs="0" name="FlightID" type="xs:int" />
|
||||
<xs:element minOccurs="0" name="FromCityShortName" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="ID" type="xs:int" />
|
||||
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="StartTime" type="xs:dateTime" />
|
||||
<xs:element minOccurs="0" name="ToCityShortName" nillable="true" type="xs:string" />
|
||||
|
@ -20,8 +20,8 @@
|
|||
<xs:element name="Flight" nillable="true" type="tns:Flight" />
|
||||
<xs:complexType name="Airline">
|
||||
<xs:sequence>
|
||||
<xs:element minOccurs="0" name="ID" type="xs:int" />
|
||||
<xs:element minOccurs="0" name="name" nillable="true" type="xs:string" />
|
||||
<xs:element minOccurs="0" name="AirlineID" type="xs:int" />
|
||||
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string" />
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="Airline" nillable="true" type="tns:Airline" />
|
||||
|
|
|
@ -29,10 +29,10 @@ namespace Plattform.AirlineService {
|
|||
private float DurationField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private string FromCityShortNameField;
|
||||
private int FlightIDField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private int IDField;
|
||||
private string FromCityShortNameField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private string NameField;
|
||||
|
@ -79,6 +79,19 @@ namespace Plattform.AirlineService {
|
|||
}
|
||||
}
|
||||
|
||||
[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 {
|
||||
|
@ -92,19 +105,6 @@ namespace Plattform.AirlineService {
|
|||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public int ID {
|
||||
get {
|
||||
return this.IDField;
|
||||
}
|
||||
set {
|
||||
if ((this.IDField.Equals(value) != true)) {
|
||||
this.IDField = value;
|
||||
this.RaisePropertyChanged("ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public string Name {
|
||||
get {
|
||||
|
@ -164,10 +164,10 @@ namespace Plattform.AirlineService {
|
|||
private System.Runtime.Serialization.ExtensionDataObject extensionDataField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private int IDField;
|
||||
private int AirlineIDField;
|
||||
|
||||
[System.Runtime.Serialization.OptionalFieldAttribute()]
|
||||
private string nameField;
|
||||
private string NameField;
|
||||
|
||||
[global::System.ComponentModel.BrowsableAttribute(false)]
|
||||
public System.Runtime.Serialization.ExtensionDataObject ExtensionData {
|
||||
|
@ -180,27 +180,27 @@ namespace Plattform.AirlineService {
|
|||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public int ID {
|
||||
public int AirlineID {
|
||||
get {
|
||||
return this.IDField;
|
||||
return this.AirlineIDField;
|
||||
}
|
||||
set {
|
||||
if ((this.IDField.Equals(value) != true)) {
|
||||
this.IDField = value;
|
||||
this.RaisePropertyChanged("ID");
|
||||
if ((this.AirlineIDField.Equals(value) != true)) {
|
||||
this.AirlineIDField = value;
|
||||
this.RaisePropertyChanged("AirlineID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[System.Runtime.Serialization.DataMemberAttribute()]
|
||||
public string name {
|
||||
public string Name {
|
||||
get {
|
||||
return this.nameField;
|
||||
return this.NameField;
|
||||
}
|
||||
set {
|
||||
if ((object.ReferenceEquals(this.nameField, value) != true)) {
|
||||
this.nameField = value;
|
||||
this.RaisePropertyChanged("name");
|
||||
if ((object.ReferenceEquals(this.NameField, value) != true)) {
|
||||
this.NameField = value;
|
||||
this.RaisePropertyChanged("Name");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,11 +29,34 @@ namespace Plattform.DB
|
|||
.IsRequired()
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<Room>()
|
||||
.HasMany<RoomAvailability>(r => r.RoomAvailability)
|
||||
.WithRequired()
|
||||
.HasForeignKey(r => r.FoodPlaceID);
|
||||
modelBuilder.Entity<Airline>()
|
||||
.Property(a => a.AirlineID)
|
||||
.IsRequired()
|
||||
.IsUnique();
|
||||
|
||||
modelBuilder.Entity<Airline>()
|
||||
.Property(a => a.Name)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<Flight>()
|
||||
.Property(f => f.Name)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<Flight>()
|
||||
.Property(f => f.Duration)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<Flight>()
|
||||
.Property(f => f.FromCityShortName)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<Flight>()
|
||||
.Property(f => f.StartTime)
|
||||
.IsRequired();
|
||||
|
||||
modelBuilder.Entity<Flight>()
|
||||
.Property(f => f.ToCityShortName)
|
||||
.IsRequired();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -15,13 +15,13 @@ namespace Plattform.DB
|
|||
return ctx.Flights.ToList();
|
||||
}
|
||||
}
|
||||
public bool CreateFlight(Flight city)
|
||||
public bool CreateFlight(Flight flight)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
ctx.Flights.Add(city);
|
||||
ctx.Flights.Add(flight);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
|
@ -52,14 +52,14 @@ namespace Plattform.DB
|
|||
}
|
||||
|
||||
}
|
||||
public bool DeleteFlight(Flight city)
|
||||
public bool DeleteFlight(Flight flight)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (Context ctx = new Context())
|
||||
{
|
||||
ctx.Flights.Attach(city);
|
||||
ctx.Flights.Remove(city);
|
||||
ctx.Flights.Attach(flight);
|
||||
ctx.Flights.Remove(flight);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -57,6 +57,9 @@
|
|||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
|
|
|
@ -16,13 +16,14 @@
|
|||
</system.web>
|
||||
<system.serviceModel>
|
||||
<bindings>
|
||||
<basicHttpBinding>
|
||||
<binding name="BasicHttpBinding_IAirlineService"/>
|
||||
</basicHttpBinding>
|
||||
<basicHttpBinding>
|
||||
<binding name="BasicHttpBinding_IAirlineService" />
|
||||
</basicHttpBinding>
|
||||
</bindings>
|
||||
<client>
|
||||
<endpoint address="http://localhost:49949/AirlineService.svc" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAirlineService"
|
||||
contract="AirlineService.IAirlineService" name="BasicHttpBinding_IAirlineService"/>
|
||||
<endpoint address="http://localhost:49949/AirlineService.svc"
|
||||
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IAirlineService"
|
||||
contract="AirlineService.IAirlineService" name="BasicHttpBinding_IAirlineService" />
|
||||
</client>
|
||||
<behaviors>
|
||||
<serviceBehaviors>
|
||||
|
|
|
@ -10,6 +10,25 @@
|
|||
<form id="form1" runat="server">
|
||||
<div>
|
||||
</div>
|
||||
<asp:Button ID="ButtonGetFlights" runat="server" OnClick="ButtonGetFlights_Click" style="height: 26px" Text="Get Flights" />
|
||||
<br />
|
||||
<br />
|
||||
RoomType<br />
|
||||
<asp:DropDownList ID="DropDownRoomType" runat="server">
|
||||
</asp:DropDownList>
|
||||
<br />
|
||||
<br />
|
||||
Hotel<br />
|
||||
<asp:TextBox ID="TextBoxHotel" runat="server"></asp:TextBox>
|
||||
<br />
|
||||
<br />
|
||||
Availability<br />
|
||||
From<asp:Calendar ID="CalendarFrom" runat="server"></asp:Calendar>
|
||||
<br />
|
||||
To<asp:Calendar ID="CalendarTo" runat="server"></asp:Calendar>
|
||||
<br />
|
||||
<asp:Button ID="ButtonAddRoom" runat="server" OnClick="ButtonAddRoom_Click" Text="Add Room" />
|
||||
<br />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -4,12 +4,34 @@ using System.Linq;
|
|||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
using Plattform.Models;
|
||||
using Plattform.DB;
|
||||
using Plattform.AirlineService;
|
||||
|
||||
namespace Plattform
|
||||
{
|
||||
public partial class home : System.Web.UI.Page
|
||||
{
|
||||
public AirlineServiceClient service = new 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(item);
|
||||
}
|
||||
}
|
||||
|
||||
protected void ButtonAddRoom_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
|
@ -7,12 +7,10 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace Plattform
|
||||
{
|
||||
namespace Plattform {
|
||||
|
||||
|
||||
public partial class home
|
||||
{
|
||||
public partial class home {
|
||||
|
||||
/// <summary>
|
||||
/// form1 control.
|
||||
|
@ -22,5 +20,59 @@ namespace Plattform
|
|||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.HtmlControls.HtmlForm form1;
|
||||
|
||||
/// <summary>
|
||||
/// ButtonGetFlights control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button ButtonGetFlights;
|
||||
|
||||
/// <summary>
|
||||
/// DropDownRoomType control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.DropDownList DropDownRoomType;
|
||||
|
||||
/// <summary>
|
||||
/// TextBoxHotel control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.TextBox TextBoxHotel;
|
||||
|
||||
/// <summary>
|
||||
/// CalendarFrom control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Calendar CalendarFrom;
|
||||
|
||||
/// <summary>
|
||||
/// CalendarTo control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Calendar CalendarTo;
|
||||
|
||||
/// <summary>
|
||||
/// ButtonAddRoom control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Button ButtonAddRoom;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,4 +3,5 @@
|
|||
<package id="EntityFramework" version="6.2.0" targetFramework="net461" />
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="2.0.0" targetFramework="net461" />
|
||||
<package id="Microsoft.Net.Compilers" version="2.8.2" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net461" />
|
||||
</packages>
|
Reference in New Issue