You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.6 KiB
74 lines
2.6 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Runtime.Intrinsics.X86;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CanYouBuildIt.Model
|
|
{
|
|
public class Build
|
|
{
|
|
public static int nbId = 0;
|
|
public int id { get; private set; }
|
|
public float prix { get; private set; }
|
|
public string image { get; private set; }
|
|
public Composant boitier { get; private set; }
|
|
public Composant processeur { get; private set; }
|
|
public Composant ventirad { get; private set; }
|
|
public Composant cartemere { get; private set; }
|
|
public Composant memoirevive { get; private set; }
|
|
public Composant cartegraphique { get; private set; }
|
|
public Composant alimentation { get; private set; }
|
|
public Composant ventilateur { get; private set; }
|
|
public Composant SSD { get; private set; }
|
|
public Composant HDD { get; private set; }
|
|
|
|
//public List<Composant> listComp { get; private set; }
|
|
|
|
|
|
|
|
public Build(string image,Composant boitier, Composant processeur, Composant ventirad, Composant cartemere, Composant memoirevive, Composant cartegraphique, Composant alimentation, Composant ventilateur = null, Composant ssd = null, Composant hdd = null)
|
|
{
|
|
id = nbId;
|
|
nbId = nbId +1;
|
|
|
|
this.image = image;
|
|
//-- ajoue de chaque élément + calcule du prix total
|
|
this.boitier = boitier;
|
|
prix = boitier.prix;
|
|
this.processeur = processeur;
|
|
prix = prix + processeur.prix;
|
|
this.ventirad = ventirad;
|
|
prix = prix + ventirad.prix;
|
|
this.cartemere = cartemere;
|
|
prix = prix + cartemere.prix;
|
|
this.memoirevive = memoirevive;
|
|
prix = prix + memoirevive.prix;
|
|
this.cartegraphique = cartegraphique;
|
|
prix = prix + cartegraphique.prix;
|
|
this.alimentation = alimentation;
|
|
prix = prix + alimentation.prix;
|
|
|
|
//-- element non obligatoire d'un build --//
|
|
if (ventilateur != null)
|
|
{
|
|
this.ventilateur = ventilateur;
|
|
prix = prix + ventilateur.prix;
|
|
}
|
|
if (ssd != null)
|
|
{
|
|
this.SSD = ssd;
|
|
prix = prix + ssd.prix;
|
|
}
|
|
if (hdd != null)
|
|
{
|
|
this.HDD = hdd;
|
|
prix = prix + hdd.prix;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
}
|