public Client Retrieve(RetrieveClientArgs args)
        {
            var result = from c in session.Query<Client>()
                         where c.IdClient == args.IdClient
                         select c;

            return result.FirstOrDefault();
        }
        private void btnSauvegarder_Click(object sender, RoutedEventArgs e)
        {
            //Si aucun client, on va le chercher dans la base de données par son numéro de téléphone
            if (ViewModel.Soumission.Client == null)
            {
                _clientService = ServiceFactory.Instance.GetService<IClientService>();
                RetrieveClientArgs = new RetrieveClientArgs();
                RetrieveClientArgs.IdClient = 2;
                Client = _clientService.Retrieve(RetrieveClientArgs);
                MessageBox.Show(Client.Nom);
            }

            ViewModel.SauvegarderCommand();
        }
Example #3
0
        public Client Retrieve(RetrieveClientArgs args)
        {
            try
            {
                connexion = new MySqlConnexion();

                string requete = String.Format("SELECT * FROM Clients INNER JOIN Personnes ON Clients.idClient = Personnes.idPersonne WHERE idClient = {0}", args.IdClient);
                DataSet dataset = connexion.Query(requete);

                return ConstructClient(dataset.Tables[0].Rows[0]);

            }
            catch (MySqlException)
            {
                throw;
            }
        }
 public Client Retrieve(RetrieveClientArgs args)
 {
     return _clients.Where(c => c.IdClient == args.IdClient).First();
 }
Example #5
0
        private void ChargerClients()
        {
            ServiceFactory.Instance.Register<IClientService, NHibernateClientService>(new NHibernateClientService());

            //Charge la liste de tous les clients
            _clientService = ServiceFactory.Instance.GetService<IClientService>();
            RetrieveClientArgs = new RetrieveClientArgs();
            ListeClients = _clientService.RetrieveAll();
            datagridListeClients.ItemsSource = ListeClients;
        }