Exemple #1
0
        public void getParticipatesReadable()
        {
            try
            {
                MDI_DB.Participe oParticipe = new MDI_DB.Participe();
                MDI_DB.Classe    oClasse    = new MDI_DB.Classe();
                MDI_DB.Students  oStudents  = new MDI_DB.Students();

                List <dynamic> lReadable = new List <dynamic>();

                foreach (ModeleParticipe oMPart in oParticipe.Participe_SelectAll())
                {
                    string   stuPre  = oStudents.Students_SelectOne(oMPart.Stu_Id).Prenom;
                    string   stuNom  = oStudents.Students_SelectOne(oMPart.Stu_Id).Nom;
                    string   claLib  = oClasse.Classe_SelectOne(oMPart.Clas_Id).Lib;
                    DateTime lastUpd = oMPart.LastUpd;

                    lReadable.Add(new ModeleParticipeReadable(stuNom, stuPre, claLib, lastUpd));
                }

                dataGrid.DataSource = lReadable;
            }
            catch (BusinessError be)
            {
                MessageBox.Show(be.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (readable)
                {
                    List <dynamic> lparam = new List <dynamic>();

                    for (int i = 0; i < dataGrid.CurrentRow.Cells.Count; i++)
                    {
                        lparam.Add(dataGrid.CurrentRow.Cells[i].Value);
                    }

                    MDI_DB.Participe oParticipe = new MDI_DB.Participe();
                    oParticipe.Participe_Delete(lparam[1], lparam[0], lparam[2]);
                    getParticipatesReadable();
                }
                else
                {
                    ModeleParticipe  oModele    = (ModeleParticipe)dataGrid.CurrentRow.DataBoundItem;
                    MDI_DB.Participe oParticipe = new MDI_DB.Participe();
                    oParticipe.Participe_Delete2(oModele.Stu_Id, oModele.Clas_Id);
                    getParticipates();
                }
            }
            catch (BusinessError be)
            {
                MessageBox.Show(be.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void getListed()
        {
            try
            {
                MDI_DB.Participe oParticipe = new MDI_DB.Participe();
                MDI_DB.Classe    oClasse    = new MDI_DB.Classe();
                MDI_DB.Students  oStudents  = new MDI_DB.Students();

                List <string> lEtudiant = new List <string>();
                lClasse.Clear();
                cb_Etudiant.Items.Clear();

                foreach (ModeleParticipe oMPart in oParticipe.Participe_SelectAll())
                {
                    string stuPre = oStudents.Students_SelectOne(oMPart.Stu_Id).Prenom;
                    string stuNom = oStudents.Students_SelectOne(oMPart.Stu_Id).Nom;
                    string claLib = oClasse.Classe_SelectOne(oMPart.Clas_Id).Lib;

                    cb_Etudiant.Items.Add(stuPre + " - " + stuNom);
                    lClasse.Add(claLib);
                }

                getClasses();
            }
            catch (BusinessError be)
            {
                MessageBox.Show(be.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #4
0
 private void getParticipates()
 {
     try
     {
         MDI_DB.Participe oParticipe = new MDI_DB.Participe();
         dataGrid.DataSource = oParticipe.Participe_SelectAll();
     }
     catch (BusinessError be)
     {
         MessageBox.Show(be.Message);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void bt_Update_Click(object sender, EventArgs e)
        {
            if (cb_Etudiant.SelectedIndex >= 0)
            {
                if (cb_Classe.SelectedIndex >= 0)
                {
                    if (!(cb_Classe.Items[cb_Classe.SelectedIndex].ToString().Equals(l_NomClasseEnCours.Text)))
                    {
                        try
                        {
                            int    decoupe = cb_Etudiant.Items[cb_Etudiant.SelectedIndex].ToString().IndexOf("-");
                            string prenom  = cb_Etudiant.Items[cb_Etudiant.SelectedIndex].ToString().Substring(0, (decoupe - 1));
                            string nom     = cb_Etudiant.Items[cb_Etudiant.SelectedIndex].ToString().Substring(decoupe + 2);
                            string libelle = cb_Classe.Items[cb_Etudiant.SelectedIndex].ToString();

                            MDI_DB.Participe oParticipe = new MDI_DB.Participe();
                            oParticipe.Participe_Update(nom, prenom, l_NomClasseEnCours.Text, nom, prenom, libelle);
                            MessageBox.Show(nom + " " + prenom + " a bien été déplacé dans la classe " + libelle);
                        }

                        catch (BusinessError be)
                        {
                            MessageBox.Show(be.Message);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                    else
                    {
                        MessageBox.Show("la classe n'a pas changé, veuillez vérifier");
                    }
                }
                else
                {
                    MessageBox.Show("Veuillez sélectionner une Classe");
                }
            }
            else
            {
                MessageBox.Show("Veuillez sélectionner un étudiant");
            }

            getListed();
        }
        private void bt_Add_Click(object sender, EventArgs e)
        {
            if (cb_Classe.SelectedIndex >= 0)
            {
                if (cb_Etudiant.SelectedIndex >= 0)
                {
                    int    decoupe = cb_Etudiant.Items[cb_Etudiant.SelectedIndex].ToString().IndexOf("-");
                    string prenom  = cb_Etudiant.Items[cb_Etudiant.SelectedIndex].ToString().Substring(0, (decoupe - 1));
                    string nom     = cb_Etudiant.Items[cb_Etudiant.SelectedIndex].ToString().Substring(decoupe + 2);
                    string libelle = cb_Classe.Items[cb_Etudiant.SelectedIndex].ToString();

                    try
                    {
                        MDI_DB.Participe oParticipe = new MDI_DB.Participe();
                        oParticipe.Participe_Add(nom, prenom, libelle);
                        MessageBox.Show(nom + " " + prenom + " a bien été inscrit dans la classe " + libelle);
                    }

                    catch (BusinessError be)
                    {
                        MessageBox.Show(be.Message);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show("Veuillez sélectionner un étudiant");
                }
            }
            else
            {
                MessageBox.Show("Veuillez sélectionner une classe");
            }
        }