public static Paiement GetPaiementById(string id, bool initializer = true) { var pdao = PaiementDAL.SelectPaiementById(id); var utilisateurPaiement = new Utilisateur(); var lotPaiement = new Lot(); if (initializer) { lotPaiement = LotORM.GetLotById(LotDAL.SelectLotById(pdao.LotId).IdLot, false); utilisateurPaiement = UtilisateurORM.GetUtilisateurById( UtilisateurDAL.SelectUtilisateurById(pdao.UtilisateurId).IdUtilisateur, false); } var paiement = new Paiement(pdao.IdPaiement, utilisateurPaiement, pdao.TypePaiement, pdao.ValidationPaiement, lotPaiement); if (initializer) { _paiementsDictionary[paiement.IdPaiement] = paiement; LotORM.Populate(paiement.LotPaiement); UtilisateurORM.Populate(new List <Utilisateur>(new[] { paiement.UtilisateurPaiement })); } return(paiement); }
public static Lot GetLotById(string id, bool initializer = true) { var lot = new Lot(); var ldao = LotDAL.SelectLotById(id); var lproduit = new List <Produit>(); if (initializer) { var produits = ProduitORM.GetAllProduit(); foreach (var produit in produits) { if (produit.LotProduit.IdLot == id) { lproduit.Add(produit); } } } lot = new Lot(id, ldao.NomLot, ldao.Description, lproduit); if (initializer) { _lotsDictionary[lot.IdLot] = lot; ProduitORM.Populate(lproduit); } return(lot); }
public static Vente GetVenteById(string id, bool initializer = true) { var vdao = VenteDAL.SelectVenteById(id); var lotVente = new Lot(); var adresseVente = new Adresse(); if (initializer) { lotVente = LotORM.GetLotById(LotDAL.SelectLotById(vdao.LotId).IdLot, false); adresseVente = AdresseORM.GetAdresseById(AdresseDAL.SelectAdresseById(vdao.AdresseId).IdAdresse, false); } var vente = new Vente(vdao.IdVente, vdao.DateDebut, adresseVente, lotVente); if (initializer) { _ventesDictionary[vente.IdVente] = vente; LotORM.Populate(vente.LotVente); AdresseORM.Populate(new List <Adresse>(new[] { vente.AdresseVente })); } return(vente); }