Ejemplo n.º 1
0
        public static Estimation GetEstimationById(string id, bool initializer = true)
        {
            var edao = EstimationDAL.SelectEstimationById(id);
            var commissaireEstimation = new Commissaire();
            var produitEstimation     = new Produit();

            if (initializer)
            {
                commissaireEstimation =
                    CommissaireORM.GetCommissaireById(
                        CommissaireDAL.SelectCommissaireById(edao.CommissaireId).IdCommissaire, false);
                produitEstimation =
                    ProduitORM.GetProduitById(ProduitDAL.SelectProduitById(edao.ProduitId).IdProduit, false);
            }


            var estimation = new Estimation(edao.CommissaireId, produitEstimation, commissaireEstimation,
                                            edao.DateEstimation, edao.PrixEstimation);

            if (initializer)
            {
                _estimationsDictionary[estimation.IdEstimation] = estimation;

                CommissaireORM.Populate(new List <Commissaire>(new[]
                {
                    estimation.CommissaireEstimation
                }));
                ProduitORM.Populate(estimation.ProduitEstimation);
            }

            return(estimation);
        }
Ejemplo n.º 2
0
        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);
        }