WIP case study
This commit is contained in:
parent
2bfff5aee1
commit
10bdaf9a52
|
@ -32,6 +32,9 @@
|
|||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Db4objects.Db4o">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\db4o\db4o-8.0\bin\net-4.0\Db4objects.Db4o.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
|
@ -42,8 +45,10 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="HouseOwner.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Request.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _2018_03_02_hausbesitzer
|
||||
{
|
||||
class HouseOwner
|
||||
{
|
||||
public string name { get; set; }
|
||||
public string address { get; set; }
|
||||
public List<Request> requests { get; set; }
|
||||
|
||||
public HouseOwner(string _name, string _address)
|
||||
{
|
||||
this.name = _name;
|
||||
this.address = _address;
|
||||
this.requests = new List<Request>();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,13 +3,22 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Db4objects.Db4o;
|
||||
|
||||
namespace _2018_03_02_hausbesitzer
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static string tempPath = System.IO.Path.GetTempPath();
|
||||
readonly static string DbPath = System.IO.Path.Combine(
|
||||
tempPath,
|
||||
"hausbesitzer.db");
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
HouseOwner owner = new HouseOwner("Max Muster", "Unterstrasse 14");
|
||||
Request request = new Request(1);
|
||||
request.Check();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _2018_03_02_hausbesitzer
|
||||
{
|
||||
class Request
|
||||
{
|
||||
private int id { get; set; }
|
||||
private Status status { get; set; }
|
||||
private enum Status {
|
||||
undefined,
|
||||
first_data_delivered,
|
||||
first_data_checked,
|
||||
detail_data_delivered,
|
||||
subsidies_delivered,
|
||||
final_data_delivered
|
||||
}
|
||||
|
||||
public Request(int _id)
|
||||
{
|
||||
this.id = _id;
|
||||
this.status = Status.undefined;
|
||||
}
|
||||
|
||||
public void Check()
|
||||
{
|
||||
|
||||
switch (this.status)
|
||||
{
|
||||
case Status.undefined:
|
||||
Console.WriteLine("Status " + this.status + " wurde gesetzt.");
|
||||
this.status = Status.first_data_delivered;
|
||||
break;
|
||||
|
||||
case Status.first_data_delivered:
|
||||
this.status = Status.first_data_checked;
|
||||
Console.WriteLine("Status " + this.status + " wurde gesetzt.");
|
||||
break;
|
||||
|
||||
case Status.first_data_checked:
|
||||
this.status = Status.detail_data_delivered;
|
||||
Console.WriteLine("Status " + this.status + " wurde gesetzt.");
|
||||
break;
|
||||
|
||||
case Status.detail_data_delivered:
|
||||
this.status = Status.final_data_delivered;
|
||||
Console.WriteLine("Status " + this.status + " wurde gesetzt.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void AllocateSubsidies() {
|
||||
if (this.status == Status.final_data_delivered)
|
||||
{
|
||||
this.status = Status.subsidies_delivered;
|
||||
Console.WriteLine("Subvention von 300 CHF wird augezahlt.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue