public static OrdreAchat GetOrdreAchatById(string id, bool initializer = true) { var ordreAchat = new OrdreAchat(); var odao = OrdreAchatDAL.SelectOrdreAchatById(id); var lotOrdreAchat = new Lot(); var utilisateurOrdreAchat = new Utilisateur(); if (initializer) { utilisateurOrdreAchat = UtilisateurORM.GetUtilisateurById(odao.UtilisateurId, false); lotOrdreAchat = LotORM.GetLotById(odao.LotId, false); } ordreAchat = new OrdreAchat(id, utilisateurOrdreAchat, lotOrdreAchat, odao.Informatiser, odao.MontantMax, odao.Date); if (initializer) { _ordreAchatsDictionary[ordreAchat.IdOrdreAchat] = ordreAchat; UtilisateurORM.Populate(new List <Utilisateur>(new[] { ordreAchat.UtilisateurOrdreAchat })); LotORM.Populate(ordreAchat.LotOrdreAchat); } return(ordreAchat); }
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 Enchere GetEnchereById(string id, bool initializer = true) { var edao = EnchereDAL.SelectEnchereById(id); var commissaireEnchere = new Commissaire(); var lotEnchere = new Lot(); var ordreAchatEnchere = new OrdreAchat(); var utilisateurEnchere = new Utilisateur(); if (initializer) { commissaireEnchere = CommissaireORM.GetCommissaireById(edao.CommissaireId, false); lotEnchere = LotORM.GetLotById(edao.LotId, false); if (edao.OrdreAchatId != null) { ordreAchatEnchere = OrdreAchatORM.GetOrdreAchatById(edao.OrdreAchatId, false); } if (edao.UtilisateurId != null) { utilisateurEnchere = UtilisateurORM.GetUtilisateurById(edao.UtilisateurId, false); } } var enchere = new Enchere(edao.IdEnchere, edao.PrixProposer, edao.EstAdjuger, edao.DateHeureVente, ordreAchatEnchere, lotEnchere, commissaireEnchere, utilisateurEnchere); if (initializer) { _encheresDictionary[enchere.IdEnchere] = enchere; CommissaireORM.Populate(new List <Commissaire>(new[] { enchere.CommissaireEnchere })); LotORM.Populate(enchere.LotEnchere); if (edao.OrdreAchatId != null) { OrdreAchatORM.Populate(enchere.OrdreAchatEnchere); } if (edao.UtilisateurId != null) { UtilisateurORM.Populate(new List <Utilisateur>(new[] { enchere.UtilisateurEnchere })); } } return(enchere); }
public static Produit GetProduitById(string id, bool initializer = true) { var pdao = ProduitDAL.SelectProduitById(id); var lotProduit = new Lot(); var utilisateurProduit = new Utilisateur(); var stockProduit = new Stock(); var enchereGagnante = new Enchere(); var categorieProduit = new Categorie(); if (initializer) { lotProduit = LotORM.GetLotById(pdao.LotId, false); utilisateurProduit = UtilisateurORM.GetUtilisateurById(pdao.UtilisateurId, false); stockProduit = StockORM.GetStockById(pdao.StockId, false); if (!string.IsNullOrEmpty(pdao.EnchereGagnanteId)) { enchereGagnante = EnchereORM.GetEnchereById(pdao.EnchereGagnanteId, false); } //todo decomente ici // categorieProduit = // CategorieORM.GetCategorieById(CategorieDAL.SelectCategorieById(pdao.CategorieId).CategorieId, // false); } var produit = new Produit(pdao.IdProduit, lotProduit, utilisateurProduit, stockProduit, enchereGagnante, categorieProduit , pdao.NomArtiste, pdao.NomStyle, pdao.NomProduit, pdao.PrixReserve, pdao.ReferenceCatalogue, pdao.DescriptionProduit, pdao.IsSend); if (initializer) { _produitsDictionary[produit.IdProduit] = produit; LotORM.Populate(produit.LotProduit); UtilisateurORM.Populate(new List <Utilisateur>(new[] { produit.UtilisateurProduit })); StockORM.Populate(produit.StockProduit); if (!string.IsNullOrEmpty(produit.EnchereGagnante.IdEnchere)) { EnchereORM.Populate(produit.EnchereGagnante); } //todo decomenter ici // CategorieORM.Populate(produit.CategorieProduit); } return(produit); }
public static Produit produitDaoToProduit(ProduitDAO produitDao) { var produit = new Produit(produitDao.IdProduit, LotORM.GetLotById(produitDao.LotId, false), UtilisateurORM.GetUtilisateurById(produitDao.UtilisateurId, false), StockORM.GetStockById(produitDao.StockId, false), EnchereORM.GetEnchereById(produitDao.EnchereGagnanteId, false), new Categorie() , produitDao.NomArtiste, produitDao.NomStyle, produitDao.NomProduit, produitDao.PrixReserve, produitDao.ReferenceCatalogue, produitDao.DescriptionProduit, produitDao.IsSend); return(produit); }
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); }