コード例 #1
0
        public static Commissaire GetCommissaireById(string id, bool initializer = true)
        {
            if (CommissaireAlreadyInDictionary(id))
            {
                return(CommissaireDictionary[id]);
            }

            var cdao = CommissaireDAL.SelectCommissaireById(id);
            var pdao = PersonneDAL.SelectPersonneById(cdao.PersonneId);

            var listeAdresse = new List <Adresse>();

            if (initializer)
            {
                foreach (var adresseInDAO in pdao.Adresses)
                {
                    var adresse = AdresseORM.GetAdresseById(adresseInDAO, false);
                    listeAdresse.Add(adresse);
                }
            }

            var user = new Commissaire(cdao.IdCommissaire, pdao.IdPersonne, pdao.Nom, pdao.Prenom, pdao.Age, pdao.Email,
                                       pdao.Password, pdao.TelephoneMobile, pdao.TelephoneFixe, listeAdresse);


            if (initializer)
            {
                CommissaireDictionary[user.IdCommissaire] = user;
                AdresseORM.Populate(user.Adresses);
            }

            return(user);
        }
コード例 #2
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);
        }
コード例 #3
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);
        }
コード例 #4
0
        public static void AddOrUpdateCommissaire(Commissaire user)
        {
            var test = PersonneDAL.SelectPersonneById(user.IdPersonne);

            if (test.IdPersonne == null)
            {
                PersonneDAL.InsertNewPersonne(new PersonneDAO(user.IdPersonne, user.Nom, user.Prenom, user.Age,
                                                              user.Email,
                                                              user.Password, user.TelephoneMobile, user.TelephoneMobile,
                                                              user.Adresses.Select(adress => adress.IdAdresse).ToList()));
            }

            CommissaireDAL.InsertOrAddNewCommissaire(CommissaireToDao(user));
        }
コード例 #5
0
        private void CreateNewEnchere(object sender, RoutedEventArgs e)
        {
            if (InputDateHeureVente.SelectedDate != null ||
                !string.IsNullOrEmpty(InputPrixProposer.Text))
            {
                var uuid = Guid.NewGuid().ToString();

                var lot         = new Lot();
                var commissaire = new Commissaire();
                var utilisateur = new Utilisateur();

                _enchere.IdEnchere    = uuid;
                _enchere.PrixProposer =
                    int.TryParse(InputPrixProposer.Text, out _) ? int.Parse(InputPrixProposer.Text) : 0;
                _enchere.IsAdjuger      = InputIsAdjuger.IsChecked ?? false;
                _enchere.DateHeureVente = InputDateHeureVente.SelectedDate ?? DateTime.Now;


                if (_utilisateur == null)
                {
                    InputOrdreAchat.Text = "ordreAchat1";
                }

                if (string.IsNullOrEmpty(InputLotId.Text))
                {
                    InputLotId.Text = "lot1";
                }

                if (string.IsNullOrEmpty(InputCommissaireId.Text))
                {
                    InputCommissaireId.Text = "commissaire1";
                }

                // Donc ça c'est bon
                if (!string.IsNullOrEmpty(InputOrdreAchat.Text))
                {
                    _enchere.OrdreAchatEnchere = OrdreAchatORM.GetOrdreAchatById(InputOrdreAchat.Text);
                }

                if (!string.IsNullOrEmpty(InputLotId.Text))
                {
                    _enchere.LotEnchere = LotORM.GetLotById(InputLotId.Text);
                }

                if (!string.IsNullOrEmpty(InputCommissaireId.Text))
                {
                    _enchere.CommissaireEnchere = CommissaireORM.GetCommissaireById(InputCommissaireId.Text);
                }


                _enchere.UtilisateurEnchere = _utilisateur;


                EnchereORM.InsertOrAddNewEnchere(_enchere);
                _win.Close();
            }
            else
            {
                MessageBox.Show("Veuillez compléter tout les champs !");
            }
        }
コード例 #6
0
 public static void DeleteCommissaire(Commissaire user)
 {
     CommissaireDAL.DeleteCommissaire(user.IdCommissaire);
 }
コード例 #7
0
 private static CommissaireDAO CommissaireToDao(Commissaire user)
 {
     return(new CommissaireDAO(user.IdCommissaire, user.IdPersonne));
 }