Commit f08581b0 authored by NEBOIT Jean-Charles's avatar NEBOIT Jean-Charles
Browse files

Update

parent 71ab12f7
using EntitiesLayer;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StubDataAccessLayer
{
public class Features
{
private int _pv;
private CharacterType _type;
private int _bravoury;
private int _crazyness;
public int Pv
{
get
{
return _pv;
}
set
{
_pv = value;
}
}
public Features(int pv, CharacterType type, int bravoury, int crazyness)
{
Pv = pv;
Type = type;
Bravoury = bravoury;
Crazyness = crazyness;
}
public CharacterType Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
public int Bravoury
{
get
{
return _bravoury;
}
set
{
_bravoury = value;
}
}
public int Crazyness
{
get
{
return _crazyness;
}
set
{
_crazyness = value;
}
}
}
public class DalManager
{
private static DalManager _instance;
private static readonly object padlock = new object();
private DataBaseBridge dataBaseBridge;
private DalManager()
{
dataBaseBridge = new SqlServer();
}
public static DalManager Instance
{
get
{
if (_instance == null)
{
lock (padlock)
{
if (_instance == null)
{
_instance = new DalManager();
}
}
}
return _instance;
}
}
public List<Character> GetAllCharacters()
{
return null;
}
public List<House> HousesMoreThan200()
{
List<House> houses = null;
return houses;
}
public List<Features> CharactersFeatures()
{
List<Features> features = null;
return features;
}
}
}
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Les informations générales relatives à un assembly dépendent de
// l'ensemble d'attributs suivant. Changez les valeurs de ces attributs pour modifier les informations
// associées à un assembly.
[assembly: AssemblyTitle("StubDataAccessLayer")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("StubDataAccessLayer")]
[assembly: AssemblyCopyright("Copyright © 2017")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
[assembly: ComVisible(false)]
// Le GUID suivant est pour l'ID de la typelib si ce projet est exposé à COM
[assembly: Guid("94f34892-5ad6-401d-9b86-490b3d74a7a0")]
// Les informations de version pour un assembly se composent des quatre valeurs suivantes :
//
// Version principale
// Version secondaire
// Numéro de build
// Révision
//
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{94F34892-5AD6-401D-9B86-490B3D74A7A0}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>StubDataAccessLayer</RootNamespace>
<AssemblyName>StubDataAccessLayer</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DalManager.cs" />
<Compile Include="DataBaseBridge.cs" />
<Compile Include="Interface1.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SqlServer.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EntitiesLayer\EntitiesLayer.csproj">
<Project>{ba250fbe-da3e-43ef-b626-1c10c5d06d98}</Project>
<Name>EntitiesLayer</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
\ No newline at end of file
......@@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BusinessLayer</RootNamespace>
<AssemblyName>BusinessLayer</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......@@ -49,7 +50,7 @@
<Name>EntitiesLayer</Name>
</ProjectReference>
<ProjectReference Include="..\StubDataAccessLayer\StubDataAccessLayer.csproj">
<Project>{94f34892-5ad6-401d-9b86-490b3d74a7a0}</Project>
<Project>{5CB605E8-B932-437E-9BFC-4C055BE067D3}</Project>
<Name>StubDataAccessLayer</Name>
</ProjectReference>
</ItemGroup>
......
using StubDataAccessLayer;
using EntitiesLayer;
using StubDataAccessLayer;
using System;
using System.Collections.Generic;
using System.Linq;
......@@ -9,16 +10,36 @@ namespace BusinessLayer
{
public class ThronesTournamentManager
{
private DalManager _dalManager;
public DalManager DalManager { get; }
public ThronesTournamentManager()
{
_dalManager = DalManager.Instance;
DalManager = new DalManager(); // StubDataAccessLayer
//_dalManager = DalManager.Instance;
}
public void DisplayHouses()
public List<String> HousesList()
{
List<House> list = DalManager.HousesList();
return list.Select(House => House.Name).ToList();
}
public List<String> HousesList(int sup)
{
List<House> list = DalManager.HousesList(sup);
return list.Select(House => House.Name).ToList();
}
public List<String> CharactersCharacteristicsList()
{
List<Characteristics> list = DalManager.CharactersCharacteristicsList();
return list.Select(c => "PV -> " + c.PV + ", Type -> " + c.Type + ", Bravoury -> " + c.Bravoury + ", Crazyness -> " + c.Crazyness).ToList();
}
public List<String> TerritoryList()
{
List<Territory> list = DalManager.TerritoriesList();
return list.Select(t => t.Type + " owned by " + t.Owner.Name).ToList();
}
}
}
......@@ -23,131 +23,40 @@ namespace EntitiesLayer
LOSER
}
public class Character : EntityObject
public class Characteristics
{
private int _id;
private string _firstName;
private string _lastName;
private int _pv;
private CharacterType _type;
private int _bravoury;
private int _crazyness;
private Dictionary<Character, RelationshipType> _relationShips;
public uint PV { get; set; }
public CharacterType Type { get; set; }
public int Bravoury { get; set; }
public int Crazyness { get; set; }
public Character(int id, string firstName, string lastName, int pv, CharacterType type, int bravoury, int crazyness, Dictionary<Character, RelationshipType> relationShips)
public Characteristics(uint pv, CharacterType type, int bravoury, int crazyness)
{
Id = id;
FirstName = firstName;
LastName = lastName;
Pv = pv;
PV = pv;
Type = type;
Bravoury = bravoury;
Crazyness = crazyness;
RelationShips = relationShips;
}
public int GetId
{
get
{
return _id;
}
set
{
_id = value;
}
}
public string FirstName
{
get
{
return _firstName;
}
set
{
_firstName = value;
}
}
}
public string LastName
{
get
{
return _lastName;
}
set
{
_lastName = value;
}
}
public int Pv
{
get
{
return _pv;
}
set
{
_pv = value;
}
}
public int Bravoury
{
get
{
return _bravoury;
}
set
{
_bravoury = value;
}
}
public int Crazyness
{
get
{
return _crazyness;
}
set
{
_crazyness = value;
}
}
public class Character : EntityObject
{
public string FirstName { get; set; }
public string LastName { get; set; }
public Characteristics Characteristics { get; set; }
public Dictionary<Character, RelationshipType> RelationShips { get; set; }
public Dictionary<Character, RelationshipType> RelationShips
public Character(int id, string firstName, string lastName, uint pv, CharacterType type, int bravoury, int crazyness)
{
get
{
return _relationShips;
}
set
{
_relationShips = value;
}
FirstName = firstName;
LastName = lastName;
Characteristics = new Characteristics(pv, type, bravoury, crazyness);
RelationShips = new Dictionary<Character, RelationshipType>();
}
public CharacterType Type
public Character(int id, string firstName, string lastName, uint pv, CharacterType type, int bravoury, int crazyness, Dictionary<Character, RelationshipType> relationShips) : this(id, firstName, lastName, pv, type, bravoury, crazyness)
{
get
{
return _type;
}
set
{
_type = value;
}
RelationShips = relationShips;
}
public void AddRelatives(Character c, RelationshipType rel)
......@@ -157,7 +66,7 @@ namespace EntitiesLayer
override public string ToString()
{
return "I am " + FirstName + " " + LastName + " and I have " + Pv + " pv.";
return "I am " + FirstName + " " + LastName + " and I have " + Characteristics.PV + " pv.";
}
}
}
......@@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EntitiesLayer</RootNamespace>
<AssemblyName>EntitiesLayer</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -8,19 +8,6 @@ namespace EntitiesLayer
{
public abstract class EntityObject
{
private int _id;
public int Id
{
get
{
return _id;
}
set
{
_id = value;
}
}
public int ID { get; set; }
}
}
......@@ -8,59 +8,30 @@ namespace EntitiesLayer
{
public class House : EntityObject
{
private List<Character> _housers;
private string _name;
private int _nbUnities;
public string Name { get; set; }
public List<Character> Housers { get; set; }
public int NbUnits { get; set; }
public House(List<Character> housers, string name, int nbUnities)
public House(string name)
{
Housers = housers;
Name = name;
NbUnities = nbUnities;
Housers = new List<Character>();
NbUnits = 0;
}
public List<Character> Housers
public House(List<Character> housers, string name, int nbUnits)
{
get
{
return _housers;
}
set
{
_housers = value;
}
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
Name = name;
Housers = housers;
NbUnits = nbUnits;
}
public int NbUnities
public void AddHousers(List<Character> housers)
{
get
foreach(Character c in housers)
{
return _nbUnities;
Housers.Add(c);
}
set
{
_nbUnities = value;
}
}
public void AddHousers(Character c)
{
Housers.Add(c);
}
public override string ToString()
......
......@@ -15,39 +15,13 @@ namespace EntitiesLayer
}
public class Territory : EntityObject
{
private TerritoryType _type;
private House _owner;
public TerritoryType Type { get; set; }
public House Owner { get; set; }
public Territory(TerritoryType type, House owner)
{
Type = type;
Owner = owner;
}
public TerritoryType Type
{
get
{
return _type;
}
set
{
_type = value;
}
}
public House Owner
{
get
{
return _owner;
}
set
{
_owner = value;
}
}
}
}
......@@ -7,119 +7,95 @@ using System.Threading.Tasks;
namespace StubDataAccessLayer
{
public class Features
public class DalManager
{
private int _pv;
private CharacterType _type;
private int _bravoury;