예제 #1
0
        public CreerClient()
        {
            InitializeComponent();

            // ajout des valeurs

            try
            {
                List <ComboxItem> data = new List <ComboxItem>();

                foreach (Client unClient in BDDExterne.GetAllClients())
                {
                    data.Add(new ComboxItem()
                    {
                        Value = unClient.cliId, Text = unClient.cliNom + " " + unClient.cliPrenom
                    });
                }

                comboBoxListeClient.DisplayMember = "Text";
                comboBoxListeClient.DataSource    = data;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
예제 #2
0
 private void BtnAjouter_Click(object sender, EventArgs e)
 {
     if (!CheckControls())
     {
         MessageBox.Show("Renseignez tout les champs !");
     }
     else
     {
         List <Parametre> maListeParam = new List <Parametre>();
         foreach (var item in LbxParamsAjout.Items)
         {
             Parametre monParam = new Parametre(Guid.NewGuid(), item.ToString(), 0);
             maListeParam.Add(monParam);
         }
         Module monModule = new Module(Guid.NewGuid(), TbxLibelleAjout.Text, BDDExterne.GetGamme(CbxGammeAjout.SelectedValue.ToString()), BDDExterne.GetMatiere(CbxMatièreAjout.SelectedValue.ToString()), 0, maListeParam, textBox3.Text);
         string query     = @"INSERT INTO public.module(mod_id, mod_libelle, mod_prix_base, ""uniteUsage"", matiere, gamme)VALUES('" + monModule.modId.ToString() + "', '" + monModule.modLibele + "', 0, '" + monModule.uniteUsage + "', '" + monModule.modMatiere.matId + "', '" + monModule.modGamme.gamId + "' )";
         if (BDDExterne.Insert(query) == false)
         {
             MessageBox.Show("ERREUR INSERT");
         }
         foreach (Parametre monParam in monModule.modParametres)
         {
             query = @"INSERT INTO public.parametre(par_id, par_nom, mod_id)VALUES ('" + monParam.parId + "', '" + monParam.parNom + "', '" + monModule.modId + "');";
             if (BDDExterne.Insert(query) == false)
             {
                 MessageBox.Show("ERREUR INSERT");
             }
         }
     }
 }
예제 #3
0
        void BtnChoisirClientClick(object sender, EventArgs e)
        {
            Devis monDevis = new Devis(Guid.NewGuid(), 0, DateTime.Now, BDDExterne.GetClient(comboBoxListeClient.SelectedValue.ToString()), BDDExterne.GetSalarie("b807c385-2737-413a-b9b2-c076638275bd"));

            BDDExterne.AjouterDevis(monDevis);
            ActionButtonGeneric.GoNextForm(this, new ListeModuleParDevis(monDevis.devId.ToString()));
        }
예제 #4
0
        private void listBoxClient_SelectedValueChanged(object sender, EventArgs e)
        {
            try
            {
                List <ComboxItem> data = new List <ComboxItem>();

                foreach (Devis item in BDDExterne.GetAllDevis())
                {
                    if (item.devClient.cliId == Guid.Parse(listBoxClient.SelectedValue.ToString()))
                    {
                        data.Add(new ComboxItem()
                        {
                            Value = item.devId, Text = item.devDateCreation.ToString()
                        });
                    }
                }

                listBoxDevis.DisplayMember = "Text";
                listBoxDevis.DataSource    = data;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
예제 #5
0
        void BtnAjouter_Click(object sender, EventArgs e)
        {
            Client monClient = new Client(Guid.NewGuid(), textBoxNom.Text, textBoxPrenom.Text, textBoxNumRue.Text, textBoxRue.Text, textBoxCodePostal.Text, textBoxVille.Text, textBoxTelephone.Text, textBoxEmail.Text);

            if (BDDExterne.AjouterClient(monClient) == false)
            {
                MessageBox.Show("Echec de l'ajout du client");
            }
        }
예제 #6
0
 private void BtnModifier_Click(object sender, EventArgs e)
 {
     if (BDDExterne.GetAllModules().Count <= 0)
     {
         MessageBox.Show("Il n'y a pas de modules !");
     }
     else
     {
         ComboxItem item = (ComboxItem)CbxModuleModifier.SelectedItem;
         Module     modu = BDDExterne.GetAllModules().Find(x => x.modId == (Guid)item.Value);
         ActionButtonGeneric.GoNextForm(this, new ModificationModule(modu));
     }
 }
예제 #7
0
 private void BtnSupprimer_Click(object sender, EventArgs e)
 {
     if (BDDExterne.GetAllModules().Count <= 0)
     {
         MessageBox.Show("Il n'y a pas de module !");
     }
     else
     {
         ComboxItem item = (ComboxItem)CbxModuleSupprimer.SelectedItem;
         if (BDDExterne.SupprimerModule(Convert.ToString(item.Value)))
         {
             MessageBox.Show("Le module a été supprimée !");
             reloadModules();
         }
     }
 }
예제 #8
0
        void Reload()
        {
            // ajout des fournisseurs dans les combobox
            ComboxItem item;

            foreach (Fournisseur f in BDDExterne.GetAllFournisseur())
            {
                item = new ComboxItem(f.fouNom, f.fouId);
                CbxFournisseurModifier.Items.Add(item);
            }

            List <ComboxItem> data = new List <ComboxItem>();

            foreach (Fournisseur itemf in BDDExterne.GetAllFournisseur())
            {
                data.Add(new ComboxItem()
                {
                    Value = itemf.fouId, Text = itemf.fouNom
                });
            }

            CbxFournisseurAjouter.DisplayMember = "Text";
            CbxFournisseurAjouter.ValueMember   = "Value";
            CbxFournisseurAjouter.DataSource    = data;

            // ajout des matières pour suppression
            foreach (Matiere m in BDDExterne.GetAllMatiere())
            {
                item = new ComboxItem(m.matLibelle, m.matId);
                CbxMatièreSupprimer.Items.Add(item);
            }
            List <ComboxItem> data2 = new List <ComboxItem>();

            foreach (Matiere itemm in BDDExterne.GetAllMatiere())
            {
                data2.Add(new ComboxItem()
                {
                    Value = itemm.matId, Text = itemm.matLibelle
                });
            }

            CbxMatièreSupprimer.DisplayMember = "Text";
            CbxMatièreSupprimer.ValueMember   = "Value";
            CbxMatièreSupprimer.DataSource    = data2;
        }
예제 #9
0
        public void reloadModules()
        {
            // vidage des combobox
            CbxModuleModifier.Items.Clear();
            CbxModuleSupprimer.Items.Clear();
            CbxModuleModifier.Text  = "";
            CbxModuleSupprimer.Text = "";

            // ajout des modules déjà existant
            ComboxItem item;

            foreach (Module m in BDDExterne.GetAllModules())
            {
                item = new ComboxItem(m.modLibele, m.modId);
                CbxModuleModifier.Items.Add(item);
                CbxModuleSupprimer.Items.Add(item);
            }
            List <ComboxItem> dataGamme = new List <ComboxItem>();


            foreach (Gamme maGamme in BDDExterne.GetAllGammes())
            {
                dataGamme.Add(new ComboxItem()
                {
                    Value = maGamme.gamId, Text = maGamme.gamLibelle
                });
            }
            CbxGammeAjout.DisplayMember = "Text";
            CbxGammeAjout.ValueMember   = "Value";
            CbxGammeAjout.DataSource    = dataGamme;

            List <ComboxItem> dataMatiere = new List <ComboxItem>();

            foreach (Matiere maMatiere in BDDExterne.GetAllMatiere())
            {
                dataMatiere.Add(new ComboxItem()
                {
                    Value = maMatiere.matId, Text = maMatiere.matLibelle
                });
            }

            CbxMatièreAjout.DisplayMember = "Text";
            CbxMatièreAjout.ValueMember   = "Value";
            CbxMatièreAjout.DataSource    = dataMatiere;
        }
예제 #10
0
 void BtnSupprimerClick(object sender, EventArgs e)
 {
     if (CbxMatièreSupprimer.SelectedIndex == -1)
     {
         MessageBox.Show("Vous devez choisir une matière à supprimer !");
     }
     else
     {
         if (BDDExterne.SupprimerMatiere(CbxMatièreSupprimer.SelectedValue.ToString()))
         {
             MessageBox.Show("Matière supprimée !");
         }
         else
         {
             MessageBox.Show("La matière n'a pas été supprimée correctement");
         }
     }
 }
예제 #11
0
        public OuvrirProjet()
        {
            InitializeComponent();

            List <ComboxItem> data = new List <ComboxItem>();

            foreach (Client item in BDDExterne.GetAllClients())
            {
                data.Add(new ComboxItem()
                {
                    Value = item.cliId, Text = item.cliNom + " " + item.cliPrenom
                });
            }



            listBoxClient.DisplayMember = "Text";
            listBoxClient.DataSource    = data;
        }
예제 #12
0
 void BtnAjouterClick(object sender, EventArgs e)
 {
     if (string.IsNullOrWhiteSpace(TbxMatièreAjouter.Text) || CbxFournisseurAjouter.SelectedIndex == -1)
     {
         MessageBox.Show("Vous devez écrire le nom de la matière et choisir un fournisseur !");
     }
     else
     {
         Fournisseur f = BDDExterne.GetFournisseur(CbxFournisseurAjouter.SelectedValue.ToString());
         Matiere     m = new Matiere(Guid.NewGuid(), TbxMatièreAjouter.Text, f);
         if (BDDExterne.AjouterMatiere(m))
         {
             MessageBox.Show("La matière a bien été ajoutée !");
         }
         else
         {
             MessageBox.Show("La matière n'a pas été ajoutée correctement !");
         }
     }
 }
예제 #13
0
        void refresh()
        {
            try
            {
                List <ComboxItem> data = new List <ComboxItem>();

                foreach (Client unClient in BDDExterne.GetAllClients())
                {
                    data.Add(new ComboxItem()
                    {
                        Value = unClient.cliId, Text = unClient.cliNom + " " + unClient.cliPrenom
                    });
                }

                comboBoxListeClient.DisplayMember = "Text";
                comboBoxListeClient.DataSource    = data;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
        }
예제 #14
0
 void BtnSupprimer_Click(object sender, EventArgs e)
 {
     BDDExterne.SupprimerClient(client.cliId.ToString());
     BtnRetour_Click(sender, e);
 }