extend the sep a bit

This commit is contained in:
Andreas Zweili 2018-02-24 15:46:45 +01:00
parent 1a53453876
commit 57f92f8dcf
7 changed files with 72 additions and 15 deletions

View File

@ -42,6 +42,8 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="City.cs" />
<Compile Include="Company.cs" />
<Compile Include="Customer.cs" />
<Compile Include="Hotel.cs" />
<Compile Include="Order.cs" />

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _2018_02_24_sep
{
class City
{
public string name { get; }
public int zip_code { get; }
public City(string name, int zip_code)
{
this.name = name;
this.zip_code = zip_code;
}
}
}

View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace _2018_02_24_sep
{
class Company
{
public string name { get; }
public string streetname { get; set; }
public City city { get; set; }
public Company(string name, string streetname, City city)
{
this.name = name;
this.streetname = streetname;
this.city = city;
}
}
}

View File

@ -8,11 +8,21 @@ namespace _2018_02_24_sep
{
class Customer
{
public string company { get; set; }
public Company company { get; set; }
public string name { get; set; }
public string first_name { get; set; }
public string street { get; set; }
public string city { get; set; }
public string streetname { get; set; }
public City city { get; set; }
public Customer(string name,
string first_name,
string streetname,
City city)
{
this.name = name;
this.first_name = first_name;
this.streetname = streetname;
this.city = city;
}
}
}

View File

@ -11,9 +11,10 @@ namespace _2018_02_24_sep
public string name { get; set; }
public List<Room> rooms { get; set; }
public Hotel()
public Hotel(string name)
{
this.rooms = new List<Room>();
this.name = name;
}
}
}

View File

@ -14,10 +14,12 @@ namespace _2018_02_24_sep
public int order_id { get; set; }
public DateTime date { get; }
public Order()
public Order(Hotel hotel, Customer customer)
{
this.rooms = new List<Room>();
this.date = DateTime.Now;
this.hotel = hotel;
this.customer = customer;
}
public decimal price(Boolean mwst)

View File

@ -14,22 +14,22 @@ namespace _2018_02_24_sep
Room double_room= new Room(2, 150, "Doppelzimmer");
Room teaching_room = new Room(15, 500, "Schulungsraum");
Room conference_room = new Room(50, 1500, "Konferenzraum");
Customer customer = new Customer();
Hotel hotel = new Hotel();
Order order = new Order();
customer.name = "Max";
customer.first_name = "Muster";
customer.company = "Test AG";
Hotel hotel = new Hotel("Alpenglühn");
City company_city = new City("Musterstadt", 3600);
City customer_city = new City("CustomerCity", 3700);
Company company = new Company("Test AG", "Firmenstrasse 12", company_city);
Customer customer = new Customer("Muster", "Max", "Musterstrasse", customer_city);
customer.company = company;
Order order = new Order(hotel, customer);
hotel.name = "Alpenglühn";
hotel.rooms.Add(single_room);
hotel.rooms.Add(double_room);
hotel.rooms.Add(teaching_room);
hotel.rooms.Add(conference_room);
order.customer = customer;
order.hotel = hotel;
order.order_id = 1500;
order.rooms.Add(single_room);
order.rooms.Add(single_room);
@ -37,7 +37,7 @@ namespace _2018_02_24_sep
order.rooms.Add(teaching_room);
Console.WriteLine("Kunde: " + order.customer.company);
Console.WriteLine("Kunde: " + order.customer.company.name);
Console.WriteLine("Hotel: " + order.hotel.name);
Console.WriteLine("Bestellung Nr. " + order.order_id + " vom " + order.date);
foreach (Room room in order.rooms)