Ejemplo n.º 1
0
        private Boolean Start()
        {
            Log.Entete();

            Bdd2.Version(3);

            String        BaseSelectionnee;
            List <String> ListeBase = Bdd2.ListeBase();

            if (ListeBase.Count == 1)
            {
                BaseSelectionnee = ListeBase[0];
            }
            else
            {
                SelectionnerBase Fenetre = new SelectionnerBase(ListeBase);
                Fenetre.ShowDialog();
                BaseSelectionnee = Fenetre.BaseSelectionnee;
            }

            if (!Bdd2.Initialiser(BaseSelectionnee))
            {
                Log.Message("Impossible de se connecter à la base");
                MessageBox.Show("Impossible de se connecter à la base");
                return(false);
            }

            xConnexionCourante.Text = BaseSelectionnee + ", connecté à l'adresse : " + Bdd2.ConnexionCourante;

            pSociete = Bdd2.Liste <Societe>()[0];

            this.DataContext = pSociete;

            TrierListe <Chantier>(xListeChantier);

            _RechercherChantier             = new RechercheTexte <Chantier>(xListeChantier, false);
            xRechercherChantier.DataContext = _RechercherChantier;

            return(true);
        }
Ejemplo n.º 2
0
        private Boolean Start()
        {
            Log.Entete();

            String        BaseSelectionnee = "";
            List <String> ListeBase        = Bdd2.ListeBase();

            if (ListeBase.Count == 1)
            {
                BaseSelectionnee = ListeBase[0];
            }
            else
            {
                SelectionnerBase Fenetre = new SelectionnerBase(ListeBase);
                Fenetre.ShowDialog();
                BaseSelectionnee = Fenetre.BaseSelectionnee;
            }



            if (!Bdd2.Initialiser(BaseSelectionnee))
            {
                return(false);
            }

            xConnexionCourante.Text = BaseSelectionnee + ", connecté à l'adresse : " + Bdd2.ConnexionCourante;

            pSociete = Bdd2.Liste <Societe>()[0];

            var ListeFamille = Bdd2.Liste <Famille>();

            Bdd2.PreCharger(typeof(Famille), new List <ObjetGestion>(ListeFamille));

            pSociete.OnModifyUtilisateur += new Societe.OnModifyUtilisateurEventHandler(id => { Properties.Settings.Default.IdUtilisateur = id; Properties.Settings.Default.Save(); });

            ListeObservable <Utilisateur> pListeUtilisateur = pSociete.ListeUtilisateur;

            Utilisateur U = null;

            if (pListeUtilisateur.Count > 0)
            {
                try
                {
                    U = pListeUtilisateur.First(u => { return(u.Id == Properties.Settings.Default.IdUtilisateur); });
                }
                catch { U = pListeUtilisateur[0]; }
            }
            else
            {
                U = new Utilisateur(pSociete);
                U.Prefix_Utilisateur = "A";
                Bdd2.Ajouter(U);
            }

            pSociete.UtilisateurCourant = U;

            this.DataContext = pSociete;

            TrierListe <Client>(xListeClient);
            TrierListe <Devis>(xListeDevis);
            TrierListe <Facture>(xListeFactureClient);
            TrierListe <Facture>(xListeFactureDevis);

            _RechercherClient             = new RechercheTexte <Client>(xListeClient);
            xRechercherClient.DataContext = _RechercherClient;

            _RechercherDevis             = new RechercheTexte <Devis>(xListeDevis);
            xRechercherDevis.DataContext = _RechercherDevis;

            _RechercherFactureClient             = new RechercheTexte <Facture>(xListeFactureClient);
            xRechercherFactureClient.DataContext = _RechercherFactureClient;

            return(true);
        }